Ver código fonte

收衣平台活动

吕海超 6 meses atrás
pai
commit
bf187b1c9c

+ 2 - 1
src/api/recharge/order.js

@@ -85,8 +85,9 @@ export function getRechargeRecordByUserId(id) {
 }
 export function getOrderStatusByOrderNo(data) {
   return request({
-    url: '/mapi/recharge/order/getOrderStatusByOrderNo',
+    // url: '/mapi/recharge/order/getOrderStatusByOrderNo',
     // url: '/mapi/order/cloth/getOrderPayResult',
+    url: '/mapi/recharge/order/getOrderPayResult',
     method: 'get',
     params: data
   })

+ 15 - 5
src/components/payStatusPopup/index.vue

@@ -155,6 +155,7 @@ export default {
     methods: {
         open(type, info) {
             this.orderInfo = info
+            this.type = type
             if (type == 1) {
                 if (info.id) {
                     this.getClothItemInfo(info)
@@ -177,13 +178,12 @@ export default {
                 this.showPaySuccessBtn = false
                 this.pay()
             }
-            if (type == 4)  {
+            if (type == 4) {
                 this.errorMessage = info.payMsg
             }
             if (type == 5) {
                 // this.getPayResult()
             }
-            this.type = type
             this.show = true
         },
 
@@ -280,15 +280,25 @@ export default {
         },
 
         pay() {
-            this.type = 3
+            console.log('A1')
+            console.log('A1-1')
             if (this.payType == 0 && !this.authCode) {
-                this.$message.error('请先扫码')
+                this.type = 4
+                this.errorMessage = '请先扫码'
+                this.authCode = ''
+                this.changePayType()
                 return
             }
+            console.log('A2')
+
             if (this.payType == 3 && appUserInfo.rechargeBalance + appUserInfo.giveBalance < this.orderInfo.payAmount) {
-                this.$message.error('余额不足')
+                this.errorMessage = '余额不足'
+                this.type = 4
+                this.authCode = ''
+                this.changePayType()
                 return
             }
+            this.type = 3
             clothOrderPay({
                 appUserId: this.orderInfo.appUserId,
                 payType: this.payType,

+ 6 - 2
src/views/order/cloth/collectCloth.vue

@@ -486,7 +486,8 @@ export default {
             orderForm: {
                 isSpecial: 'N',
                 isAppointment: 'N',
-                authCode: ''
+                authCode: '',
+                payType: '3'
             },
 
             // 总条数
@@ -691,7 +692,7 @@ export default {
             })
         },
         initOrderList(e) {
-            console.log('sssss',e);
+            console.log('sssss', e)
             this.orderClothItemDTOS = e.concat()
         },
 
@@ -1265,6 +1266,9 @@ export default {
                 clothIds.push(item.id)
             })
             params.clothIds = clothIds
+            this.orderForm.isSpecial = 'N'
+            this.orderForm.authCode = ''
+            this.orderForm.payType = '3'
             getDiscountByStoreId({ appUserId: this.appUserInfo.id }).then((res) => {
                 this.discountCouponVOS = res.data
                 params.discountWay = '0'

+ 143 - 140
src/views/order/cloth/component/cashCloth.vue

@@ -13,7 +13,7 @@
                     <el-descriptions-item label="配送费(元)">
                         {{ calculateDeliveryPrice() }}
                     </el-descriptions-item>
-                    <el-descriptions-item label="还需支付(元)">{{ (parseInt(calculateTotalPrice() * 100) + parseInt(calculateDeliveryPrice() * 100) - parseInt(calculateTotalDiscountAmount() * 100)) / 100 }}</el-descriptions-item>
+                    <el-descriptions-item label="还需支付(元)">{{ Math.round((calculateTotalPrice() + calculateDeliveryPrice() - calculateTotalDiscountAmount()) * 100) / 100 }}</el-descriptions-item>
                     <el-descriptions-item label="赠送余额">{{ appUserInfo ? appUserInfo.giveBalance : '0' }}</el-descriptions-item>
                 </el-descriptions>
             </el-card>
@@ -47,7 +47,7 @@
                                         <template slot-scope="scope">
                                             <span v-if="scope.row.discountWay == '0'">抵扣{{ scope.row.deductAmount }}元</span>
                                             <span v-if="scope.row.discountWay == '1'">满{{ parseInt(scope.row.minAmount) }}件减{{ scope.row.deductAmount }}件</span>
-                                            <span v-if="scope.row.discountWay == '2'">{{ scope.row.discountRate }}折,最多折扣{{ scope.row.deductAmount }}元</span>
+                                            <span v-if="scope.row.discountWay == '2'">优惠{{ scope.row.discountRate }}%,最多折扣{{ scope.row.deductAmount }}元</span>
                                         </template>
                                     </el-table-column>
                                     <el-table-column label="是否单件" align="center" prop="isUnique">
@@ -122,54 +122,65 @@
                             </el-tab-pane>
                         </el-tabs>
                     </el-tab-pane>
-                    <el-tab-pane label="折扣" name="1">
-                        <el-form-item label="折扣" prop="discountCouponId">
+                    <el-tab-pane label="平台折扣活动" name="1">
+                        <!-- <el-form-item label="折扣" prop="discountCouponId">
                             <el-select v-model="orderForm.discountCouponId" placeholder="请选择" clearable @change="onDiscountCouponSelect">
                                 <template v-for="(item, i) in discountCouponVOS">
                                     <el-option :key="i" :label="item.couponTypeTitle + '(' + item.deductAmount * 10 + '折)'" :value="item.id"> </el-option>
                                 </template>
                             </el-select>
-                        </el-form-item>
-                        <el-table :data="getDiscountClothList()">
+                        </el-form-item> -->
+                        <el-table :data="discountCouponVOS" style="width: 100%">
                             <el-table-column label="序号" type="index" align="center" fixed="left" width="80"> </el-table-column>
-                            <el-table-column label="衣物名称" align="center" prop="name" width="250">
+                            <el-table-column label="活动名称" align="center" prop="title"> </el-table-column>
+                            <el-table-column label="适用衣服" align="center">
                                 <template slot-scope="scope">
-                                    <span>{{ calculateClothName(scope.$index) }}</span>
+                                    <span v-if="scope.row.clothScope == 0">全部衣服 折扣{{ scope.row.discount * 100 }}%</span>
+                                    <span v-if="scope.row.clothScope == 1">指定衣服</span>
                                 </template>
                             </el-table-column>
-                            <el-table-column label="颜色" align="center" width="120">
+                            <el-table-column label="适用支付方式" align="center">
                                 <template slot-scope="scope">
-                                    <span>
-                                        <template v-for="(color, index) in scope.row.orderClothColorDTOS">
-                                            {{ index == 0 ? color.clothColorName : ',' + color.clothColorName }}
-                                        </template>
-                                    </span>
+                                    <span v-if="scope.row.payScope == 0">全部</span>
+                                    <span v-if="scope.row.payScope == 1">现金</span>
+                                    <span v-if="scope.row.payScope == 2">余额</span>
                                 </template>
                             </el-table-column>
-                            <el-table-column label="衣服品牌" align="center" prop="name" width="120">
+                            <el-table-column label="可优惠金额(元)" align="center">
                                 <template slot-scope="scope">
-                                    <span>{{ scope.row.clothBrandName }}</span>
+                                    <span>{{ calculateTotalDiscountByActivity(scope.row) }}</span>
                                 </template>
                             </el-table-column>
-                            <el-table-column label="瑕疵" align="center">
+                            <!-- <el-table-column label="衣服品牌" align="center" prop="name" width="120"> -->
+                            <!-- <template slot-scope="scope"> -->
+                            <!-- <span>{{ scope.row.clothBrandName }}</span> -->
+                            <!-- </template> -->
+                            <!-- </el-table-column> -->
+                            <!-- <el-table-column label="瑕疵" align="center"> -->
+                            <!-- <template slot-scope="scope"> -->
+                            <!-- <span> -->
+                            <!-- <template v-for="(color, index) in scope.row.orderClothFlawDTOS"> -->
+                            <!-- {{ index == 0 ? color.clothFlawName : ',' + color.clothFlawName }} -->
+                            <!-- </template> -->
+                            <!-- </span> -->
+                            <!-- </template> -->
+                            <!-- </el-table-column> -->
+                            <!-- <el-table-column label="洗涤方式" align="center" width="80"> -->
+                            <!-- <template slot-scope="scope"> -->
+                            <!-- <span>{{ scope.row.clothWashModeName }}</span> -->
+                            <!-- </template> -->
+                            <!-- </el-table-column> -->
+                            <!-- <el-table-column label="原价(元)" align="center" prop="totalPrice" width="100" /> -->
+                            <!-- <el-table-column label="抵扣金额(元)" align="center" prop="deductAmount" width="130" /> -->
+                            <!-- <el-table-column label="折扣金额(元)" align="center" width="130">
                                 <template slot-scope="scope">
-                                    <span>
-                                        <template v-for="(color, index) in scope.row.orderClothFlawDTOS">
-                                            {{ index == 0 ? color.clothFlawName : ',' + color.clothFlawName }}
-                                        </template>
-                                    </span>
+                                    <span>{{ parseInt((scope.row.totalPrice - scope.row.deductAmount) * 100 * parseInt(100 - orderForm.discountCoupon.deductAmount * 100)) / 10000 }}</span>
                                 </template>
-                            </el-table-column>
-                            <el-table-column label="洗涤方式" align="center" width="80">
+                            </el-table-column> -->
+                            <el-table-column label="操作" align="center">
                                 <template slot-scope="scope">
-                                    <span>{{ scope.row.clothWashModeName }}</span>
-                                </template>
-                            </el-table-column>
-                            <el-table-column label="原价(元)" align="center" prop="totalPrice" width="100" />
-                            <el-table-column label="抵扣金额(元)" align="center" prop="deductAmount" width="130" />
-                            <el-table-column label="折扣金额(元)" align="center" width="130">
-                                <template slot-scope="scope">
-                                    <span>{{ parseInt((scope.row.totalPrice - scope.row.deductAmount) * 100 * parseInt(100 - orderForm.discountCoupon.deductAmount * 100)) / 10000 }}</span>
+                                    <el-button type="text" style="color: #67c23a" @click="onSelectActivityItem({})" v-if="activity.id === scope.row.id">不使用</el-button>
+                                    <el-button type="text" @click="onSelectActivityItem(scope.row)" v-else>使用</el-button>
                                 </template>
                             </el-table-column>
                         </el-table>
@@ -195,13 +206,31 @@
 
             <el-card style="margin-top: 10px">
                 <div slot="header" class="clearfix">
-                    <span
-                        >收款方式 还需支付<span style="color: #ff4949">{{ (parseInt(calculateTotalPrice() * 100) + parseInt(calculateDeliveryPrice() * 100) - parseInt(calculateTotalDiscountAmount() * 100)) / 100 }}</span
-                        >元</span
-                    >
+                    <span>收款方式</span>
+                    <template v-if="calculateTotalDiscountAmountByCoupon()">
+                        <span style="margin-left: 10px">优惠券优惠</span>
+                        <span style="color: #ff4949">{{ calculateTotalDiscountAmountByCoupon() }}</span>
+                        <span>元</span>
+                    </template>
+
+                    <template v-if="calculateTotalDiscountByActivity(activity)">
+                        <span style="margin-left: 10px">平台折扣活动优惠</span>
+                        <span style="color: #ff4949">{{ calculateTotalDiscountByActivity(activity) }}</span>
+                        <span>元</span>
+                    </template>
+
+                    <template v-if="orderForm.cashDeductAmount">
+                        <span style="margin-left: 10px">现金券优惠</span>
+                        <span style="color: #ff4949">{{ orderForm.cashDeductAmount }}</span>
+                        <span>元</span>
+                    </template>
+
+                    <span style="margin-left: 10px">还需支付</span>
+                    <span style="color: #ff4949">{{ (parseInt(calculateTotalPrice() * 100) + parseInt(calculateDeliveryPrice() * 100) - parseInt(calculateTotalDiscountAmount() * 100)) / 100 }}</span>
+                    <span>元</span>
                 </div>
                 <el-form-item label="支付方式" prop="payType">
-                    <el-radio-group v-model="orderForm.payType">
+                    <el-radio-group v-model="orderForm.payType" @change="changePayType">
                         <el-radio-button label="3" name="3">余额</el-radio-button>
                         <el-radio-button label="2" name="2">现金</el-radio-button>
                         <el-radio-button label="0" name="0">微信/支付宝</el-radio-button>
@@ -211,7 +240,7 @@
                 <br />
 
                 <el-form-item label="付款码" prop="authCode" v-if="orderForm.payType == '0' || orderForm.payType == '1'">
-                    <el-input v-model="orderForm.authCode" clearable placeholder="请选择付款码" />
+                    <el-input ref="autoFocus" v-model="orderForm.authCode" clearable placeholder="请选择付款码" />
                 </el-form-item>
 
                 <el-descriptions border :column="3" :labelStyle="{ width: '140px' }" v-if="orderForm.payType == '3'">
@@ -243,7 +272,7 @@
                     <template slot-scope="scope">
                         <span v-if="scope.row.discountWay == '0'">抵扣{{ scope.row.deductAmount }}元</span>
                         <span v-if="scope.row.discountWay == '1'">满{{ parseInt(scope.row.minAmount) }}件减{{ scope.row.deductAmount }}件</span>
-                        <span v-if="scope.row.discountWay == '2'">{{ scope.row.discountRate }}折,最多折扣{{ scope.row.deductAmount }}元</span>
+                        <span v-if="scope.row.discountWay == '2'">优惠{{ scope.row.discountRate }}%,最多折扣{{ scope.row.deductAmount }}元</span>
                     </template>
                 </el-table-column>
                 <el-table-column label="是否单件" align="center" prop="isUnique">
@@ -442,15 +471,25 @@ export default {
             changeDiscountCouponOpen: false,
             changeDiscountCouponTitle: '',
             changeDiscountCouponSelectCloths: [],
-            changeDiscountCouponCanSelectCloths: []
+            changeDiscountCouponCanSelectCloths: [],
+            activity: {}
         }
     },
     mounted() {
         if (process.env.ENV != 'production') {
             window.cashClothDialog = this
         }
+        console.log('a12')
     },
     methods: {
+        changePayType() {
+            if (this.orderForm.payType == 0) {
+                this.orderForm.authCode = ''
+                this.$nextTick((_) => {
+                    this.$refs.autoFocus.focus()
+                })
+            }
+        },
         // 处理现金金额
         handelPrice(e) {
             return Math.round(e * 100) / 100
@@ -497,41 +536,54 @@ export default {
         //计算当前所有优惠金额
         calculateTotalDiscountAmount() {
             var totalDiscountAmount = this.orderForm.cashDeductAmount ? this.orderForm.cashDeductAmount : 0
+            this.orderClothItemDTOS.forEach((cloth) => {
+                totalDiscountAmount = totalDiscountAmount + cloth.deductAmount
+            })
+            if (this.activity.id) {
+                totalDiscountAmount = totalDiscountAmount + this.calculateTotalDiscountByActivity(this.activity)
+            }
+            return Math.round(totalDiscountAmount * 100) / 100
+        },
+        // 计算优惠券优惠金额
+        calculateTotalDiscountAmountByCoupon() {
+            var totalDiscountAmount = 0
             this.orderClothItemDTOS.forEach((cloth) => {
                 totalDiscountAmount = Math.round((totalDiscountAmount + cloth.deductAmount) * 100) / 100
             })
-            // //折扣优惠券
-            // if (this.orderForm.discountCoupon) {
-            //     var discountCoupon = this.orderForm.discountCoupon
-            //     this.orderClothItemDTOS.forEach((cloth) => {
-            //         console.log('A2', discountCoupon)
-            //         if (discountCoupon.appCouponTypeApplyClothVOS) {
-            //             if (discountCoupon.appCouponTypeApplyClothVOS.find((item) => item.clothItemId == cloth.id)) {
-            //                 totalDiscountAmount = (parseInt(totalDiscountAmount * 100) + ((parseInt(cloth.totalPrice * 100) - parseInt(cloth.deductAmount * 100)) * (100 - parseInt(discountCoupon.deductAmount * 100))) / 100) / 100
-            //             }
-            //         }
-            //     })
-            // }
             return totalDiscountAmount
         },
+
+        // 计算平台活动优惠金额
+        calculateTotalDiscountByActivity(e) {
+            if (e.payScope == 2 && this.orderForm.payType && this.orderForm.payType != 3) {
+                return 0
+            }
+            if (e.payScope == 1 && this.orderForm.payType && this.orderForm.payType == 3) {
+                return 0
+            }
+            let activityAmount = 0
+            if (e.clothScope == 0) {
+                let total = this.calculateTotalPrice() + this.calculateDeliveryPrice() - this.calculateTotalDiscountAmountByCoupon()
+                activityAmount = total * e.discount
+            }
+            if (e.clothScope == 1) {
+                let total = this.calculateTotalPrice() + this.calculateDeliveryPrice() - this.calculateTotalDiscountAmountByCoupon()
+                activityAmount = total * e.discount
+            }
+            return Math.round(activityAmount * 100) / 100
+        },
+
         //计算出去现金券其余的优惠金额
         calculateTotalDiscountAmountWithoutCashAmount() {
             var totalDiscountAmount = 0
             this.orderClothItemDTOS.forEach((cloth) => {
-                totalDiscountAmount = (parseInt(totalDiscountAmount * 100) + parseInt(cloth.deductAmount * 100)) / 100
+                totalDiscountAmount = totalDiscountAmount + cloth.deductAmount
             })
-            //折扣优惠券
-            if (this.orderForm.discountCoupon) {
-                var discountCoupon = this.orderForm.discountCoupon
-                this.orderClothItemDTOS.forEach((cloth) => {
-                    if (discountCoupon.appCouponTypeApplyClothVOS) {
-                        if (discountCoupon.appCouponTypeApplyClothVOS.find((item) => item.clothItemId == cloth.id)) {
-                            totalDiscountAmount = (parseInt(totalDiscountAmount * 100) + ((parseInt(cloth.totalPrice * 100) - parseInt(cloth.deductAmount * 100)) * (100 - parseInt(discountCoupon.deductAmount * 100))) / 100) / 100
-                        }
-                    }
-                })
+            if (this.activity.id) {
+                totalDiscountAmount = totalDiscountAmount + this.calculateTotalDiscountByActivity(this.activity)
             }
-            return totalDiscountAmount
+
+            return Math.round(totalDiscountAmount * 100) / 100
         },
         /**
          * 计算当前优惠券抵扣明细
@@ -567,7 +619,7 @@ export default {
             // this.changeDiscountCouponIndex = index
             this.changeDiscountCouponCanSelectCloths = this.selectCoupons[index].applyCloths.concat()
             this.changeDiscountCouponCanSelectCloths.forEach((item) => {
-                let deductAmount1 = this.handelPrice(item.totalPrice * ((100 - this.selectCoupons[index].discountRate) / 100))
+                let deductAmount1 = this.handelPrice(item.totalPrice * ( this.selectCoupons[index].discountRate / 100))
                 let deductAmount = deductAmount1 > this.selectCoupons[index].deductAmount ? this.selectCoupons[index].deductAmount : deductAmount1
                 item.deductAmount = deductAmount
                 item.isSelected = item.id == this.selectCoupons[index].orderCouponClothDTOS[0].id
@@ -650,6 +702,23 @@ export default {
             })
             return clothName
         },
+
+        onSelectActivityItem(e) {
+            if (e.id) {
+                let activityAmount = 0
+                if (e.clothScope == 0) {
+                    let total = this.calculateTotalPrice() + this.calculateDeliveryPrice() - this.calculateTotalDiscountAmountByCoupon()
+                    activityAmount = total * e.discount
+                }
+                if (e.clothScope == 1) {
+                    let total = this.calculateTotalPrice() + this.calculateDeliveryPrice() - this.calculateTotalDiscountAmountByCoupon()
+                    activityAmount = total * e.discount
+                }
+                e.activityAmount = Math.round(activityAmount * 100) / 100
+            }
+            this.activity = e
+        },
+
         onSelectCouponItem(index) {
             var coupon = this.deductCouponVOS[index]
             // 折扣券
@@ -688,7 +757,7 @@ export default {
                     // 单件
                     let cloth = coupon.applyCloths[coupon.applyCloths.length - 1]
                     // 获取可用衣物里的最小价格
-                    let deductAmount1 = cloth.totalPrice * ((100 - coupon.discountRate) / 100)
+                    let deductAmount1 = cloth.totalPrice * (coupon.discountRate / 100)
                     let deductAmount = deductAmount1 > coupon.deductAmount ? coupon.deductAmount : deductAmount1
                     coupon.orderCouponClothDTOS.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: deductAmount, clothName: this.calculateClothNameByInfo(cloth) })
                     cloth.deductAmount = deductAmount
@@ -697,7 +766,7 @@ export default {
                     let list = coupon.applyCloths
                     for (let i = 0; i < list.length; i++) {
                         let cloth = list[i]
-                        let deductAmount1 = this.handelPrice(cloth.totalPrice * ((100 - coupon.discountRate) / 100))
+                        let deductAmount1 = this.handelPrice(cloth.totalPrice * (coupon.discountRate / 100))
                         let deductAmount = deductAmount1 > coupon.deductAmount ? coupon.deductAmount : deductAmount1
                         coupon.orderCouponClothDTOS.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: deductAmount, clothName: this.calculateClothNameByInfo(cloth) })
                         cloth.deductAmount = deductAmount
@@ -751,7 +820,7 @@ export default {
                     this.$message.error('未满足满减条件')
                     return
                 }
-               
+
                 if (coupon.isUnique !== 'Y') {
                     //单件,只减一件
                     var cloth = coupon.applyCloths[coupon.applyCloths.length - 1]
@@ -816,89 +885,23 @@ export default {
                     if (payTimeType == 1) {
                         params.payType = 0
                     }
+                    if (this.calculateTotalDiscountByActivity(this.activity)) {
+                        params.activityId = this.activity.id
+                        params.activityDiscountAmount = this.calculateTotalDiscountByActivity(this.activity)
+                    }
+
                     console.log(params)
-                    return
                     const loading = this.$loading({
                         lock: true,
                         text: 'Loading',
                         spinner: 'el-icon-loading',
                         background: 'rgba(0, 0, 0, 0.7)'
                     })
-                    //   let res = {
-                    //     "code": 200,
-                    //     "msg": "操作成功",
-                    //     "data": {
-                    //       "createById": "105",
-                    //       "createBy": "storeAdmin",
-                    //       "createTime": "2024-08-27 00:18:57",
-                    //       "updateById": null,
-                    //       "updateBy": "--",
-                    //       "updateTime": null,
-                    //       "remark": null,
-                    //       "id": "183",
-                    //       "orderNo": "CL1025602421440778240",
-                    //       "orderType": "0",
-                    //       "orgId": "4",
-                    //       "sourceType": "02",
-                    //       "factoryId": "1",
-                    //       "appUserId": "82033",
-                    //       "contactName": "海峰",
-                    //       "contactPhone": "15221931688",
-                    //       "orderAmount": 4,
-                    //       "payInfo": null,
-                    //       "orderClothPrice": 4,
-                    //       "orderClothCount": 1,
-                    //       "payAmount": 4,
-                    //       "payTimeType": "1",
-                    //       "payType": "2",
-                    //       "payStatus": "0",
-                    //       "payTime": null,
-                    //       "outTradeOrderNo": null,
-                    //       "orderSource": "OFFLINE",
-                    //       "refundAmount": null,
-                    //       "refundContent": null,
-                    //       "appointmentTime": null,
-                    //       "appointmentCount": null,
-                    //       "appointmentStatus": null,
-                    //       "orderStatus": "4",
-                    //       "takeClothTime": null,
-                    //       "takeClothAppUserId": null,
-                    //       "setPriceTime": "2024-08-27 00:18:57",
-                    //       "pickUpTime": null,
-                    //       "washClothStartTime": null,
-                    //       "washClothEndTime": null,
-                    //       "sendToStoreTime": null,
-                    //       "planSendToUserTime": "2024-09-01 00:18:57",
-                    //       "sendToUserTime": null,
-                    //       "refundTime": null,
-                    //       "refundStatus": null,
-                    //       "refundReason": null,
-                    //       "sendClothAppUserId": null,
-                    //       "takeClothWay": "0",
-                    //       "sendClothWay": null,
-                    //       "couponAmount": null,
-                    //       "couponDeductAmount": null,
-                    //       "cashDeductAmount": 0,
-                    //       "finishTime": null,
-                    //       "employeeId": null,
-                    //       "delFlag": null,
-                    //       "isDisassemblyAndAssembly": null,
-                    //       "isLargeItem": null,
-                    //       "clothSpeedId": "1",
-                    //       "clothSpeedName": "普洗",
-                    //       "isSpecial": "Y"
-                    //     },
-                    //     "total": 0,
-                    //     "rows": null
-                    //   }
-                    //   loading.close()
-                    //   this.$emit('onPaySuccess', res.data)
-                    //   return
                     collectCloth(params)
                         .then((res) => {
                             this.$message('提交成功')
                             loading.close()
-                            this.$emit('onPaySuccess', res.data)
+                            this.$emit('onPaySuccess', { ...res.data, authCode: this.orderForm.authCode })
                         })
                         .catch((e) => {
                             loading.close()

+ 40 - 33
src/views/workbench/workRecharge/index.vue

@@ -548,7 +548,7 @@ export default {
     methods: {
         changeCashPayAmount(value) {
             this.payFrom.cashPayAmount = value.replace(/[^\d]/g, '')
-            this.payFrom.otherPayAmount = Number(this.orderNeedPayAmount) - Number(this.payFrom.cashPayAmount)
+            this.payFrom.otherPayAmount = Math.round((Number(this.orderNeedPayAmount) - Number(this.payFrom.cashPayAmount)) * 100) / 100
         },
         clickRecharge(done) {
             this.$confirm('是否关闭表单,关闭后数据将丢失?')
@@ -802,6 +802,7 @@ export default {
                 }
                 orderRechargePayDTO.cashPayAmount = this.payFrom.cashPayAmount || 0
                 orderRechargePayDTO.otherPayAmount = this.payFrom.otherPayAmount || 0
+                orderRechargePayDTO.authCode = this.payFrom.wxBarcode
             }
 
             this.$confirm('确定进行支付结算吗?')
@@ -825,10 +826,14 @@ export default {
                                 }, 4000)
                             }
                             if (response.data.payResult == 200) {
+                                // this.$refs.payStatusPopup.open(5, response.data)
+                                // var intervalId = setInterval(() => {
+                                //     this.intervalCheckOrderStatus(intervalId, this.orderNo)
+                                // }, 4000)
                                 this.$refs.payStatusPopup.open(1, response.data)
                                 this.checkIsAllPay(this.orderNo)
                             }
-                            if (response.data.payResult == 101 || res.data.payResult == 0) {
+                            if (response.data.payResult == 101 || response.data.payResult == 0) {
                                 this.$refs.payStatusPopup.open(4, response.data)
                             }
                             //         // 第三方支付
@@ -893,41 +898,43 @@ export default {
                 .catch(() => {})
         },
         intervalCheckOrderStatus(intervalId, orderNo) {
-            getOrderStatusByOrderNo({ orderNo: orderNo }).then((response) => {
-                if (response.data == '0') {
-                    return
-                }
-                // this.isPaying = false
-                if (response.data == '100') {
-                    //已取消
-                    // this.$notify.error({
-                    //     title: '支付失败',
-                    //     message: '支付超时或客户已取消支付'
-                    // })
-                    this.$refs.payStatusPopup.open(4, response.data)
-                    clearInterval(intervalId)
-                    return
-                }
-                // if (response.data.payResult == 200) {
+            getOrderStatusByOrderNo({ orderNo: orderNo })
+                .then((response) => {
+                    if (response.data.payResult == '100') {
+                        return
+                    }
+                    // this.isPaying = false
+                    if (response.data.payResult == 101 || response.data.payResult == 0) {
+                        //已取消
+                        // this.$notify.error({
+                        //     title: '支付失败',
+                        //     message: '支付超时或客户已取消支付'
+                        // })
+                        this.$refs.payStatusPopup.open(4, response.data)
+                        clearInterval(intervalId)
+                        return
+                    }
+                    // if (response.data.payResult == 200) {
                     this.$refs.payStatusPopup.open(1, response.data)
                     this.checkIsAllPay(this.orderNo)
                     // clearInterval(intervalId)
                     // return
-                // }
-                // if (response.data.payResult == 101 || res.data.payResult == 0) {
-                //     this.$refs.payStatusPopup.open(4, response.data)
-                // }
-                // this.$notify({
-                //     title: '支付成功',
-                //     message: '客户已成功支付订单',
-                //     type: 'success'
-                // })
-                // this.openRecharge = false
-                // this.searchUser()
-                clearInterval(intervalId)
-            }).catch(e => {
-                this.$refs.payStatusPopup.open(4, e.data)
-            })
+                    // }
+                    // if (response.data.payResult == 101 || res.data.payResult == 0) {
+                    //     this.$refs.payStatusPopup.open(4, response.data)
+                    // }
+                    // this.$notify({
+                    //     title: '支付成功',
+                    //     message: '客户已成功支付订单',
+                    //     type: 'success'
+                    // })
+                    // this.openRecharge = false
+                    // this.searchUser()
+                    clearInterval(intervalId)
+                })
+                .catch((e) => {
+                    this.$refs.payStatusPopup.open(4, e.data)
+                })
         },
         checkIsAllPay(orderNo) {
             // getOrderIsAllPayByOrderNo({ orderNo: orderNo }).then((response) => {