吕海超 9 месяцев назад
Родитель
Сommit
031cc5ed0e
2 измененных файлов с 18 добавлено и 15 удалено
  1. 4 4
      src/views/order/cloth/collectCloth.vue
  2. 14 11
      src/views/order/cloth/component/cashCloth.vue

+ 4 - 4
src/views/order/cloth/collectCloth.vue

@@ -141,14 +141,14 @@
                         </el-select>
                     </el-form-item>
 
-                    <!-- <el-form-item label="是否关联预约" prop="isAppointment">
+                     <el-form-item label="是否关联预约" prop="isAppointment">
                         <el-radio-group v-model="orderForm.isAppointment">
                             <el-radio-button v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio-button>
                         </el-radio-group>
-                    </el-form-item> -->                    
-                    <!-- <el-form-item label="预约单号" prop="orderNo" v-if="orderForm.isAppointment == 'Y'">
+                    </el-form-item>                  
+                     <el-form-item label="预约单号" prop="orderNo" v-if="orderForm.isAppointment == 'Y'">
                         <el-input v-model="orderForm.orderNo" placeholder="请输入预约单号" clearable required />
-                    </el-form-item> -->
+                    </el-form-item> 
                     <br />
 
                     <el-form-item label="会员余额:" prop="userAmount">

+ 14 - 11
src/views/order/cloth/component/cashCloth.vue

@@ -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'">优惠{{ getDiscountStr(scope.row.discountRate) }},最多折扣{{ scope.row.deductAmount }}元</span>
                                         </template>
                                     </el-table-column>
                                     <el-table-column label="是否单件" align="center" prop="isUnique">
@@ -135,9 +135,9 @@
                             <el-table-column label="活动名称" align="center" prop="title"> </el-table-column>
                             <el-table-column label="适用衣服" align="center">
                                 <template slot-scope="scope">
-                                    <span v-if="scope.row.clothScope == 0">全部衣服 折扣{{ scope.row.discount * 100 }}%</span>
+                                    <span v-if="scope.row.clothScope == 0">全部衣服 折扣{{ getDiscountStr(scope.row.discount * 100) }}</span>
                                     <div v-if="scope.row.clothScope == 1">
-                                        <div v-for="(item, i) in scope.row.activityClothItemVOList" :key="i">#{{ i + 1 }} {{ item.clothItemName }} 折扣{{ item.discount * 100 }}%</div>
+                                        <div v-for="(item, i) in scope.row.activityClothItemVOList" :key="i">#{{ i + 1 }} {{ item.clothItemName }} 折扣{{ getDiscountStr(item.discount * 100) }}</div>
                                     </div>
                                 </template>
                             </el-table-column>
@@ -274,7 +274,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'">优惠{{ getDiscountStr(scope.row.discountRate) }},最多折扣{{ scope.row.deductAmount }}元</span>
                     </template>
                 </el-table-column>
                 <el-table-column label="是否单件" align="center" prop="isUnique">
@@ -483,6 +483,9 @@ export default {
         }
     },
     methods: {
+        getDiscountStr(e) {
+            return Math.round(e / 10 * 100) / 100 + '折'
+        },
         changePayType() {
             if (this.orderForm.payType == 0) {
                 this.orderForm.authCode = ''
@@ -565,7 +568,7 @@ export default {
             let activityAmount = 0
             if (e.clothScope == 0) {
                 let total = this.calculateTotalPrice() + this.calculateDeliveryPrice() - this.calculateTotalDiscountAmountByCoupon()
-                activityAmount = total * e.discount
+                activityAmount = total * (1 - e.discount)
             }
             console.log('平台活动', this.orderClothItemDTOS, e.activityClothItemVOList)
 
@@ -576,7 +579,7 @@ export default {
                        let goods = this.orderClothItemDTOS[j]
                        console.log(goods.id, Number(cloth.clothId))
                        if (goods.id === cloth.clothId) {
-                        activityAmount += goods.totalPrice * cloth.discount
+                        activityAmount += goods.totalPrice * (1 - cloth.discount)
                        }
                     }
                 }
@@ -633,7 +636,7 @@ export default {
             // this.changeDiscountCouponIndex = index
             this.changeDiscountCouponCanSelectCloths = this.selectCoupons[index].applyCloths.concat()
             this.changeDiscountCouponCanSelectCloths.forEach((item) => {
-                let deductAmount1 = this.handelPrice(item.totalPrice * (this.selectCoupons[index].discountRate / 100))
+                let deductAmount1 = this.handelPrice(item.totalPrice * (1 - 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
@@ -722,11 +725,11 @@ export default {
                 let activityAmount = 0
                 if (e.clothScope == 0) {
                     let total = this.calculateTotalPrice() + this.calculateDeliveryPrice() - this.calculateTotalDiscountAmountByCoupon()
-                    activityAmount = total * e.discount
+                    activityAmount = total * (1 - e.discount)
                 }
                 if (e.clothScope == 1) {
                     let total = this.calculateTotalPrice() + this.calculateDeliveryPrice() - this.calculateTotalDiscountAmountByCoupon()
-                    activityAmount = total * e.discount
+                    activityAmount = total * (1 - e.discount)
                 }
                 e.activityAmount = Math.round(activityAmount * 100) / 100
             }
@@ -772,7 +775,7 @@ export default {
                     // 单件
                     let cloth = coupon.applyCloths[coupon.applyCloths.length - 1]
                     // 获取可用衣物里的最小价格
-                    let deductAmount1 = cloth.totalPrice * (coupon.discountRate / 100)
+                    let deductAmount1 = cloth.totalPrice * (1 - 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
@@ -781,7 +784,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 * (coupon.discountRate / 100))
+                        let deductAmount1 = this.handelPrice(cloth.totalPrice * (1 - 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