|
|
@@ -120,6 +120,7 @@ export default {
|
|
|
return {
|
|
|
goodsInfo: {},
|
|
|
tabIndex: 0,
|
|
|
+ region:{},
|
|
|
tabs: [
|
|
|
{
|
|
|
name: "帮我送"
|
|
|
@@ -159,8 +160,11 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters({ orderShop: "getOrderShop" }),
|
|
|
...mapGetters({ shopUser: "getShopUser" }),
|
|
|
- mayPayAmount:function(){
|
|
|
- let price = (this.goodsInfo.price * this.goodsInfo.buyNum + this.freightPrice)*this.memberDiscount - this.couponDiscountAmount;
|
|
|
+ mayPayAmount: function() {
|
|
|
+ let price =
|
|
|
+ (this.goodsInfo.price * this.goodsInfo.buyNum + this.freightPrice) *
|
|
|
+ this.memberDiscount -
|
|
|
+ this.couponDiscountAmount;
|
|
|
return price.toFixed(2);
|
|
|
}
|
|
|
},
|
|
|
@@ -168,7 +172,7 @@ export default {
|
|
|
//运费变化则总金额和应付金额变化
|
|
|
freightPrice(newVal) {
|
|
|
let price = this.goodsInfo.price * this.goodsInfo.buyNum + newVal;
|
|
|
- this.totalPrice = price.toFixed(1);
|
|
|
+ this.totalPrice = price.toFixed(2);
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
@@ -201,28 +205,44 @@ export default {
|
|
|
Object.keys(this.form).forEach((i, index) => {
|
|
|
this.form[i] = this.option[i];
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
//最终会员优惠的折扣和优惠券优惠金额
|
|
|
calcDiscount(discountData) {
|
|
|
- this.memberDiscount = discountData.memberDiscount
|
|
|
- this.couponDiscountAmount = discountData.couponDiscountAmount
|
|
|
+ this.memberDiscount = discountData.memberDiscount;
|
|
|
+ this.couponDiscountAmount = discountData.couponDiscountAmount;
|
|
|
},
|
|
|
// 生成订单
|
|
|
createOrderFn() {
|
|
|
let addForm = {};
|
|
|
- let form =
|
|
|
- this.tabIndex == 0 ? this.$refs.appDelivery.form : this.mentionForm;
|
|
|
- let region = this.tabIndex == 0 ? this.$refs.appDelivery.region : {};
|
|
|
+ if (this.tabIndex == 0) {
|
|
|
+
|
|
|
+ let form = this.$refs.appDelivery.form;
|
|
|
+ this.region = this.$refs.appDelivery.region;
|
|
|
+ let reachTime = form.reachTime;
|
|
|
+ let receiveAddress = form.receiveAddress;
|
|
|
+
|
|
|
+ if(this.$util.isEmpty(reachTime)){
|
|
|
+ this.$msg('请填写送达时间');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(this.$util.isEmpty(receiveAddress)){
|
|
|
+ this.$msg('请填写地址');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ console.log(111111)
|
|
|
+ } else {
|
|
|
+ let form = this.mentionForm;
|
|
|
+ }
|
|
|
if (this.$refs.couponSel) {
|
|
|
addForm.couponId = this.$refs.couponSel.couponId;
|
|
|
}
|
|
|
+
|
|
|
createOrder({
|
|
|
needSend: this.tabIndex == 0 ? "1" : "0",
|
|
|
...form,
|
|
|
...this.form,
|
|
|
...addForm,
|
|
|
- ...region
|
|
|
+ ...this.region
|
|
|
}).then(res => {
|
|
|
uni.removeStorageSync("buyGoodsDetil");
|
|
|
this.$util.pageTo({
|
|
|
@@ -235,7 +255,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
confirmFn() {
|
|
|
- console.log(this.$refs.appDelivery);
|
|
|
this.createOrderFn();
|
|
|
},
|
|
|
tabChange(e) {
|
|
|
@@ -259,17 +278,21 @@ export default {
|
|
|
},
|
|
|
// 表单验证
|
|
|
formSubmit(e) {
|
|
|
- let rules = [
|
|
|
- // {
|
|
|
- // name: 'receiveUserName',
|
|
|
- // rule: ['required'],
|
|
|
- // msg: ['请输入姓名']
|
|
|
- // }
|
|
|
+ let checkRules = [
|
|
|
+ {
|
|
|
+ name: "receiveUserName",
|
|
|
+ rule: ["required"],
|
|
|
+ msg: ["请填写姓名"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "receiveMobile",
|
|
|
+ rule: ["required"],
|
|
|
+ msg: ["请填写电话"]
|
|
|
+ }
|
|
|
];
|
|
|
- // 进行表单检查
|
|
|
+ let rules = this.tabIndex == 0 ? checkRules : [];
|
|
|
let formData = e.detail.value;
|
|
|
let checkRes = form.validation(formData, rules);
|
|
|
- // 验证通过!
|
|
|
if (!checkRes) {
|
|
|
this.confirmFn();
|
|
|
} else {
|