Commit 8973d4c0 by songbingqi

修复部分bug

parent 55ed3236
......@@ -372,6 +372,7 @@ export default {
this.canUse = true
const { category, ...goods } = this.goodInfo;
goods.skus = [sku];
goods.origDiscount = sku.origDiscount
goods.sku = sku;
goods.flag = true;
goods.skuId = selectedSku;
......
......@@ -62,7 +62,7 @@
<div class="goods_name">
<div class="name">{{ item.name }}</div>
<div class="price">
¥{{ Utils.isInteger(setPrice(item.sku.discount)) }}
¥{{ Utils.isInteger(setPrice(hasCoupon?item.sku.origDiscount:item.sku.discount)) }}
</div>
</div>
<div class="goods_psce">
......@@ -145,7 +145,7 @@
<div class="price">总优惠¥{{ reduction }}</div>
</div> -->
</div>
<view v-if="userms" class="payment" @click="messageAndSave">付款</view>
<view v-if="userms" class="payment" @click="messageAndSave" :style="{'background-color':submitLoading?'gray':''}">付款</view>
<button
v-if="!userms"
class="payment"
......@@ -368,6 +368,7 @@ export default {
sendMsgFlag3: false,
},
optionDecode: {},
submitLoading: false
};
},
computed: {
......@@ -389,45 +390,61 @@ export default {
});
return totalNum;
},
reduction() {
// reduction() {
// if (JSON.stringify(this.goods) == "{}") return 0;
// let price = 0;
// let discountNum = 0;
// this.goods.forEach((item) => {
// const sku = item.sku;
// if (item.flag) {
// discountNum += item.num * sku.discount;
// price += item.num * sku.price;
// } else {
// discountNum += 0;
// price += 0;
// }
// });
// return (price - discountNum).toFixed(2);
// },
amountOld() {
if (JSON.stringify(this.goods) == "{}") return 0;
let price = 0;
let discountNum = 0;
let totalPrice = 0;
if(this.hasCoupon) {
this.goods.forEach((item) => {
const sku = item.sku;
if (item.flag) {
discountNum += item.num * sku.discount;
price += item.num * sku.price;
} else {
discountNum += 0;
price += 0;
}
item.flag ? (totalPrice += item.num * sku.origDiscount) : (totalPrice += 0);
});
return (price - discountNum).toFixed(2);
},
amountOld() {
if (JSON.stringify(this.goods) == "{}") return 0;
let totalPrice = 0;
} else {
this.goods.forEach((item) => {
const sku = item.sku;
item.flag ? (totalPrice += item.num * sku.discount) : (totalPrice += 0);
});
}
return totalPrice.toFixed(2);
},
totalPrice() {
if (JSON.stringify(this.goods) == "{}") return 0;
let totalPrice = 0;
console.log(this.goods,'goods')
if(this.hasCoupon) {
this.goods.forEach((item) => {
const sku = item.sku;
item.flag ? (totalPrice += item.num * sku.origDiscount) : (totalPrice += 0);
});
totalPrice -= this.selectCoupon.couponAmount || 0;
} else {
this.goods.forEach((item) => {
const sku = item.sku;
item.flag ? (totalPrice += item.num * sku.discount) : (totalPrice += 0);
});
totalPrice -= this.selectCoupon.couponAmount || 0;
}
return totalPrice.toFixed(2);
},
hasCoupon() {
const {selectCoupon} = this
const {couponAmount} = selectCoupon
return (couponAmount!=null && couponAmount!=undefined)
}
},
methods: {
goHome() {
......@@ -499,9 +516,9 @@ export default {
});
},
itemReduction(discount, price, num) {
return ((price - discount) * num).toFixed(2);
},
// itemReduction(discount, price, num) {
// return ((price - discount) * num).toFixed(2);
// },
// 手机号授权登录
getPhoneNumber(e) {
if (e.detail.errMsg == "getPhoneNumber:ok") {
......@@ -532,6 +549,8 @@ export default {
"Fu_CPIXa0cnJ4EDdVKqFQ3qqKJccMqt2oorI5mfNq74",
];
const val = {};
if(this.submitLoading) return
this.submitLoading = true
wx.requestSubscribeMessage({
tmplIds: tmpid,
success: (res) => {
......@@ -649,8 +668,10 @@ export default {
this.buyType,
this.agreeTerms
);
this.submitLoading = false
this.cleanFlag = true;
} else {
this.submitLoading = false
}
}
},
......
......@@ -191,7 +191,7 @@ export default {
if (q) {
const optionDecode = Utils.getUrlParams2(decodeURIComponent(q));
console.log(Utils.getUrlParams2(decodeURIComponent(q)), this.userInfo);
const { num, serial_no, source } = optionDecode;
const { num, serial_no, source, serials } = optionDecode;
if (source && this.userms) {
const sendData = {
phone: this.userInfo.phoneNumber,
......@@ -200,6 +200,7 @@ export default {
param: JSON.stringify({
serial_no,
num,
serials
}),
};
Menu.sendUserCoupon(sendData);
......
......@@ -12,6 +12,7 @@ export default {
let item = shopCarInfo[i];
let res = {
origDiscount: item.origDiscount, // sku金额
goodsId: item.goodsId, //商品id
goodsName: item.name, //商品名称
machineId: undefined, //点单屏机器ID
......@@ -44,7 +45,6 @@ export default {
},
// 加入购物车数据
async getallNum(Obj, unCheckCount) {
console.log(Obj);
let shopCarInfo = uni.getStorageSync("shopCarInfo") || [];
let size = 0;
shopCarInfo.forEach((item) => (size += item.num));
......@@ -72,7 +72,6 @@ export default {
} else {
shopCarInfo = [Obj];
}
console.log(Obj);
uni.setStorageSync("shopCarInfo", shopCarInfo);
$EventBus.$emit("updateCar");
// if (callback) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment