Jelajahi Sumber

待完善数据

shish 6 tahun lalu
induk
melakukan
3f96580cfe
2 mengubah file dengan 46 tambahan dan 23 penghapusan
  1. 4 4
      mall/src/components/app-delivery.vue
  2. 42 19
      mall/src/pages/order/buy.vue

+ 4 - 4
mall/src/components/app-delivery.vue

@@ -11,7 +11,7 @@
           placeholder-style="color:#ccc"
           placeholder-style="color:#ccc"
           class="tui-input"
           class="tui-input"
           name="receiveUserName"
           name="receiveUserName"
-          placeholder="请输入姓名"
+          placeholder="请填写姓名"
         />
         />
       </tui-list-cell>
       </tui-list-cell>
       <tui-list-cell class="line-cell" :hover="false">
       <tui-list-cell class="line-cell" :hover="false">
@@ -22,12 +22,12 @@
           placeholder-style="color:#ccc"
           placeholder-style="color:#ccc"
           class="tui-input"
           class="tui-input"
           name="receiveMobile"
           name="receiveMobile"
-          placeholder="请输入电话"
+          placeholder="请填写电话"
           type="number"
           type="number"
         />
         />
       </tui-list-cell>
       </tui-list-cell>
       <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="openAddres">
       <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="openAddres">
-        <div class="tui-title">收花人城市</div>
+        <div class="tui-title">所在城市</div>
         <div
         <div
           class="tui-input"
           class="tui-input"
           v-if="form.receiveProvince || form.receiveCity"
           v-if="form.receiveProvince || form.receiveCity"
@@ -160,7 +160,7 @@
           placeholder-style="color:#ccc"
           placeholder-style="color:#ccc"
           class="tui-input"
           class="tui-input"
           name="remark"
           name="remark"
-          placeholder="请填写备注(选填)"
+          placeholder="请填写备注信息(选填)"
         />
         />
       </tui-list-cell>
       </tui-list-cell>
     </div>
     </div>

+ 42 - 19
mall/src/pages/order/buy.vue

@@ -120,6 +120,7 @@ export default {
     return {
     return {
       goodsInfo: {},
       goodsInfo: {},
       tabIndex: 0,
       tabIndex: 0,
+      region:{},
       tabs: [
       tabs: [
         {
         {
           name: "帮我送"
           name: "帮我送"
@@ -159,8 +160,11 @@ export default {
   computed: {
   computed: {
     ...mapGetters({ orderShop: "getOrderShop" }),
     ...mapGetters({ orderShop: "getOrderShop" }),
     ...mapGetters({ shopUser: "getShopUser" }),
     ...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);
       return price.toFixed(2);
     }
     }
   },
   },
@@ -168,7 +172,7 @@ export default {
     //运费变化则总金额和应付金额变化
     //运费变化则总金额和应付金额变化
     freightPrice(newVal) {
     freightPrice(newVal) {
       let price = this.goodsInfo.price * this.goodsInfo.buyNum + newVal;
       let price = this.goodsInfo.price * this.goodsInfo.buyNum + newVal;
-      this.totalPrice = price.toFixed(1);
+      this.totalPrice = price.toFixed(2);
     }
     }
   },
   },
   onLoad(option) {
   onLoad(option) {
@@ -201,28 +205,44 @@ export default {
       Object.keys(this.form).forEach((i, index) => {
       Object.keys(this.form).forEach((i, index) => {
         this.form[i] = this.option[i];
         this.form[i] = this.option[i];
       });
       });
-
     },
     },
     //最终会员优惠的折扣和优惠券优惠金额
     //最终会员优惠的折扣和优惠券优惠金额
     calcDiscount(discountData) {
     calcDiscount(discountData) {
-      this.memberDiscount = discountData.memberDiscount
-      this.couponDiscountAmount = discountData.couponDiscountAmount
+      this.memberDiscount = discountData.memberDiscount;
+      this.couponDiscountAmount = discountData.couponDiscountAmount;
     },
     },
     // 生成订单
     // 生成订单
     createOrderFn() {
     createOrderFn() {
       let addForm = {};
       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) {
       if (this.$refs.couponSel) {
         addForm.couponId = this.$refs.couponSel.couponId;
         addForm.couponId = this.$refs.couponSel.couponId;
       }
       }
+
       createOrder({
       createOrder({
         needSend: this.tabIndex == 0 ? "1" : "0",
         needSend: this.tabIndex == 0 ? "1" : "0",
         ...form,
         ...form,
         ...this.form,
         ...this.form,
         ...addForm,
         ...addForm,
-        ...region
+        ...this.region
       }).then(res => {
       }).then(res => {
         uni.removeStorageSync("buyGoodsDetil");
         uni.removeStorageSync("buyGoodsDetil");
         this.$util.pageTo({
         this.$util.pageTo({
@@ -235,7 +255,6 @@ export default {
       });
       });
     },
     },
     confirmFn() {
     confirmFn() {
-      console.log(this.$refs.appDelivery);
       this.createOrderFn();
       this.createOrderFn();
     },
     },
     tabChange(e) {
     tabChange(e) {
@@ -259,17 +278,21 @@ export default {
     },
     },
     // 表单验证
     // 表单验证
     formSubmit(e) {
     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 formData = e.detail.value;
       let checkRes = form.validation(formData, rules);
       let checkRes = form.validation(formData, rules);
-      // 验证通过!
       if (!checkRes) {
       if (!checkRes) {
         this.confirmFn();
         this.confirmFn();
       } else {
       } else {