shish 4 лет назад
Родитель
Сommit
724076452d

+ 73 - 91
ghsApp/src/admin/billing/affirm.vue

@@ -65,22 +65,29 @@
           </tui-list-cell>
 
           <tui-list-cell class="line-cell" :hover="false" :arrow="false">
-            <view class="tui-title">送货</view>
+            <view class="tui-title">配送方式</view>
             <button @tap="courier(2)" class="admin-button-com mini-btn" :class="form.sendType == 2 ? 'blue' : 'default'">自取</button>
             <button @click="courier(1)" class="admin-button-com mini-btn" :class="form.sendType == 1 ? 'blue' : 'default'">配送</button>
           </tui-list-cell>
-          <tui-list-cell class="line-cell" :hover="false" :arrow="false">
-            <view class="tui-title">结算类型</view>
-            <button @tap="form.debt = 1" class="admin-button-com mini-btn" :class="form.debt == 1 ? 'blue' : 'default'">欠款</button>
-            <button @click="form.debt = 0" class="admin-button-com mini-btn" :class="form.debt == 0 ? 'blue' : 'default'">已收款</button>
-          </tui-list-cell>
 
           <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="form.sendType == 1" >
             <view class="tui-title">运费</view>
             <input @blur="sendCostBlur" type="number" placeholder="请填写,留空免运费" v-model="form.sendCost" placeholder-class="tui-placeholder"/>
           </tui-list-cell>
 
-          <tui-list-cell class="line-cell" :arrow="true" v-if="form.debt == 0">
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false">
+            <view class="tui-title">结账状态</view>
+            <button @click="form.hasPay = 0" class="admin-button-com mini-btn" :class="form.hasPay == 0 ? 'blue' : 'default'">待结账</button>
+            <button @tap="form.hasPay = 1" class="admin-button-com mini-btn" :class="form.hasPay == 1 ? 'blue' : 'default'">已结账</button>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" v-if="form.hasPay == 1" :hover="false" :arrow="false">
+            <view class="tui-title">结账方式</view>
+            <button @click="form.debt = 0" class="admin-button-com mini-btn" :class="form.debt == 0 ? 'blue' : 'default'">已付款</button>
+            <button @tap="form.debt = 1" class="admin-button-com mini-btn" :class="form.debt == 1 ? 'blue' : 'default'">记欠款</button>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :arrow="true" v-if="form.hasPay == 1 && form.debt == 0">
             <div class="tui-title">收款方式</div>
             <picker mode="selector" :value="form.payWay" :range="payWayList" range-key="name" @change="payWayChange" class="tui-input" >
               <input v-model="form.payWay" name="payWay" type="text" hidden />
@@ -88,6 +95,12 @@
             </picker>
           </tui-list-cell>
 
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false">
+            <view class="tui-title">打印小票</view>
+            <button @click="form.needPrint = 1" class="admin-button-com mini-btn" :class="form.needPrint == 1 ? 'blue' : 'default'">打印</button>
+            <button @tap="form.needPrint = 2" class="admin-button-com mini-btn" :class="form.needPrint == 2? 'blue' : 'default'">不打</button>
+          </tui-list-cell>
+
           <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
             <view class="tui-title">总金额</view>
             <text style="color: #3385FF" v-if="form.sendType == 1">{{	parseFloat((allPrice + Number(form.sendCost)).toFixed(2)) }}</text>
@@ -103,9 +116,7 @@
 
           <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
             <view class="tui-title">
-              <text>
-                <text v-if="form.debt == 1">应收金额</text><text v-else>已收金额</text>
-              </text>  
+              <text>最终金额</text>  
             </view>
             <text style="color: #3385FF">{{parseFloat(finalPrice)}}</text>
           </tui-list-cell>
@@ -123,12 +134,12 @@
     <view class="under-bar">
       <view class="price-view">
         <text class="price-title" v-if="isBilling">
-          <text>{{form.debt == 1 ? "欠款" : "已收款"}}</text>
+          <text>最终金额</text>
         </text>
         <text class="price-title" v-else>金额</text>
         <text class="price-number">¥<text class="large">{{ finalPrice }}</text></text>
       </view>
-      <button class="admin-button-com blue middle" @click="confirmSubmit">开单</button>
+      <button class="admin-button-com blue middle" @click="confirmSubmit">提交</button>
     </view>
 
 
