|
@@ -1,875 +1,835 @@
|
|
<template>
|
|
<template>
|
|
- <div v-loading="dialogLoading" :element-loading-text="loadingText">
|
|
|
|
- <el-form :model="orderForm" :inline="true" ref="confirmPayForm" >
|
|
|
|
- <el-card>
|
|
|
|
- <el-descriptions title="核对信息" border :column="3" label-style="width:120px">
|
|
|
|
- <el-descriptions-item label="总件数">{{orderClothItemDTOS.length}}</el-descriptions-item>
|
|
|
|
- <el-descriptions-item label="总价格(元)">{{calculateTotalPrice() + calculateDeliveryPrice()}}</el-descriptions-item>
|
|
|
|
- <el-descriptions-item label="卡余额(元)" v-if="appUserInfo">{{appUserInfo.rechargeBalance + appUserInfo.giveBalance}}</el-descriptions-item>
|
|
|
|
- <el-descriptions-item label="卡余额(元)" v-else>0</el-descriptions-item>
|
|
|
|
- <el-descriptions-item label="衣服价格(元)">{{calculateTotalPrice()}}</el-descriptions-item>
|
|
|
|
- <el-descriptions-item label="优惠金额(元)">{{calculateTotalDiscountAmount()}}</el-descriptions-item>
|
|
|
|
- <el-descriptions-item label="现金余额(元)">{{appUserInfo?appUserInfo.rechargeBalance:'0'}}</el-descriptions-item>
|
|
|
|
- <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="赠送余额">{{appUserInfo?appUserInfo.giveBalance:'0'}}</el-descriptions-item>
|
|
|
|
- </el-descriptions>
|
|
|
|
- </el-card>
|
|
|
|
|
|
+ <div v-loading="dialogLoading" :element-loading-text="loadingText">
|
|
|
|
+ <el-form :model="orderForm" :inline="true" ref="confirmPayForm">
|
|
|
|
+ <el-card>
|
|
|
|
+ <el-descriptions title="核对信息" border :column="3" label-style="width:120px">
|
|
|
|
+ <el-descriptions-item label="总件数">{{ orderClothItemDTOS.length }}</el-descriptions-item>
|
|
|
|
+ <el-descriptions-item label="总价格(元)">{{ calculateTotalPrice() + calculateDeliveryPrice() }}</el-descriptions-item>
|
|
|
|
+ <el-descriptions-item label="卡余额(元)" v-if="appUserInfo">{{ appUserInfo.rechargeBalance + appUserInfo.giveBalance }}</el-descriptions-item>
|
|
|
|
+ <el-descriptions-item label="卡余额(元)" v-else>0</el-descriptions-item>
|
|
|
|
+ <el-descriptions-item label="衣服价格(元)">{{ calculateTotalPrice() }}</el-descriptions-item>
|
|
|
|
+ <el-descriptions-item label="优惠金额(元)">{{ calculateTotalDiscountAmount() }}</el-descriptions-item>
|
|
|
|
+ <el-descriptions-item label="现金余额(元)">{{ appUserInfo ? appUserInfo.rechargeBalance : '0' }}</el-descriptions-item>
|
|
|
|
+ <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="赠送余额">{{ appUserInfo ? appUserInfo.giveBalance : '0' }}</el-descriptions-item>
|
|
|
|
+ </el-descriptions>
|
|
|
|
+ </el-card>
|
|
|
|
|
|
- <el-card style="margin-top: 10px">
|
|
|
|
- <div slot="header" class="clearfix">
|
|
|
|
- <span>优惠信息</span>
|
|
|
|
- </div>
|
|
|
|
- <el-tabs v-model="confirmCouponTabIndex" type="card" @tab-click="onCouponTabChange">
|
|
|
|
|
|
+ <el-card style="margin-top: 10px">
|
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
|
+ <span>优惠信息</span>
|
|
|
|
+ </div>
|
|
|
|
+ <el-tabs v-model="confirmCouponTabIndex" type="card" @tab-click="onCouponTabChange">
|
|
|
|
+ <el-tab-pane label="优惠券" name="0">
|
|
|
|
+ <el-form-item label="优惠券" prop="fullCoupon">
|
|
|
|
+ <el-input ref="couponRef" v-model="orderForm.fullCoupon" placeholder="请输入优惠券兑换码" clearable />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary">核销</el-button>
|
|
|
|
+ <el-button type="primary" @click="onSelectCoupon">列表选券</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
|
|
- <el-tab-pane label="优惠券" name="0">
|
|
|
|
- <el-form-item label="优惠券" prop="fullCoupon">
|
|
|
|
- <el-input ref="couponRef" v-model="orderForm.fullCoupon" placeholder="请输入优惠券兑换码" clearable/>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <el-button type="primary">核销</el-button>
|
|
|
|
- <el-button type="primary" @click="onSelectCoupon">列表选券</el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <el-tabs v-model="confirmDeductTabIndex" type="card" @tab-click="onCouponTabChange">
|
|
|
|
+ <el-tab-pane label="优惠券使用明细" name="0">
|
|
|
|
+ <el-table :data="selectCoupons">
|
|
|
|
+ <el-table-column label="优惠券" align="center" prop="couponTypeTitle" />
|
|
|
|
+ <el-table-column label="优惠券类型" align="center" prop="discountWay">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span v-if="scope.row.discountWay == '0'">抵扣券</span>
|
|
|
|
+ <span v-if="scope.row.discountWay == '1'">满减券</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="优惠内容" align="center">
|
|
|
|
+ <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>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="是否单件" align="center" prop="isUnique">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span v-if="scope.row.isUnique == 'Y'">单件</span>
|
|
|
|
+ <span v-if="scope.row.isUnique == 'N'">非单件</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="优惠衣服" align="center" prop="selectClothInfo" :width="350">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <template v-for="(item, index) in scope.row.orderCouponClothDTOS">
|
|
|
|
+ <br v-if="index != 0" />
|
|
|
|
+ <span>{{ '#' + (item.clothIndex + 1) + ' ' + item.clothName + ' 优惠' + item.deductAmount + '元' }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="text" @click="changeCouponDiscountCloth(scope.$index)" v-if="scope.$index == selectCoupons.length - 1 && scope.row.discountWay == '0'">修改优惠方式</el-button>
|
|
|
|
+ <el-button type="text" style="color: #ff4949" @click="removeSelectCoupon(scope.$index)" v-if="scope.$index == selectCoupons.length - 1">删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ <el-tab-pane label="衣服抵扣明细" name="1">
|
|
|
|
+ <el-table :data="orderClothItemDTOS">
|
|
|
|
+ <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">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ calculateClothName(scope.$index) }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="颜色" align="center" width="120">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>
|
|
|
|
+ <template v-for="(color, index) in scope.row.orderClothColorDTOS">
|
|
|
|
+ {{ index == 0 ? color.clothColorName : ',' + color.clothColorName }}
|
|
|
|
+ </template>
|
|
|
|
+ </span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <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>{{ scope.row.totalPrice - scope.row.deductAmount }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ </el-tabs>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ <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 in discountCouponVOS">
|
|
|
|
+ <el-option :key="item.id" :label="item.couponTypeTitle + '(' + item.deductAmount * 10 + '折)'" :value="item.id"> </el-option>
|
|
|
|
+ </template>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-table :data="getDiscountClothList()">
|
|
|
|
+ <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">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ calculateClothName(scope.$index) }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="颜色" align="center" width="120">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>
|
|
|
|
+ <template v-for="(color, index) in scope.row.orderClothColorDTOS">
|
|
|
|
+ {{ index == 0 ? color.clothColorName : ',' + color.clothColorName }}
|
|
|
|
+ </template>
|
|
|
|
+ </span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <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>{{ parseInt((scope.row.totalPrice - scope.row.deductAmount) * 100 * parseInt(100 - orderForm.discountCoupon.deductAmount * 100)) / 10000 }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ <el-tab-pane label="现金券" name="2">
|
|
|
|
+ <el-form-item label="现金券" prop="cashDeductAmount">
|
|
|
|
+ <el-input-number
|
|
|
|
+ style="text-align: left"
|
|
|
|
+ v-model="orderForm.cashDeductAmount"
|
|
|
|
+ placeholder="请输入现金券金额"
|
|
|
|
+ :precision="2"
|
|
|
|
+ clearable
|
|
|
|
+ :controls="false"
|
|
|
|
+ :max="(parseInt(calculateTotalPrice() * 100) + parseInt(calculateDeliveryPrice() * 100) - parseInt(calculateTotalDiscountAmountWithoutCashAmount() * 100)) / 100"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="是否特殊" prop="isSpecial">
|
|
|
|
+ <el-checkbox v-model="orderForm.isSpecial"></el-checkbox>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ </el-tabs>
|
|
|
|
+ </el-card>
|
|
|
|
|
|
- <el-tabs v-model="confirmDeductTabIndex" type="card" @tab-click="onCouponTabChange">
|
|
|
|
- <el-tab-pane label="优惠券使用明细" name="0">
|
|
|
|
- <el-table :data="selectCoupons">
|
|
|
|
- <el-table-column label="优惠券" align="center" prop="couponTypeTitle"/>
|
|
|
|
- <el-table-column label="优惠券类型" align="center" prop="discountWay">
|
|
|
|
|
|
+ <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
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ <el-form-item label="支付方式" prop="payType">
|
|
|
|
+ <el-radio-group v-model="orderForm.payType">
|
|
|
|
+ <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>
|
|
|
|
+ <el-radio-button label="1" name="1">支付宝</el-radio-button>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <br />
|
|
|
|
+
|
|
|
|
+ <el-form-item label="付款码" prop="authCode" v-if="orderForm.payType == '0' || orderForm.payType == '1'">
|
|
|
|
+ <el-input v-model="orderForm.authCode" clearable placeholder="请选择付款码" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-descriptions border :column="3" labelStyle="width: 140px" v-if="orderForm.payType == '3'">
|
|
|
|
+ <el-descriptions-item label="用户" v-if="appUserInfo">{{ appUserInfo.realName }}</el-descriptions-item>
|
|
|
|
+ <el-descriptions-item label="当前余额(元)" v-if="appUserInfo">{{ appUserInfo.rechargeBalance + appUserInfo.giveBalance }}</el-descriptions-item>
|
|
|
|
+ <el-descriptions-item label="支付后余额(元)" v-if="appUserInfo">{{ appUserInfo.rechargeBalance + appUserInfo.giveBalance - calculateTotalPrice() }}</el-descriptions-item>
|
|
|
|
+ </el-descriptions>
|
|
|
|
+
|
|
|
|
+ <div style="margin-top: 20px">
|
|
|
|
+ <el-button type="primary" @click="submitForm" style="margin-right: 5%">确 定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-card>
|
|
|
|
+ </el-form>
|
|
|
|
+
|
|
|
|
+ <el-dialog title="选择优惠券" :visible.sync="setCouponOpen" append-to-body width="55%">
|
|
|
|
+ <!-- :before-close="handleClose"-->
|
|
|
|
+
|
|
|
|
+ <el-table :data="deductCouponVOS" style="width: 100%">
|
|
|
|
+ <el-table-column label="优惠券" align="center" prop="couponTypeTitle" />
|
|
|
|
+ <el-table-column label="优惠券类型" align="center" prop="discountType">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span v-if="scope.row.discountWay == '0'">抵扣券</span>
|
|
|
|
- <span v-if="scope.row.discountWay == '1'">满减券</span>
|
|
|
|
|
|
+ <span v-if="scope.row.discountWay == '0'">抵扣券</span>
|
|
|
|
+ <span v-if="scope.row.discountWay == '1'">满减券</span>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="优惠内容" align="center">
|
|
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="优惠内容" align="center">
|
|
<template slot-scope="scope">
|
|
<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 == '0'">抵扣{{ scope.row.deductAmount }}元</span>
|
|
|
|
+ <span v-if="scope.row.discountWay == '1'">满{{ parseInt(scope.row.minAmount) }}件减{{ scope.row.deductAmount }}件</span>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="是否单件" align="center" prop="isUnique">
|
|
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <!-- <el-table-column label="是否单件" align="center" prop="isUnique">-->
|
|
|
|
+ <!-- <template slot-scope="scope">-->
|
|
|
|
+ <!-- <span v-if="scope.row.isUnique == 'Y'">单件</span>-->
|
|
|
|
+ <!-- <span v-if="scope.row.isUnique == 'N'">非单件</span>-->
|
|
|
|
+ <!-- </template>-->
|
|
|
|
+ <!-- </el-table-column>-->
|
|
|
|
+ <el-table-column label="适用衣服" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span v-if="scope.row.isUnique == 'Y'">单件</span>
|
|
|
|
- <span v-if="scope.row.isUnique == 'N'">非单件</span>
|
|
|
|
|
|
+ <template v-for="(item, index) in scope.row.appCouponTypeApplyClothVOS" v-key="id">
|
|
|
|
+ <span>{{ index > 0 ? '、' : '' }}{{ item.clothItemName }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ <span v-if="!scope.row.appCouponTypeApplyClothVOS">全部衣服</span>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="优惠衣服" align="center" prop="selectClothInfo" :width="350">
|
|
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <template v-for="(item,index) in scope.row.orderCouponClothDTOS">
|
|
|
|
- <br v-if="index != 0"/>
|
|
|
|
- <span>{{'#' + (item.clothIndex + 1) + ' ' + item.clothName + ' 优惠' + item.deductAmount + '元'}}</span>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <el-button type="text" @click="onSelectCouponItem(scope.$index)">选择</el-button>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
|
|
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <el-dialog :title="changeDiscountCouponTitle" :visible.sync="changeDiscountCouponOpen" width="70%" append-to-body>
|
|
|
|
+ <span v-if="changeDiscountCouponOpen"> 共可抵扣{{ selectCoupons[changeDiscountCouponIndex].deductAmount }}元,已抵扣{{ calculateCouponDiscountInfo() }}元,剩余可抵扣{{ selectCoupons[changeDiscountCouponIndex].deductAmount - calculateCouponDiscountInfo() }}元 </span>
|
|
|
|
+ <br />
|
|
|
|
+ <span>可选择衣物</span>
|
|
|
|
+ <br />
|
|
|
|
+ <el-table :data="changeDiscountCouponCanSelectCloths">
|
|
|
|
+ <el-table-column label="序号" align="center" fixed="left" width="80">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button
|
|
|
|
-
|
|
|
|
- type="text"
|
|
|
|
- @click="changeCouponDiscountCloth(scope.$index)"
|
|
|
|
- v-if="scope.$index == selectCoupons.length - 1 && scope.row.discountWay == '0'"
|
|
|
|
- >修改优惠方式</el-button>
|
|
|
|
- <el-button
|
|
|
|
-
|
|
|
|
- type="text"
|
|
|
|
- style="color: #ff4949"
|
|
|
|
- @click="removeSelectCoupon(scope.$index)"
|
|
|
|
- v-if="scope.$index == selectCoupons.length - 1"
|
|
|
|
- >删除</el-button>
|
|
|
|
|
|
+ <span>#{{ scope.row.index + 1 }}</span>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- </el-tab-pane>
|
|
|
|
- <el-tab-pane label="衣服抵扣明细" name="1">
|
|
|
|
- <el-table :data="orderClothItemDTOS">
|
|
|
|
- <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>
|
|
|
|
+ <el-table-column label="衣物名称" align="center" prop="name" width="250">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span>{{calculateClothName(scope.$index)}}</span>
|
|
|
|
|
|
+ <span>{{ calculateClothNameByInfo(scope.row) }}</span>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="颜色" align="center" width="120">
|
|
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="颜色" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span>
|
|
|
|
- <template v-for="(color,index) in scope.row.orderClothColorDTOS">
|
|
|
|
- {{index == 0?color.clothColorName:(',' + color.clothColorName)}}
|
|
|
|
- </template>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <span>
|
|
|
|
+ <template v-for="(color, index) in scope.row.orderClothColorDTOS">
|
|
|
|
+ {{ index == 0 ? color.clothColorName : ',' + color.clothColorName }}
|
|
|
|
+ </template>
|
|
|
|
+ </span>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="衣服品牌" align="center" prop="name" width="120">
|
|
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="衣服品牌" align="center" prop="name" width="120">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span>{{scope.row.clothBrandName}}</span>
|
|
|
|
|
|
+ <span>{{ scope.row.clothBrandName }}</span>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="瑕疵" align="center" >
|
|
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="瑕疵" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span>
|
|
|
|
- <template v-for="(color,index) in scope.row.orderClothFlawDTOS">
|
|
|
|
- {{index == 0?color.clothFlawName:(',' + color.clothFlawName)}}
|
|
|
|
- </template>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <span>
|
|
|
|
+ <template v-for="(color, index) in scope.row.orderClothFlawDTOS">
|
|
|
|
+ {{ index == 0 ? color.clothFlawName : ',' + color.clothFlawName }}
|
|
|
|
+ </template>
|
|
|
|
+ </span>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="洗涤方式" align="center" width="80">
|
|
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="洗涤方式" align="center" width="80">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span>{{scope.row.clothWashModeName}}</span>
|
|
|
|
|
|
+ <span>{{ scope.row.clothWashModeName }}</span>
|
|
</template>
|
|
</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">
|
|
|
|
|
|
+ </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">
|
|
<template slot-scope="scope">
|
|
- <span>{{scope.row.totalPrice - scope.row.deductAmount}}</span>
|
|
|
|
|
|
+ <span>{{ scope.row.totalPrice - scope.row.deductAmount }}</span>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- </el-tab-pane>
|
|
|
|
- </el-tabs>
|
|
|
|
- </el-tab-pane>
|
|
|
|
- <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) in discountCouponVOS">
|
|
|
|
- <el-option
|
|
|
|
- :key="item.id"
|
|
|
|
- :label="item.couponTypeTitle + '(' + (item.deductAmount * 10) + '折)'"
|
|
|
|
- :value="item.id">
|
|
|
|
- </el-option>
|
|
|
|
- </template>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-table :data="getDiscountClothList()">
|
|
|
|
- <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">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>{{calculateClothName(scope.$index)}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="颜色" align="center" width="120">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>
|
|
|
|
- <template v-for="(color,index) in scope.row.orderClothColorDTOS">
|
|
|
|
- {{index == 0?color.clothColorName:(',' + color.clothColorName)}}
|
|
|
|
- </template>
|
|
|
|
- </span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <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>{{parseInt((scope.row.totalPrice - scope.row.deductAmount)*100*parseInt(100 - orderForm.discountCoupon.deductAmount * 100))/10000}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
-
|
|
|
|
- </el-tab-pane>
|
|
|
|
- <el-tab-pane label="现金券" name="2">
|
|
|
|
- <el-form-item label="现金券" prop="cashDeductAmount">
|
|
|
|
- <el-input-number style="text-align: left" v-model="orderForm.cashDeductAmount" placeholder="请输入现金券金额" :precision="2" clearable :controls="false" :max="(parseInt(calculateTotalPrice()*100) + parseInt(calculateDeliveryPrice()*100) - parseInt(calculateTotalDiscountAmountWithoutCashAmount()*100))/100"/>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="是否特殊" prop="isSpecial">
|
|
|
|
- <el-checkbox v-model="orderForm.isSpecial"></el-checkbox>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-tab-pane>
|
|
|
|
- </el-tabs>
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- </el-card>
|
|
|
|
-
|
|
|
|
- <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>
|
|
|
|
- </div>
|
|
|
|
- <el-form-item label="支付方式" prop="payType">
|
|
|
|
- <el-radio-group v-model="orderForm.payType">
|
|
|
|
- <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>
|
|
|
|
- <el-radio-button label="1" name="1">支付宝</el-radio-button>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
- <br/>
|
|
|
|
-
|
|
|
|
- <el-form-item label="付款码" prop="authCode" v-if="orderForm.payType == '0' || orderForm.payType == '1'">
|
|
|
|
- <el-input v-model="orderForm.authCode" clearable placeholder="请选择付款码"/>
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
|
- <el-descriptions border :column="3" labelStyle="width: 140px" v-if="orderForm.payType == '3'">
|
|
|
|
- <el-descriptions-item label="用户" v-if="appUserInfo">{{appUserInfo.realName}}</el-descriptions-item>
|
|
|
|
- <el-descriptions-item label="当前余额(元)" v-if="appUserInfo">{{appUserInfo.rechargeBalance + appUserInfo.giveBalance}}</el-descriptions-item>
|
|
|
|
- <el-descriptions-item label="支付后余额(元)" v-if="appUserInfo">{{appUserInfo.rechargeBalance + appUserInfo.giveBalance - calculateTotalPrice()}}</el-descriptions-item>
|
|
|
|
- </el-descriptions>
|
|
|
|
-
|
|
|
|
- <div style="margin-top: 20px;">
|
|
|
|
- <el-button type="primary" @click="submitForm" style="margin-right: 5%">确 定</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-card>
|
|
|
|
- </el-form>
|
|
|
|
-
|
|
|
|
- <el-dialog
|
|
|
|
- title="选择优惠券"
|
|
|
|
- :visible.sync="setCouponOpen"
|
|
|
|
- append-to-body
|
|
|
|
- width="55%">
|
|
|
|
- <!-- :before-close="handleClose"-->
|
|
|
|
-
|
|
|
|
- <el-table :data="deductCouponVOS" style="width: 100%">
|
|
|
|
- <el-table-column label="优惠券" align="center" prop="couponTypeTitle"/>
|
|
|
|
- <el-table-column label="优惠券类型" align="center" prop="discountType">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span v-if="scope.row.discountWay == '0'">抵扣券</span>
|
|
|
|
- <span v-if="scope.row.discountWay == '1'">满减券</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="优惠内容" align="center">
|
|
|
|
- <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>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="是否单件" align="center" prop="isUnique">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span v-if="scope.row.isUnique == 'Y'">单件</span>
|
|
|
|
- <span v-if="scope.row.isUnique == 'N'">非单件</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="适用衣服" align="center">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <template v-for="(item,index) in scope.row.appCouponTypeApplyClothVOS" v-key="id" >
|
|
|
|
- <span>{{index > 0?'、':''}}{{item.clothItemName}}</span>
|
|
|
|
- </template>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="操作" align="center" >
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-button
|
|
|
|
-
|
|
|
|
- type="text"
|
|
|
|
- @click="onSelectCouponItem(scope.$index)"
|
|
|
|
- >选择</el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- </el-dialog>
|
|
|
|
-
|
|
|
|
- <el-dialog
|
|
|
|
- :title="changeDiscountCouponTitle"
|
|
|
|
- :visible.sync="changeDiscountCouponOpen"
|
|
|
|
- width="70%"
|
|
|
|
-
|
|
|
|
- append-to-body>
|
|
|
|
- <span v-if="changeDiscountCouponOpen">
|
|
|
|
- 共可抵扣{{selectCoupons[changeDiscountCouponIndex].deductAmount}}元,已抵扣{{calculateCouponDiscountInfo()}}元,剩余可抵扣{{selectCoupons[changeDiscountCouponIndex].deductAmount - calculateCouponDiscountInfo()}}元
|
|
|
|
- </span>
|
|
|
|
- <br/>
|
|
|
|
- <span>可选择衣物</span>
|
|
|
|
- <br/>
|
|
|
|
- <el-table :data="changeDiscountCouponCanSelectCloths">
|
|
|
|
- <el-table-column
|
|
|
|
- label="序号"
|
|
|
|
- align="center"
|
|
|
|
- fixed="left"
|
|
|
|
- width="80">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>#{{scope.row.index + 1}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="衣物名称" align="center" prop="name" width="250">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>{{calculateClothNameByInfo(scope.row)}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="颜色" align="center" width="120">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>
|
|
|
|
- <template v-for="(color,index) in scope.row.orderClothColorDTOS">
|
|
|
|
- {{index == 0?color.clothColorName:(',' + color.clothColorName)}}
|
|
|
|
- </template>
|
|
|
|
- </span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <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>{{scope.row.totalPrice - scope.row.deductAmount}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
-
|
|
|
|
- <el-table-column label="操作" align="center" >
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-button
|
|
|
|
-
|
|
|
|
- type="text"
|
|
|
|
- style="color: #ff4949"
|
|
|
|
- @click="addCouponRelateCloth(scope.$index)"
|
|
|
|
- >添加</el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- <br/>
|
|
|
|
- <span>已选择衣物</span>
|
|
|
|
- <br/>
|
|
|
|
- <el-table :data="changeDiscountCouponSelectCloths" style="width: 100%" >
|
|
|
|
- <el-table-column label="序号" align="center" width="80">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>#{{scope.row.clothIndex + 1}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="衣服名称" align="center" prop="clothName" width="250"/>
|
|
|
|
- <el-table-column label="颜色" align="center" width="120">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>
|
|
|
|
- <template v-for="(color,index) in scope.row.cloth.orderClothColorDTOS">
|
|
|
|
- {{index == 0?color.clothColorName:(',' + color.clothColorName)}}
|
|
|
|
- </template>
|
|
|
|
- </span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="衣服品牌" align="center" prop="name" width="120">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>{{scope.row.cloth.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.cloth.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.cloth.clothWashModeName}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="原价(元)" align="center" prop="totalPrice" width="100">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>{{scope.row.cloth.totalPrice}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="已优惠金额(元)" align="center" prop="deductAmount" width="130">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>{{scope.row.cloth.deductAmount}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="还需支付(元)" align="center" width="130">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>{{scope.row.cloth.totalPrice - scope.row.cloth.deductAmount}}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="本次优惠金额(元)" align="center" prop="deductAmount" width="180">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="操作" align="center" fixed="right">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-button
|
|
|
|
-
|
|
|
|
- type="text"
|
|
|
|
- style="color: #ff4949"
|
|
|
|
- @click="removeCouponRelateCloth(scope.$index)"
|
|
|
|
- >删除</el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="text" style="color: #ff4949" @click="addCouponRelateCloth(scope.$index)">添加</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <br />
|
|
|
|
+ <span>已选择衣物</span>
|
|
|
|
+ <br />
|
|
|
|
+ <el-table :data="changeDiscountCouponSelectCloths" style="width: 100%">
|
|
|
|
+ <el-table-column label="序号" align="center" width="80">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>#{{ scope.row.clothIndex + 1 }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="衣服名称" align="center" prop="clothName" width="250" />
|
|
|
|
+ <el-table-column label="颜色" align="center" width="120">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>
|
|
|
|
+ <template v-for="(color, index) in scope.row.cloth.orderClothColorDTOS">
|
|
|
|
+ {{ index == 0 ? color.clothColorName : ',' + color.clothColorName }}
|
|
|
|
+ </template>
|
|
|
|
+ </span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="衣服品牌" align="center" prop="name" width="120">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ scope.row.cloth.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.cloth.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.cloth.clothWashModeName }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="原价(元)" align="center" prop="totalPrice" width="100">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ scope.row.cloth.totalPrice }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="已优惠金额(元)" align="center" prop="deductAmount" width="130">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ scope.row.cloth.deductAmount }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="还需支付(元)" align="center" width="130">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ scope.row.cloth.totalPrice - scope.row.cloth.deductAmount }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="本次优惠金额(元)" align="center" prop="deductAmount" width="180"> </el-table-column>
|
|
|
|
+ <el-table-column label="操作" align="center" fixed="right">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="text" style="color: #ff4949" @click="removeCouponRelateCloth(scope.$index)">删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click="changeDiscountCouponOpen = false">取 消</el-button>
|
|
|
|
- <el-button type="primary" @click="submitChangeCouponRelateCloth">确 定</el-button>
|
|
|
|
- </span>
|
|
|
|
- </el-dialog>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="changeDiscountCouponOpen = false">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submitChangeCouponRelateCloth">确 定</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import {collectCloth} from "../../../../api/order/cloth";
|
|
|
|
|
|
+import { collectCloth } from '../../../../api/order/cloth'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- name: "cashCloth",
|
|
|
|
- props: {
|
|
|
|
- appUserInfo: {
|
|
|
|
- type: Object
|
|
|
|
- },
|
|
|
|
- orderForm: {
|
|
|
|
- type: Object
|
|
|
|
- },
|
|
|
|
- orderClothItemDTOS:{
|
|
|
|
- type: Array,
|
|
|
|
- default:[]
|
|
|
|
- },
|
|
|
|
- clothSpeeds:{
|
|
|
|
- type: Array,
|
|
|
|
- default:[]
|
|
|
|
- },
|
|
|
|
- deductCouponVOS:{
|
|
|
|
- type:Array,
|
|
|
|
- default:[]
|
|
|
|
- },
|
|
|
|
- discountCouponVOS:{//可选择的折扣券
|
|
|
|
- type:Array,
|
|
|
|
- default:[]
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- data(){
|
|
|
|
- return {
|
|
|
|
- dialogLoading:false,
|
|
|
|
- setCouponOpen:false,//是否选择优惠券
|
|
|
|
-
|
|
|
|
- loadingText:'',
|
|
|
|
- confirmCouponTabIndex:'0',
|
|
|
|
- confirmDeductTabIndex:'0',
|
|
|
|
- selectCoupons:[],
|
|
|
|
- changeDiscountCouponIndex:-1,
|
|
|
|
- changeDiscountCouponOpen:false,
|
|
|
|
- changeDiscountCouponTitle:'',
|
|
|
|
- changeDiscountCouponSelectCloths:[],
|
|
|
|
- changeDiscountCouponCanSelectCloths:[],
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- mounted() {
|
|
|
|
- if(process.env.ENV != 'production'){
|
|
|
|
- window.cashClothDialog = this
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- methods:{
|
|
|
|
-
|
|
|
|
- calculateTotalPrice(){
|
|
|
|
- var price = 0;
|
|
|
|
- for (let i = 0; i < this.orderClothItemDTOS.length; i++) {
|
|
|
|
- price += this.calculateClothSpecialPrice(i) + this.orderClothItemDTOS[i].defaultPrice
|
|
|
|
- }
|
|
|
|
- return price
|
|
|
|
- },
|
|
|
|
- calculateClothSpecialPrice(index){
|
|
|
|
- var specialPrice = 0
|
|
|
|
- if(this.orderClothItemDTOS[index].orderClothCraftDTOS && this.orderClothItemDTOS[index].orderClothCraftDTOS.length > 0){
|
|
|
|
- for (let i = 0; i < this.orderClothItemDTOS[index].orderClothCraftDTOS.length; i++) {
|
|
|
|
- specialPrice += this.orderClothItemDTOS[index].orderClothCraftDTOS[i].price
|
|
|
|
|
|
+ name: 'cashCloth',
|
|
|
|
+ props: {
|
|
|
|
+ appUserInfo: {
|
|
|
|
+ type: Object
|
|
|
|
+ },
|
|
|
|
+ orderForm: {
|
|
|
|
+ type: Object
|
|
|
|
+ },
|
|
|
|
+ orderClothItemDTOS: {
|
|
|
|
+ type: Array,
|
|
|
|
+ default: []
|
|
|
|
+ },
|
|
|
|
+ clothSpeeds: {
|
|
|
|
+ type: Array,
|
|
|
|
+ default: []
|
|
|
|
+ },
|
|
|
|
+ deductCouponVOS: {
|
|
|
|
+ type: Array,
|
|
|
|
+ default: []
|
|
|
|
+ },
|
|
|
|
+ discountCouponVOS: {
|
|
|
|
+ //可选择的折扣券
|
|
|
|
+ type: Array,
|
|
|
|
+ default: []
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- if(this.orderClothItemDTOS[index].isHedging == 'Y'){
|
|
|
|
- specialPrice += this.orderClothItemDTOS[index].hedgingPrice * 0.01
|
|
|
|
- }
|
|
|
|
- for (let i = 0; i < this.clothSpeeds.length; i++) {
|
|
|
|
- if(this.orderClothItemDTOS[index].clothSpeedId == this.clothSpeeds[i].id){
|
|
|
|
- specialPrice += this.orderClothItemDTOS[index].defaultPrice * (this.clothSpeeds[i].multiple - 1)
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return specialPrice
|
|
|
|
- },
|
|
|
|
- calculateDeliveryPrice(){
|
|
|
|
- if(this.calculateTotalPrice() >= 100){
|
|
|
|
- return 0
|
|
|
|
- }
|
|
|
|
- var delivery = 0
|
|
|
|
- if(this.orderForm.takeClothWay && this.orderForm.takeClothWay == '1'){
|
|
|
|
- delivery += 10
|
|
|
|
- }
|
|
|
|
- if(this.orderForm.sendClothWay && this.orderForm.sendClothWay == '1'){
|
|
|
|
- delivery += 10
|
|
|
|
- }
|
|
|
|
- return delivery
|
|
|
|
- },
|
|
|
|
- //计算当前所有优惠金额
|
|
|
|
- calculateTotalDiscountAmount(){
|
|
|
|
- var totalDiscountAmount = this.orderForm.cashDeductAmount?this.orderForm.cashDeductAmount:0
|
|
|
|
- this.orderClothItemDTOS.forEach(cloth => {
|
|
|
|
- totalDiscountAmount = (parseInt(totalDiscountAmount * 100) + parseInt(cloth.deductAmount * 100))/100
|
|
|
|
- })
|
|
|
|
- //折扣优惠券
|
|
|
|
- if(this.orderForm.discountCoupon){
|
|
|
|
- var discountCoupon = this.orderForm.discountCoupon
|
|
|
|
- this.orderClothItemDTOS.forEach(cloth => {
|
|
|
|
- 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
|
|
|
|
- },
|
|
|
|
- //计算出去现金券其余的优惠金额
|
|
|
|
- calculateTotalDiscountAmountWithoutCashAmount(){
|
|
|
|
- var totalDiscountAmount = 0
|
|
|
|
- this.orderClothItemDTOS.forEach(cloth => {
|
|
|
|
- totalDiscountAmount = (parseInt(totalDiscountAmount * 100) + parseInt(cloth.deductAmount * 100))/100
|
|
|
|
- })
|
|
|
|
- //折扣优惠券
|
|
|
|
- if(this.orderForm.discountCoupon){
|
|
|
|
- var discountCoupon = this.orderForm.discountCoupon
|
|
|
|
- this.orderClothItemDTOS.forEach(cloth => {
|
|
|
|
- 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
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- /**
|
|
|
|
- * 计算当前优惠券抵扣明细
|
|
|
|
- */
|
|
|
|
- calculateCouponDiscountInfo(){
|
|
|
|
- var deductAmount = 0
|
|
|
|
- this.changeDiscountCouponSelectCloths.forEach(item => {
|
|
|
|
- deductAmount += item.deductAmount
|
|
|
|
- })
|
|
|
|
- return deductAmount
|
|
|
|
},
|
|
},
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ dialogLoading: false,
|
|
|
|
+ setCouponOpen: false, //是否选择优惠券
|
|
|
|
|
|
- onCouponTabChange(tab,event){
|
|
|
|
- console.log('tab.index:' + tab.index)
|
|
|
|
- // if(tab.index == '1'){
|
|
|
|
- // this.$refs['couponRef'].focus()
|
|
|
|
- // }
|
|
|
|
- },
|
|
|
|
- onSelectCoupon(){
|
|
|
|
- if(this.deductCouponVOS.length == 0){
|
|
|
|
- this.$message.error('没有可选择的优惠券')
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- this.setCouponOpen = true
|
|
|
|
- },
|
|
|
|
- changeCouponDiscountCloth(index){
|
|
|
|
- this.changeDiscountCouponSelectCloths = this.selectCoupons[index].orderCouponClothDTOS.concat()
|
|
|
|
- for (let i = 0; i < this.changeDiscountCouponSelectCloths.length; i++) {
|
|
|
|
- var item = this.changeDiscountCouponSelectCloths[i]
|
|
|
|
- item.cloth = JSON.parse(JSON.stringify(this.orderClothItemDTOS[item.clothIndex]))
|
|
|
|
- }
|
|
|
|
- this.changeDiscountCouponIndex = index
|
|
|
|
- this.changeDiscountCouponCanSelectCloths = []
|
|
|
|
- this.orderClothItemDTOS.forEach(item => {
|
|
|
|
- //如果这件衣服已经被被抵扣完成,则不需要选择
|
|
|
|
- if((item.totalPrice - item.deductAmount) <= 0){
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- //添加优惠券支持的衣服
|
|
|
|
- if(!this.selectCoupons[index].appCouponTypeApplyClothVOS.find(i => i.clothItemId == item.id)){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- //如果这个优惠券已经被选择过,则跳过
|
|
|
|
- if(this.selectCoupons[index].orderCouponClothDTOS.find(i => i.clothIndex == item.index)){
|
|
|
|
- return;
|
|
|
|
|
|
+ loadingText: '',
|
|
|
|
+ confirmCouponTabIndex: '0',
|
|
|
|
+ confirmDeductTabIndex: '0',
|
|
|
|
+ selectCoupons: [],
|
|
|
|
+ changeDiscountCouponIndex: -1,
|
|
|
|
+ changeDiscountCouponOpen: false,
|
|
|
|
+ changeDiscountCouponTitle: '',
|
|
|
|
+ changeDiscountCouponSelectCloths: [],
|
|
|
|
+ changeDiscountCouponCanSelectCloths: []
|
|
}
|
|
}
|
|
- this.changeDiscountCouponCanSelectCloths.push(item)
|
|
|
|
- })
|
|
|
|
- this.changeDiscountCouponTitle = '修改『' + this.selectCoupons[index].couponTypeTitle + '』可抵扣衣物'
|
|
|
|
- this.changeDiscountCouponOpen = true
|
|
|
|
},
|
|
},
|
|
- onDiscountCouponSelect(e){
|
|
|
|
- this.orderForm.discountCoupon = this.discountCouponVOS.find(item => item.id == e)
|
|
|
|
- },
|
|
|
|
- getDiscountClothList(){
|
|
|
|
- var cloths = []
|
|
|
|
- if(!this.orderForm.discountCoupon){
|
|
|
|
- return cloths
|
|
|
|
- }
|
|
|
|
- this.orderClothItemDTOS.forEach(cloth => {
|
|
|
|
- if(this.orderForm.discountCoupon.appCouponTypeApplyClothVOS.find(item => item.clothItemId == cloth.id)){
|
|
|
|
- cloths.push(cloth)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- return cloths
|
|
|
|
- },
|
|
|
|
- calculateClothName(index){
|
|
|
|
- var clothName = this.orderClothItemDTOS[index].name
|
|
|
|
- this.orderClothItemDTOS[index].orderClothTypeDTOS.forEach(item => {
|
|
|
|
- if(item.clothTypeCode == '0'){
|
|
|
|
- clothName += ' - 加厚'
|
|
|
|
- }
|
|
|
|
- if(item.clothTypeCode == '0'){
|
|
|
|
- clothName += ' - 羊绒'
|
|
|
|
- }
|
|
|
|
- if(item.clothTypeCode == '0'){
|
|
|
|
- clothName += ' - 真丝'
|
|
|
|
- }
|
|
|
|
- if(item.clothTypeCode == '0'){
|
|
|
|
- clothName += ' - 儿童'
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- return clothName
|
|
|
|
- },
|
|
|
|
- calculateClothNameByInfo(cloth){
|
|
|
|
- var clothName = cloth.name
|
|
|
|
- cloth.orderClothTypeDTOS.forEach(item => {
|
|
|
|
- if(item.clothTypeCode == '0'){
|
|
|
|
- clothName += ' - 加厚'
|
|
|
|
- }
|
|
|
|
- if(item.clothTypeCode == '0'){
|
|
|
|
- clothName += ' - 羊绒'
|
|
|
|
- }
|
|
|
|
- if(item.clothTypeCode == '0'){
|
|
|
|
- clothName += ' - 真丝'
|
|
|
|
- }
|
|
|
|
- if(item.clothTypeCode == '0'){
|
|
|
|
- clothName += ' - 儿童'
|
|
|
|
|
|
+ mounted() {
|
|
|
|
+ if (process.env.ENV != 'production') {
|
|
|
|
+ window.cashClothDialog = this
|
|
}
|
|
}
|
|
- })
|
|
|
|
- return clothName
|
|
|
|
},
|
|
},
|
|
- onSelectCouponItem(index){
|
|
|
|
- var coupon = this.deductCouponVOS[index]
|
|
|
|
- coupon.orderCouponClothDTOS = []
|
|
|
|
|
|
+ methods: {
|
|
|
|
+ calculateTotalPrice() {
|
|
|
|
+ var price = 0
|
|
|
|
+ for (let i = 0; i < this.orderClothItemDTOS.length; i++) {
|
|
|
|
+ price += this.calculateClothSpecialPrice(i) + this.orderClothItemDTOS[i].defaultPrice
|
|
|
|
+ }
|
|
|
|
+ return price
|
|
|
|
+ },
|
|
|
|
+ calculateClothSpecialPrice(index) {
|
|
|
|
+ var specialPrice = 0
|
|
|
|
+ if (this.orderClothItemDTOS[index].orderClothCraftDTOS && this.orderClothItemDTOS[index].orderClothCraftDTOS.length > 0) {
|
|
|
|
+ for (let i = 0; i < this.orderClothItemDTOS[index].orderClothCraftDTOS.length; i++) {
|
|
|
|
+ specialPrice += this.orderClothItemDTOS[index].orderClothCraftDTOS[i].price
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ if (this.orderClothItemDTOS[index].isHedging == 'Y') {
|
|
|
|
+ specialPrice += this.orderClothItemDTOS[index].hedgingPrice * 0.01
|
|
|
|
+ }
|
|
|
|
+ for (let i = 0; i < this.clothSpeeds.length; i++) {
|
|
|
|
+ if (this.orderClothItemDTOS[index].clothSpeedId == this.clothSpeeds[i].id) {
|
|
|
|
+ specialPrice += this.orderClothItemDTOS[index].defaultPrice * (this.clothSpeeds[i].multiple - 1)
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return specialPrice
|
|
|
|
+ },
|
|
|
|
+ calculateDeliveryPrice() {
|
|
|
|
+ if (this.calculateTotalPrice() >= 100) {
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
|
|
+ var delivery = 0
|
|
|
|
+ if (this.orderForm.takeClothWay && this.orderForm.takeClothWay == '1') {
|
|
|
|
+ delivery += 10
|
|
|
|
+ }
|
|
|
|
+ if (this.orderForm.sendClothWay && this.orderForm.sendClothWay == '1') {
|
|
|
|
+ delivery += 10
|
|
|
|
+ }
|
|
|
|
+ return delivery
|
|
|
|
+ },
|
|
|
|
+ //计算当前所有优惠金额
|
|
|
|
+ calculateTotalDiscountAmount() {
|
|
|
|
+ var totalDiscountAmount = this.orderForm.cashDeductAmount ? this.orderForm.cashDeductAmount : 0
|
|
|
|
+ this.orderClothItemDTOS.forEach((cloth) => {
|
|
|
|
+ totalDiscountAmount = (parseInt(totalDiscountAmount * 100) + parseInt(cloth.deductAmount * 100)) / 100
|
|
|
|
+ })
|
|
|
|
+ //折扣优惠券
|
|
|
|
+ if (this.orderForm.discountCoupon) {
|
|
|
|
+ var discountCoupon = this.orderForm.discountCoupon
|
|
|
|
+ this.orderClothItemDTOS.forEach((cloth) => {
|
|
|
|
+ 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
|
|
|
|
+ },
|
|
|
|
+ //计算出去现金券其余的优惠金额
|
|
|
|
+ calculateTotalDiscountAmountWithoutCashAmount() {
|
|
|
|
+ var totalDiscountAmount = 0
|
|
|
|
+ this.orderClothItemDTOS.forEach((cloth) => {
|
|
|
|
+ totalDiscountAmount = (parseInt(totalDiscountAmount * 100) + parseInt(cloth.deductAmount * 100)) / 100
|
|
|
|
+ })
|
|
|
|
+ //折扣优惠券
|
|
|
|
+ if (this.orderForm.discountCoupon) {
|
|
|
|
+ var discountCoupon = this.orderForm.discountCoupon
|
|
|
|
+ this.orderClothItemDTOS.forEach((cloth) => {
|
|
|
|
+ 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
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * 计算当前优惠券抵扣明细
|
|
|
|
+ */
|
|
|
|
+ calculateCouponDiscountInfo() {
|
|
|
|
+ var deductAmount = 0
|
|
|
|
+ this.changeDiscountCouponSelectCloths.forEach((item) => {
|
|
|
|
+ deductAmount += item.deductAmount
|
|
|
|
+ })
|
|
|
|
+ return deductAmount
|
|
|
|
+ },
|
|
|
|
|
|
- //找出优惠券适配优惠的衣服
|
|
|
|
- var applyCloths = []
|
|
|
|
- coupon.appCouponTypeApplyClothVOS.forEach(item => {
|
|
|
|
- for (let i = 0; i < this.orderClothItemDTOS.length; i++) {
|
|
|
|
- var cloth = this.orderClothItemDTOS[i]
|
|
|
|
- if(cloth.id != item.clothItemId || (cloth.totalPrice - cloth.deductAmount) <= 0){
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
- applyCloths.push(cloth)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- //排序,按照订单剩余需要支付的金额降序
|
|
|
|
- applyCloths.sort((a,b) => {
|
|
|
|
- return (b.totalPrice - b.deductAmount) - (a.totalPrice - a.deductAmount)
|
|
|
|
- })
|
|
|
|
- console.log('applyCloths:' + JSON.stringify(applyCloths))
|
|
|
|
- if(coupon.discountWay == '0'){//抵扣
|
|
|
|
- if(coupon.isUnique == 'Y') {//单件,只减一件
|
|
|
|
- var cloth = applyCloths[0]
|
|
|
|
- //抵扣所有衣服里金额最大的
|
|
|
|
- if((cloth.totalPrice - cloth.deductAmount) >= coupon.deductAmount){
|
|
|
|
- coupon.orderCouponClothDTOS.push({clothIndex:cloth.index,id:cloth.id,deductAmount:coupon.deductAmount,clothName:this.calculateClothNameByInfo(cloth)})
|
|
|
|
- cloth.deductAmount += coupon.deductAmount
|
|
|
|
- }else{
|
|
|
|
- coupon.orderCouponClothDTOS.push({clothIndex:cloth.index,id:cloth.id,deductAmount:(cloth.totalPrice - cloth.deductAmount),clothName:this.calculateClothNameByInfo(cloth)})
|
|
|
|
- cloth.deductAmount = cloth.totalPrice
|
|
|
|
- }
|
|
|
|
- }else{//非单件,可减多件
|
|
|
|
- var deductAmount = coupon.deductAmount
|
|
|
|
- for (let i = 0; i < applyCloths.length; i++) {
|
|
|
|
- //如果优惠券可抵扣金额用完
|
|
|
|
- if(deductAmount <= 0){
|
|
|
|
- break
|
|
|
|
|
|
+ onCouponTabChange(tab, event) {
|
|
|
|
+ console.log('tab.index:' + tab.index)
|
|
|
|
+ // if(tab.index == '1'){
|
|
|
|
+ // this.$refs['couponRef'].focus()
|
|
|
|
+ // }
|
|
|
|
+ },
|
|
|
|
+ onSelectCoupon() {
|
|
|
|
+ if (this.deductCouponVOS.length == 0) {
|
|
|
|
+ this.$message.error('没有可选择的优惠券')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.setCouponOpen = true
|
|
|
|
+ },
|
|
|
|
+ changeCouponDiscountCloth(index) {
|
|
|
|
+ this.changeDiscountCouponSelectCloths = this.selectCoupons[index].orderCouponClothDTOS.concat()
|
|
|
|
+ for (let i = 0; i < this.changeDiscountCouponSelectCloths.length; i++) {
|
|
|
|
+ var item = this.changeDiscountCouponSelectCloths[i]
|
|
|
|
+ item.cloth = JSON.parse(JSON.stringify(this.orderClothItemDTOS[item.clothIndex]))
|
|
}
|
|
}
|
|
- var cloth = applyCloths[i]
|
|
|
|
- if((cloth.totalPrice - cloth.deductAmount) >= deductAmount){
|
|
|
|
- coupon.orderCouponClothDTOS.push({clothIndex:cloth.index,id:cloth.id,deductAmount:deductAmount,clothName:this.calculateClothNameByInfo(cloth)})
|
|
|
|
- cloth.deductAmount += deductAmount
|
|
|
|
- deductAmount = 0
|
|
|
|
- }else{
|
|
|
|
- coupon.orderCouponClothDTOS.push({clothIndex:cloth.index,id:cloth.id,deductAmount:(cloth.totalPrice - cloth.deductAmount),clothName:this.calculateClothNameByInfo(cloth)})
|
|
|
|
- cloth.deductAmount = cloth.totalPrice
|
|
|
|
- deductAmount -= (cloth.totalPrice - cloth.deductAmount)
|
|
|
|
|
|
+ this.changeDiscountCouponIndex = index
|
|
|
|
+ this.changeDiscountCouponCanSelectCloths = []
|
|
|
|
+ this.orderClothItemDTOS.forEach((item) => {
|
|
|
|
+ //如果这件衣服已经被被抵扣完成,则不需要选择
|
|
|
|
+ if (item.totalPrice - item.deductAmount <= 0) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //添加优惠券支持的衣服
|
|
|
|
+ if (!this.selectCoupons[index].appCouponTypeApplyClothVOS.find((i) => i.clothItemId == item.id)) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //如果这个优惠券已经被选择过,则跳过
|
|
|
|
+ if (this.selectCoupons[index].orderCouponClothDTOS.find((i) => i.clothIndex == item.index)) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.changeDiscountCouponCanSelectCloths.push(item)
|
|
|
|
+ })
|
|
|
|
+ this.changeDiscountCouponTitle = '修改『' + this.selectCoupons[index].couponTypeTitle + '』可抵扣衣物'
|
|
|
|
+ this.changeDiscountCouponOpen = true
|
|
|
|
+ },
|
|
|
|
+ onDiscountCouponSelect(e) {
|
|
|
|
+ this.orderForm.discountCoupon = this.discountCouponVOS.find((item) => item.id == e)
|
|
|
|
+ },
|
|
|
|
+ getDiscountClothList() {
|
|
|
|
+ var cloths = []
|
|
|
|
+ if (!this.orderForm.discountCoupon) {
|
|
|
|
+ return cloths
|
|
}
|
|
}
|
|
|
|
+ this.orderClothItemDTOS.forEach((cloth) => {
|
|
|
|
+ if (this.orderForm.discountCoupon.appCouponTypeApplyClothVOS.find((item) => item.clothItemId == cloth.id)) {
|
|
|
|
+ cloths.push(cloth)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return cloths
|
|
|
|
+ },
|
|
|
|
+ calculateClothName(index) {
|
|
|
|
+ var clothName = this.orderClothItemDTOS[index].name
|
|
|
|
+ this.orderClothItemDTOS[index].orderClothTypeDTOS.forEach((item) => {
|
|
|
|
+ if (item.clothTypeCode == '0') {
|
|
|
|
+ clothName += ' - 加厚'
|
|
|
|
+ }
|
|
|
|
+ if (item.clothTypeCode == '0') {
|
|
|
|
+ clothName += ' - 羊绒'
|
|
|
|
+ }
|
|
|
|
+ if (item.clothTypeCode == '0') {
|
|
|
|
+ clothName += ' - 真丝'
|
|
|
|
+ }
|
|
|
|
+ if (item.clothTypeCode == '0') {
|
|
|
|
+ clothName += ' - 儿童'
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return clothName
|
|
|
|
+ },
|
|
|
|
+ calculateClothNameByInfo(cloth) {
|
|
|
|
+ var clothName = cloth.name
|
|
|
|
+ cloth.orderClothTypeDTOS.forEach((item) => {
|
|
|
|
+ if (item.clothTypeCode == '0') {
|
|
|
|
+ clothName += ' - 加厚'
|
|
|
|
+ }
|
|
|
|
+ if (item.clothTypeCode == '0') {
|
|
|
|
+ clothName += ' - 羊绒'
|
|
|
|
+ }
|
|
|
|
+ if (item.clothTypeCode == '0') {
|
|
|
|
+ clothName += ' - 真丝'
|
|
|
|
+ }
|
|
|
|
+ if (item.clothTypeCode == '0') {
|
|
|
|
+ clothName += ' - 儿童'
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return clothName
|
|
|
|
+ },
|
|
|
|
+ onSelectCouponItem(index) {
|
|
|
|
+ var coupon = this.deductCouponVOS[index]
|
|
|
|
+ coupon.orderCouponClothDTOS = []
|
|
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }else if(coupon.discountWay == '1'){//满减
|
|
|
|
- if(applyCloths.length < parseInt(coupon.minAmount)){//未满足满减条件
|
|
|
|
- this.$message.error('未满足满减条件')
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if(coupon.isUnique == 'Y'){//单件,只减一件
|
|
|
|
- var cloth = applyCloths[applyCloths.length - 1]
|
|
|
|
- coupon.orderCouponClothDTOS.push({clothIndex:cloth.index,id:cloth.id,deductAmount:(cloth.totalPrice - cloth.deductAmount),clothName:this.calculateClothNameByInfo(cloth)})
|
|
|
|
- cloth.deductAmount = cloth.totalPrice
|
|
|
|
- }else{//非单件,可减多件
|
|
|
|
- var count = parseInt(applyCloths.length/parseInt(coupon.minAmount))*parseInt(coupon.deductAmount)
|
|
|
|
- for (let i = 0; i < count; i++) {
|
|
|
|
- var cloth = applyCloths[applyCloths.length - 1 - i]
|
|
|
|
- coupon.orderCouponClothDTOS.push({clothIndex:cloth.index,id:cloth.id,deductAmount:(cloth.totalPrice - cloth.deductAmount),clothName:this.calculateClothNameByInfo(cloth)})
|
|
|
|
- cloth.deductAmount = cloth.totalPrice
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- this.deductCouponVOS.splice(index,1)
|
|
|
|
- this.selectCoupons.push(coupon)
|
|
|
|
- console.log(this.selectCoupons)
|
|
|
|
- this.setCouponOpen = false
|
|
|
|
- this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
|
|
|
|
- },
|
|
|
|
- //去除已选择的优惠券
|
|
|
|
- removeSelectCoupon(index){
|
|
|
|
- var coupon = this.selectCoupons[index]
|
|
|
|
- //将优惠券放回未选择的数组中
|
|
|
|
- if(coupon.discountWay == '2'){
|
|
|
|
- this.discountCouponVOS.push(coupon)
|
|
|
|
- }else{
|
|
|
|
- this.deductCouponVOS.push(coupon)
|
|
|
|
- }
|
|
|
|
- this.selectCoupons.splice(index,1)
|
|
|
|
|
|
+ //找出优惠券适配优惠的衣服
|
|
|
|
+ var applyCloths = []
|
|
|
|
+ coupon.appCouponTypeApplyClothVOS.forEach((item) => {
|
|
|
|
+ for (let i = 0; i < this.orderClothItemDTOS.length; i++) {
|
|
|
|
+ var cloth = this.orderClothItemDTOS[i]
|
|
|
|
+ if (cloth.id != item.clothItemId || cloth.totalPrice - cloth.deductAmount <= 0) {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ applyCloths.push(cloth)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ //排序,按照订单剩余需要支付的金额降序
|
|
|
|
+ applyCloths.sort((a, b) => {
|
|
|
|
+ return b.totalPrice - b.deductAmount - (a.totalPrice - a.deductAmount)
|
|
|
|
+ })
|
|
|
|
+ console.log('applyCloths:' + JSON.stringify(applyCloths))
|
|
|
|
+ if (coupon.discountWay == '0') {
|
|
|
|
+ //抵扣
|
|
|
|
+ if (coupon.isUnique == 'Y') {
|
|
|
|
+ //单件,只减一件
|
|
|
|
+ var cloth = applyCloths[0]
|
|
|
|
+ //抵扣所有衣服里金额最大的
|
|
|
|
+ if (cloth.totalPrice - cloth.deductAmount >= coupon.deductAmount) {
|
|
|
|
+ coupon.orderCouponClothDTOS.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: coupon.deductAmount, clothName: this.calculateClothNameByInfo(cloth) })
|
|
|
|
+ cloth.deductAmount += coupon.deductAmount
|
|
|
|
+ } else {
|
|
|
|
+ coupon.orderCouponClothDTOS.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: cloth.totalPrice - cloth.deductAmount, clothName: this.calculateClothNameByInfo(cloth) })
|
|
|
|
+ cloth.deductAmount = cloth.totalPrice
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //非单件,可减多件
|
|
|
|
+ var deductAmount = coupon.deductAmount
|
|
|
|
+ for (let i = 0; i < applyCloths.length; i++) {
|
|
|
|
+ //如果优惠券可抵扣金额用完
|
|
|
|
+ if (deductAmount <= 0) {
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ var cloth = applyCloths[i]
|
|
|
|
+ if (cloth.totalPrice - cloth.deductAmount >= deductAmount) {
|
|
|
|
+ coupon.orderCouponClothDTOS.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: deductAmount, clothName: this.calculateClothNameByInfo(cloth) })
|
|
|
|
+ cloth.deductAmount += deductAmount
|
|
|
|
+ deductAmount = 0
|
|
|
|
+ } else {
|
|
|
|
+ coupon.orderCouponClothDTOS.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: cloth.totalPrice - cloth.deductAmount, clothName: this.calculateClothNameByInfo(cloth) })
|
|
|
|
+ cloth.deductAmount = cloth.totalPrice
|
|
|
|
+ deductAmount -= cloth.totalPrice - cloth.deductAmount
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if (coupon.discountWay == '1') {
|
|
|
|
+ //满减
|
|
|
|
+ if (applyCloths.length < parseInt(coupon.minAmount)) {
|
|
|
|
+ //未满足满减条件
|
|
|
|
+ this.$message.error('未满足满减条件')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (coupon.isUnique == 'Y') {
|
|
|
|
+ //单件,只减一件
|
|
|
|
+ var cloth = applyCloths[applyCloths.length - 1]
|
|
|
|
+ coupon.orderCouponClothDTOS.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: cloth.totalPrice - cloth.deductAmount, clothName: this.calculateClothNameByInfo(cloth) })
|
|
|
|
+ cloth.deductAmount = cloth.totalPrice
|
|
|
|
+ } else {
|
|
|
|
+ //非单件,可减多件
|
|
|
|
+ var count = parseInt(applyCloths.length / parseInt(coupon.minAmount)) * parseInt(coupon.deductAmount)
|
|
|
|
+ for (let i = 0; i < count; i++) {
|
|
|
|
+ var cloth = applyCloths[applyCloths.length - 1 - i]
|
|
|
|
+ coupon.orderCouponClothDTOS.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: cloth.totalPrice - cloth.deductAmount, clothName: this.calculateClothNameByInfo(cloth) })
|
|
|
|
+ cloth.deductAmount = cloth.totalPrice
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.deductCouponVOS.splice(index, 1)
|
|
|
|
+ this.selectCoupons.push(coupon)
|
|
|
|
+ console.log(this.selectCoupons)
|
|
|
|
+ this.setCouponOpen = false
|
|
|
|
+ this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
|
|
|
|
+ },
|
|
|
|
+ //去除已选择的优惠券
|
|
|
|
+ removeSelectCoupon(index) {
|
|
|
|
+ var coupon = this.selectCoupons[index]
|
|
|
|
+ //将优惠券放回未选择的数组中
|
|
|
|
+ if (coupon.discountWay == '2') {
|
|
|
|
+ this.discountCouponVOS.push(coupon)
|
|
|
|
+ } else {
|
|
|
|
+ this.deductCouponVOS.push(coupon)
|
|
|
|
+ }
|
|
|
|
+ this.selectCoupons.splice(index, 1)
|
|
|
|
|
|
- //重置这条优惠券给衣服的优惠信息
|
|
|
|
- var orderCouponClothDTOS = coupon.orderCouponClothDTOS
|
|
|
|
- coupon.orderCouponClothDTOS = []
|
|
|
|
- orderCouponClothDTOS.forEach(selectItem => {
|
|
|
|
- this.calculateClothDiscountAmount(selectItem.clothIndex)
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- /** 提交按钮 */
|
|
|
|
- async submitForm() {
|
|
|
|
- this.$refs["confirmPayForm"].validate(valid => {
|
|
|
|
- if (valid) {
|
|
|
|
- var params = {...this.orderForm}
|
|
|
|
- params.appUserId = this.appUserInfo.id
|
|
|
|
- params.orderClothItemDTOS = this.orderClothItemDTOS.concat()
|
|
|
|
- params.orderClothItemDTOS.forEach(item => {
|
|
|
|
- item.clothItemName = item.name
|
|
|
|
- })
|
|
|
|
- var orderCouponDTOS = this.selectCoupons.concat()
|
|
|
|
- if(this.orderForm.discountCouponId){
|
|
|
|
- var coupon = this.discountCouponVOS.find(item => item.id=this.orderForm.discountCouponId)
|
|
|
|
- var orderCouponClothDTOS = []
|
|
|
|
- this.getDiscountClothList().forEach(item => {
|
|
|
|
- var orderCouponClothDTO = {id:item.id,clothIndex:item.index,deductAmount:(parseInt((item.totalPrice - item.deductAmount)*100*parseInt(100 - coupon.deductAmount * 100))/10000)}
|
|
|
|
- orderCouponClothDTOS.push(orderCouponClothDTO)
|
|
|
|
|
|
+ //重置这条优惠券给衣服的优惠信息
|
|
|
|
+ var orderCouponClothDTOS = coupon.orderCouponClothDTOS
|
|
|
|
+ coupon.orderCouponClothDTOS = []
|
|
|
|
+ orderCouponClothDTOS.forEach((selectItem) => {
|
|
|
|
+ this.calculateClothDiscountAmount(selectItem.clothIndex)
|
|
})
|
|
})
|
|
- orderCouponDTOS.push({id:coupon.id,...{orderCouponClothDTOS:orderCouponClothDTOS}})
|
|
|
|
- }
|
|
|
|
- params.orderCouponDTOS = orderCouponDTOS
|
|
|
|
- params.isSpecial = params.isSpecial?'Y':'N'
|
|
|
|
- params.payTimeType = '0'
|
|
|
|
- const loading = this.$loading({
|
|
|
|
- lock: true,
|
|
|
|
- text: 'Loading',
|
|
|
|
- spinner: 'el-icon-loading',
|
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
- });
|
|
|
|
- collectCloth(params).then(res => {
|
|
|
|
- this.$message('提交成功')
|
|
|
|
- loading.close();
|
|
|
|
- this.$emit('onPaySuccess', res.data)
|
|
|
|
- }).catch(e => {
|
|
|
|
- loading.close()
|
|
|
|
- this.$message.error(e.data.msg)
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- removeCouponRelateCloth(index){
|
|
|
|
- var cloth = this.changeDiscountCouponSelectCloths[index].cloth
|
|
|
|
- cloth.deductAmount = cloth.deductAmount - this.changeDiscountCouponSelectCloths[index].deductAmount
|
|
|
|
- this.changeDiscountCouponCanSelectCloths.push(cloth)
|
|
|
|
- this.changeDiscountCouponSelectCloths.splice(index,1)
|
|
|
|
- },
|
|
|
|
- //选择优惠券关联的衣服
|
|
|
|
- addCouponRelateCloth(index){
|
|
|
|
- var hasDeductAmount = this.calculateCouponDiscountInfo()
|
|
|
|
- if(this.selectCoupons[this.changeDiscountCouponIndex].deductAmount - hasDeductAmount <= 0){
|
|
|
|
- this.$message.error('抵扣金额已用完,无法抵扣其他衣物')
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if(this.selectCoupons[this.changeDiscountCouponIndex].isUnique == 'Y' && this.changeDiscountCouponSelectCloths.length > 0){
|
|
|
|
- this.$message.error('该优惠券为单件抵扣,无法抵扣第二件衣物')
|
|
|
|
- }
|
|
|
|
- var coupon = this.selectCoupons[this.changeDiscountCouponIndex]
|
|
|
|
- var cloth = this.changeDiscountCouponCanSelectCloths[index]
|
|
|
|
|
|
+ },
|
|
|
|
+ /** 提交按钮 */
|
|
|
|
+ async submitForm() {
|
|
|
|
+ this.$refs['confirmPayForm'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ var params = { ...this.orderForm }
|
|
|
|
+ params.appUserId = this.appUserInfo.id
|
|
|
|
+ params.orderClothItemDTOS = this.orderClothItemDTOS.concat()
|
|
|
|
+ params.orderClothItemDTOS.forEach((item) => {
|
|
|
|
+ item.clothItemName = item.name
|
|
|
|
+ })
|
|
|
|
+ var orderCouponDTOS = this.selectCoupons.concat()
|
|
|
|
+ if (this.orderForm.discountCouponId) {
|
|
|
|
+ var coupon = this.discountCouponVOS.find((item) => (item.id = this.orderForm.discountCouponId))
|
|
|
|
+ var orderCouponClothDTOS = []
|
|
|
|
+ this.getDiscountClothList().forEach((item) => {
|
|
|
|
+ var orderCouponClothDTO = { id: item.id, clothIndex: item.index, deductAmount: parseInt((item.totalPrice - item.deductAmount) * 100 * parseInt(100 - coupon.deductAmount * 100)) / 10000 }
|
|
|
|
+ orderCouponClothDTOS.push(orderCouponClothDTO)
|
|
|
|
+ })
|
|
|
|
+ orderCouponDTOS.push({ id: coupon.id, ...{ orderCouponClothDTOS: orderCouponClothDTOS } })
|
|
|
|
+ }
|
|
|
|
+ params.orderCouponDTOS = orderCouponDTOS
|
|
|
|
+ params.isSpecial = params.isSpecial ? 'Y' : 'N'
|
|
|
|
+ params.payTimeType = '0'
|
|
|
|
+ const loading = this.$loading({
|
|
|
|
+ lock: true,
|
|
|
|
+ text: 'Loading',
|
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
+ })
|
|
|
|
+ collectCloth(params)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message('提交成功')
|
|
|
|
+ loading.close()
|
|
|
|
+ this.$emit('onPaySuccess', res.data)
|
|
|
|
+ })
|
|
|
|
+ .catch((e) => {
|
|
|
|
+ loading.close()
|
|
|
|
+ this.$message.error(e.data.msg)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ removeCouponRelateCloth(index) {
|
|
|
|
+ var cloth = this.changeDiscountCouponSelectCloths[index].cloth
|
|
|
|
+ cloth.deductAmount = cloth.deductAmount - this.changeDiscountCouponSelectCloths[index].deductAmount
|
|
|
|
+ this.changeDiscountCouponCanSelectCloths.push(cloth)
|
|
|
|
+ this.changeDiscountCouponSelectCloths.splice(index, 1)
|
|
|
|
+ },
|
|
|
|
+ //选择优惠券关联的衣服
|
|
|
|
+ addCouponRelateCloth(index) {
|
|
|
|
+ var hasDeductAmount = this.calculateCouponDiscountInfo()
|
|
|
|
+ if (this.selectCoupons[this.changeDiscountCouponIndex].deductAmount - hasDeductAmount <= 0) {
|
|
|
|
+ this.$message.error('抵扣金额已用完,无法抵扣其他衣物')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (this.selectCoupons[this.changeDiscountCouponIndex].isUnique == 'Y' && this.changeDiscountCouponSelectCloths.length > 0) {
|
|
|
|
+ this.$message.error('该优惠券为单件抵扣,无法抵扣第二件衣物')
|
|
|
|
+ }
|
|
|
|
+ var coupon = this.selectCoupons[this.changeDiscountCouponIndex]
|
|
|
|
+ var cloth = this.changeDiscountCouponCanSelectCloths[index]
|
|
|
|
|
|
- if(coupon.isUnique == 'Y') {//单件,只减一件
|
|
|
|
- //抵扣所有衣服里金额最大的
|
|
|
|
- if((cloth.totalPrice - cloth.deductAmount) >= coupon.deductAmount){
|
|
|
|
- this.changeDiscountCouponSelectCloths.push({clothIndex:cloth.index,id:cloth.id,deductAmount:coupon.deductAmount,clothName:this.calculateClothNameByInfo(cloth),cloth:cloth})
|
|
|
|
- cloth.deductAmount += coupon.deductAmount
|
|
|
|
- }else{
|
|
|
|
- this.changeDiscountCouponSelectCloths.push({clothIndex:cloth.index,id:cloth.id,deductAmount:(cloth.totalPrice - cloth.deductAmount),clothName:this.calculateClothNameByInfo(cloth),cloth:cloth})
|
|
|
|
- cloth.deductAmount = cloth.totalPrice
|
|
|
|
- }
|
|
|
|
- }else{//非单件,可减多件
|
|
|
|
- var deductAmount = this.selectCoupons[this.changeDiscountCouponIndex].deductAmount - hasDeductAmount
|
|
|
|
- if((cloth.totalPrice - cloth.deductAmount) >= deductAmount){
|
|
|
|
- this.changeDiscountCouponSelectCloths.push({clothIndex:cloth.index,id:cloth.id,deductAmount:deductAmount,clothName:this.calculateClothNameByInfo(cloth),cloth:cloth})
|
|
|
|
- cloth.deductAmount += deductAmount
|
|
|
|
- }else{
|
|
|
|
- this.changeDiscountCouponSelectCloths.push({clothIndex:cloth.index,id:cloth.id,deductAmount:(cloth.totalPrice - cloth.deductAmount),clothName:this.calculateClothNameByInfo(cloth),cloth:cloth})
|
|
|
|
- cloth.deductAmount = cloth.totalPrice
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if (coupon.isUnique == 'Y') {
|
|
|
|
+ //单件,只减一件
|
|
|
|
+ //抵扣所有衣服里金额最大的
|
|
|
|
+ if (cloth.totalPrice - cloth.deductAmount >= coupon.deductAmount) {
|
|
|
|
+ this.changeDiscountCouponSelectCloths.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: coupon.deductAmount, clothName: this.calculateClothNameByInfo(cloth), cloth: cloth })
|
|
|
|
+ cloth.deductAmount += coupon.deductAmount
|
|
|
|
+ } else {
|
|
|
|
+ this.changeDiscountCouponSelectCloths.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: cloth.totalPrice - cloth.deductAmount, clothName: this.calculateClothNameByInfo(cloth), cloth: cloth })
|
|
|
|
+ cloth.deductAmount = cloth.totalPrice
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //非单件,可减多件
|
|
|
|
+ var deductAmount = this.selectCoupons[this.changeDiscountCouponIndex].deductAmount - hasDeductAmount
|
|
|
|
+ if (cloth.totalPrice - cloth.deductAmount >= deductAmount) {
|
|
|
|
+ this.changeDiscountCouponSelectCloths.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: deductAmount, clothName: this.calculateClothNameByInfo(cloth), cloth: cloth })
|
|
|
|
+ cloth.deductAmount += deductAmount
|
|
|
|
+ } else {
|
|
|
|
+ this.changeDiscountCouponSelectCloths.push({ clothIndex: cloth.index, id: cloth.id, deductAmount: cloth.totalPrice - cloth.deductAmount, clothName: this.calculateClothNameByInfo(cloth), cloth: cloth })
|
|
|
|
+ cloth.deductAmount = cloth.totalPrice
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- this.changeDiscountCouponCanSelectCloths.splice(index,1)
|
|
|
|
- },
|
|
|
|
- submitChangeCouponRelateCloth(){
|
|
|
|
- this.selectCoupons[this.changeDiscountCouponIndex].orderCouponClothDTOS = this.changeDiscountCouponSelectCloths
|
|
|
|
- this.changeDiscountCouponCanSelectCloths.forEach(item => {
|
|
|
|
- this.calculateClothDiscountAmount(item.index)
|
|
|
|
- })
|
|
|
|
- this.changeDiscountCouponSelectCloths.forEach(item => {
|
|
|
|
- this.calculateClothDiscountAmount(item.clothIndex)
|
|
|
|
- })
|
|
|
|
- this.selectCoupons = this.selectCoupons.concat()
|
|
|
|
- this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
|
|
|
|
- this.changeDiscountCouponOpen = false
|
|
|
|
- },
|
|
|
|
- //计算某一件衣服的优惠金额,并配置到orderClothItemDTOS中
|
|
|
|
- calculateClothDiscountAmount(index){
|
|
|
|
- var cloth = this.orderClothItemDTOS[index]
|
|
|
|
- cloth.deductAmount = 0
|
|
|
|
- this.selectCoupons.forEach(i => {
|
|
|
|
- var selectCloth = i.orderCouponClothDTOS.find(item => item.clothIndex == cloth.index)
|
|
|
|
- if(selectCloth){
|
|
|
|
- cloth.deductAmount = cloth.deductAmount + selectCloth.deductAmount
|
|
|
|
|
|
+ this.changeDiscountCouponCanSelectCloths.splice(index, 1)
|
|
|
|
+ },
|
|
|
|
+ submitChangeCouponRelateCloth() {
|
|
|
|
+ this.selectCoupons[this.changeDiscountCouponIndex].orderCouponClothDTOS = this.changeDiscountCouponSelectCloths
|
|
|
|
+ this.changeDiscountCouponCanSelectCloths.forEach((item) => {
|
|
|
|
+ this.calculateClothDiscountAmount(item.index)
|
|
|
|
+ })
|
|
|
|
+ this.changeDiscountCouponSelectCloths.forEach((item) => {
|
|
|
|
+ this.calculateClothDiscountAmount(item.clothIndex)
|
|
|
|
+ })
|
|
|
|
+ this.selectCoupons = this.selectCoupons.concat()
|
|
|
|
+ this.orderClothItemDTOS = this.orderClothItemDTOS.concat()
|
|
|
|
+ this.changeDiscountCouponOpen = false
|
|
|
|
+ },
|
|
|
|
+ //计算某一件衣服的优惠金额,并配置到orderClothItemDTOS中
|
|
|
|
+ calculateClothDiscountAmount(index) {
|
|
|
|
+ var cloth = this.orderClothItemDTOS[index]
|
|
|
|
+ cloth.deductAmount = 0
|
|
|
|
+ this.selectCoupons.forEach((i) => {
|
|
|
|
+ var selectCloth = i.orderCouponClothDTOS.find((item) => item.clothIndex == cloth.index)
|
|
|
|
+ if (selectCloth) {
|
|
|
|
+ cloth.deductAmount = cloth.deductAmount + selectCloth.deductAmount
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ checkClose(done) {
|
|
|
|
+ this.$confirm('是否关闭表单,关闭后数据将丢失?')
|
|
|
|
+ .then(function () {
|
|
|
|
+ done()
|
|
|
|
+ })
|
|
|
|
+ .then(() => {})
|
|
|
|
+ .catch(() => {})
|
|
}
|
|
}
|
|
- })
|
|
|
|
- },
|
|
|
|
- checkClose(done) {
|
|
|
|
- this.$confirm('是否关闭表单,关闭后数据将丢失?').then(function() {
|
|
|
|
- done()
|
|
|
|
- }).then(() => {}).catch(() => {});
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
|
-
|
|
|
|
-</style>
|
|
|
|
|
|
+<style scoped></style>
|