|
@@ -1,4 +1,9 @@
|
|
|
-const _Http = getApp().globalData.http;
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ currency = require("../../../../utils/currency"),
|
|
|
+ CNY = sum => currency(sum, {
|
|
|
+ symbol: "¥",
|
|
|
+ precision: 2
|
|
|
+ }).format();
|
|
|
let downCount = {};
|
|
|
Component({
|
|
|
options: {
|
|
@@ -14,7 +19,6 @@ Component({
|
|
|
sa_brandid: null, //当前选中品牌id
|
|
|
classList: [], //生成订单时所选
|
|
|
sum: 0, //价格合
|
|
|
- yfsum: 0, //运费合
|
|
|
},
|
|
|
methods: {
|
|
|
/* 获取列表 */
|
|
@@ -37,7 +41,10 @@ Component({
|
|
|
icon: "none"
|
|
|
})
|
|
|
this.setData({
|
|
|
- list: res.data,
|
|
|
+ list: res.data.map(v => {
|
|
|
+ v.showPrice = CNY(v.oldprice)
|
|
|
+ return v
|
|
|
+ }),
|
|
|
isGet: true
|
|
|
});
|
|
|
|
|
@@ -49,6 +56,7 @@ Component({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
clickBut(e) {
|
|
|
this.data.classList.length >= 2 ? wx.showToast({
|
|
|
title: '请选择订单领域(订单只允许同品牌/同领域的商品)',
|
|
@@ -126,7 +134,6 @@ Component({
|
|
|
computeSum() {
|
|
|
let results = this.data.results,
|
|
|
sum = 0,
|
|
|
- yfsum = 0,
|
|
|
deteleList = [],
|
|
|
classList = [];
|
|
|
if (results.length) results.forEach((v, i) => {
|
|
@@ -161,19 +168,37 @@ Component({
|
|
|
sa_brandid
|
|
|
})
|
|
|
this.setData({
|
|
|
- sum:(sum).toFixed(2) - 0,
|
|
|
- yfsum,
|
|
|
+ sum: CNY(sum),
|
|
|
results,
|
|
|
sa_brandid,
|
|
|
classList
|
|
|
})
|
|
|
+ this.setLogisticsMsg(sum)
|
|
|
+ },
|
|
|
+ /* 免运费信息 */
|
|
|
+ setLogisticsMsg(sum) {
|
|
|
+ let logistics = null,
|
|
|
+ figure = this.data.figure;
|
|
|
+ if (figure == -1) {
|
|
|
+ logistics = '到付'
|
|
|
+ } else if (figure == 0) {
|
|
|
+ logistics = '预付'
|
|
|
+ } else {
|
|
|
+ logistics = sum >= figure ? '免运费' : '差' + currency(currency(figure).subtract(sum).value, {
|
|
|
+ symbol: "",
|
|
|
+ precision: 2
|
|
|
+ }).format() + '元免运费';
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ logistics
|
|
|
+ })
|
|
|
},
|
|
|
/* 删除产品 */
|
|
|
deteleItem(e) {
|
|
|
const {
|
|
|
item
|
|
|
} = e.currentTarget.dataset,
|
|
|
- that = this;
|
|
|
+ that = this;
|
|
|
_Http.basic({
|
|
|
"id": 20220924095202,
|
|
|
"content": {
|