@@ -151,7 +162,7 @@ import { mapActions, mapGetters } from "vuex";
 import { getUserDet} from "@/api/member";
 import ModalModule from "@/components/plugin/modal";
 export default {
-  name: "BillingAffirm", // 开单确认
+  name: "BillingAffirm",
   components: {
     TuiListCell,
     AppAvatarModule,
@@ -171,7 +182,7 @@ export default {
 			payWayList:[{name:"微信",id:0},{name:"支付宝",id:1},{name:"现金",id:4},{name:"银行卡",id:5}],
 			payWayindex:0,
       form: {
-        debt: 1, //付款方式 1欠款订单 0正常订单
+        debt:0, //1欠款 0已收款
         shopId: "",
         shopName: "",
         receiveProvince: "",
@@ -190,6 +201,7 @@ export default {
         remark:"",
         payWay:0,
         needPrint:1,//订单生成时打印订单1需要2不需要
+        hasPay:0
       },
       money: "",
       showCustomer: false,
@@ -225,7 +237,6 @@ export default {
         that.$forceUpdate()
       })
     }
-
   },
 	onShow(){
 		if(!this.$util.isEmpty(uni.getStorageSync("newClient"))){
@@ -312,34 +323,8 @@ export default {
       this.form.customId = info.id;
       this.form.customName = info.name;
     },
-    confirmFn (options) {
-      let that = this
-      if (options.sendType == 2) {
-        options.sendCost = "";
-      }
-      let Fn = createOrder
-      let params = {...options,modifyPrice: this.finalPrice,newVersion:1};
-      if(this.option.orderId && this.option.orderId > 0){
-        Fn = updateOrder
-        params = {...params,id:this.option.orderId}
-      }
-
-      //小菊
-      let xj = uni.getStorageSync("xj"+this.option.customId)
-      params = {...params,xj:JSON.stringify(xj)}
-
-      Fn(params).then((res) => {
-        if(res.code == 1){
-          //删除记忆花材
-          this.removeMemoryDirect(that.option.customId)
-          const {data: { id, orderSn },} = res;
-          this.$util.pageTo({ url: '/admin/billing/result',type:2,query: {orderId:id,orderSn:orderSn}})
-        }
-      });
-    },
     confirmSubmit () {
       let self = this;
-      
         let rules = [
           {
             name: "customId",
@@ -347,63 +332,60 @@ export default {
             msg: ["请选择客户"],
           },
         ];
-        let checkRes = formUtil.validation(this.form, rules);
-        if (checkRes) {
-          this.$msg(checkRes);
+        let hasError = formUtil.validation(this.form, rules);
+        if (hasError) {
+          this.$msg(hasError);
           return false;
         }
         uni.showModal({
-          title: "提示",
-          content: "打印小票?",
-          cancelText: "不打",
-          confirmText: "打印",
-          confirmColor: '#39B54A',
-          cancelColor: '#777777',
+          title: '提示',
+          content: '确认提交?',
           success: function (res) {
-            if (res.confirm) {
-              self.form.needPrint = 1
-              self.formSubmit();
-            }else{
-              self.form.needPrint = 2
-              self.formSubmit();
-            }
-          },
-        });
-
+              if (res.confirm) {
+                  self.formSubmit();
+              }
+          }
+        })        
     },
-    // 表单验证
     async formSubmit () {
-      try {
-        this.form;
-        let formData = this.form;
-        let price = 0;
-        const product = this.selectList.map((ele) => {
-          price += ele.bigCount * Number(ele.bigPrice);
-          price += ele.smallCount * Number(ele.smallPrice);
-          return {
-            productId: ele.id,
-            bigNum: ele.bigCount,
-            smallNum: ele.smallCount,
-            classId: ele.classId,
-            itemId: ele.itemId,
-            price: ele.userPrice>0?ele.userPrice:price,
-          };
-        });
-        formData.product = JSON.stringify(product);
-        if (!this.getMerchantInfo) {
-          await this.initMerchantInfo();
-        }
-        formData.shopId = this.getMerchantInfo.id;
-        let checkRes = formUtil.validation(formData, []);
-        // 验证通过!
-        if (!checkRes) {
-          this.confirmFn(formData);
-        } else {
-          this.$msg(checkRes);
-        }
-      } catch (error) {
-
+      let formData = this.form;
+      let price = 0;
+      const product = this.selectList.map((ele) => {
+        price += ele.bigCount * Number(ele.bigPrice);
+        price += ele.smallCount * Number(ele.smallPrice);
+        return {
+          productId: ele.id,
+          bigNum: ele.bigCount,
+          smallNum: ele.smallCount,
+          classId: ele.classId,
+          itemId: ele.itemId,
+          price: ele.userPrice>0?ele.userPrice:price,
+        };
+      });
+      formData.product = JSON.stringify(product);
+      if (!this.getMerchantInfo) {
+        await this.initMerchantInfo();
       }
+      formData.shopId = this.getMerchantInfo.id;
+      if (formData.sendType == 2) {
+        formData.sendCost = "";
+      }
+      let Fn = createOrder
+      let params = {...formData,modifyPrice: this.finalPrice,newVersion:1};
+      if(this.option.orderId && this.option.orderId > 0){
+        Fn = updateOrder
+        params = {...params,id:this.option.orderId}
+      }
+      Fn(params).then((res) => {
+        if(res.code == 1){
+          const {data: { id, orderSn,actPrice }} = res;
+          if(this.form.hasPay == 0){
+            this.$util.pageTo({ url: '/admin/billing/toPay',type:2,query: {orderId:id,orderSn:orderSn,actPrice:actPrice}})
+          }else{
+            this.$util.pageTo({ url: '/admin/billing/result',type:2,query: {orderId:id,orderSn:orderSn}})
+          }
+        }
+      })
     },
     gobackEvent () {
       uni.navigateBack({

+ 2 - 0
ghsApp/src/admin/home/mall.vue

@@ -7,9 +7,11 @@
       <div class="confirm-btn">
         <button class="admin-button-com big blue" @click="downloadImg">保存图片</button>
       </div>
+      <!-- #ifdef MP-WEIXIN -->
       <div class="confirm-btn1">
         <button class="admin-button-com big blue" @click="goToMallPt('pages/home/index')">打开商城</button>
       </div>
+       <!-- #endif -->
   </view>
 </template>
 

+ 3 - 0
ghsApp/src/api/order/index.js

@@ -185,3 +185,6 @@ export const confirmFinish = data => https.get("/order/confirm-finish", data);
 
 //取消订单 shish 20210810
 export const cancel = data => https.get("/order/cancel", data);
+
+//微信和支付宝付款码支付
+export const codePay = data => https.get("/order/code-pay", data);

+ 9 - 3
ghsApp/src/mixins/globalMixins.js

@@ -187,13 +187,19 @@ export default {
 			this.globalPDAKd(productIdCode)
 		},
     globalPDAKd(productIdCode){
+      var pages = getCurrentPages()
+			let currentRoute  = pages[pages.length-1].route;
+
+      //付款码支付
+      if(currentRoute == 'admin/billing/toPay'){
+        this.requestCodePay(productIdCode)
+        return
+      }
+
 			let that = this
       that.kdType = 'SCAN'
       let pageType = "bill"
 
-      var pages = getCurrentPages()
-			let currentRoute  = pages[pages.length-1].route;
-
       let currentCustomId = that.skCustomId || 0
       if(!this.$util.isEmpty(this.option.customId) && currentRoute == 'admin/billing/affirm'){
         currentCustomId = this.option.customId

+ 2 - 1
ghsApp/src/pages.json

@@ -210,7 +210,8 @@
 				{ "path": "result", "style": { "navigationBarTitleText": "开单结果" } },
 				{ "path": "affirm", "style": { "navigationBarTitleText": "确认下单" } },
 				{ "path": "customerAffirm", "style": { "navigationBarTitleText": "确认下单" } },
-				{ "path": "confirm", "style": { "navigationBarTitleText": "待确认" } }
+				{ "path": "confirm", "style": { "navigationBarTitleText": "待确认" } },
+				{"path": "toPay","style": {"navigationBarTitleText": "等待付款"}}
 			]
 		},
 		{

+ 5 - 2
ghsApp/src/pagesInvite/inviteGhsShop.vue

@@ -7,10 +7,13 @@
     <div class="confirm-btn">
       <button class="admin-button-com big blue" @click="downloadImg">保存图片</button>
     </div>
-    <div class="confirm-btn1"><button class="admin-button-com big default" @click="goToMallPt()">直接打开</button></div>
+    <!-- #ifdef MP-WEIXIN -->
+    <div class="confirm-btn1">
+      <button class="admin-button-com big default" @click="goToMallPt()">直接打开</button>
+    </div>
+    <!-- #endif -->
   </view>
 </template>
-
 <script>
 import { applyInviteGhsPoster } from '@/api/apply/index'
 import { getWeixinId } from "@/api/invite/index";