|
|
@@ -17,13 +17,13 @@
|
|
|
<view class="list" v-for="(res,i) in product" :key="i">
|
|
|
<view class="flex list-title" >
|
|
|
<text class="product-name">{{res.name}}</text>
|
|
|
- <text class="product-num">{{ `${parseFloat(res.xhNum)}` }}{{res.xhUnitName}}</text>
|
|
|
- <text class="product-price">{{`${parseFloat(res.xhUnitPrice)}`}}元/{{res.xhUnitName}}</text>
|
|
|
+ <text class="product-num">{{ `${parseFloat(res.itemNum)}` }}{{res.bigUnit}}</text>
|
|
|
+ <text class="product-price">{{`${parseFloat(res.bigPrice)}`}}元/{{res.bigUnit}}</text>
|
|
|
</view>
|
|
|
<view class="flex list-val" style="font-size:26upx;font-weight:bold;">
|
|
|
<input type="number" placeholder="退货数" v-model="res.refundCount" placeholder-style="color:#CCCCCC" />
|
|
|
- <text style="margin-left:10upx;">{{res.xhUnitName}}</text>
|
|
|
- <text style="color:green;margin-left:20upx;">可退{{Number(res.xhNum)-Number(res.refundNum)}}{{res.xhUnitName}}</text>
|
|
|
+ <text style="margin-left:10upx;">{{res.bigUnit}}</text>
|
|
|
+ <text style="color:green;margin-left:20upx;">可退{{Number(res.itemNum)-Number(res.refundNum)}}{{res.bigUnit}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -59,7 +59,8 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
-import { getDetail,refund } from "@/api/order/index";
|
|
|
+import { getPurchaseDetailApi } from "@/api/purchase";
|
|
|
+import { createOrder } from "@/api/cg-refund"
|
|
|
export default {
|
|
|
name: "refund",
|
|
|
components: {
|
|
|
@@ -79,12 +80,11 @@ export default {
|
|
|
},
|
|
|
computed:{
|
|
|
refundPrice(){
|
|
|
- console.log('tttt')
|
|
|
let price = 0
|
|
|
if(this.product){
|
|
|
for (const item of this.product) {
|
|
|
if(Number(item.refundCount)>0){
|
|
|
- let currentPrice = Number(item.refundCount)*Number(item.xhUnitPrice)
|
|
|
+ let currentPrice = Number(item.refundCount)*Number(item.bigPrice)
|
|
|
currentPrice.toFixed(2)
|
|
|
price = Number(price) + Number(currentPrice)
|
|
|
price.toFixed(2)
|
|
|
@@ -108,7 +108,7 @@ export default {
|
|
|
let that = this
|
|
|
this.product.forEach(ele=>{
|
|
|
let currentRefundCont = ele.refundCount ? Number(ele.refundCount) :0
|
|
|
- let currentNum = ele.xhNum ? Number(ele.xhNum) : 0
|
|
|
+ let currentNum = ele.itemNum ? Number(ele.itemNum) : 0
|
|
|
let hasRefundNum = ele.refundNum ? Number(ele.refundNum) : 0
|
|
|
let couldRefundNum = Number(currentNum) - Number(hasRefundNum)
|
|
|
if(Number(currentRefundCont) > Number(couldRefundNum)){
|
|
|
@@ -118,12 +118,11 @@ export default {
|
|
|
}
|
|
|
if(Number(ele.refundCount)>0){
|
|
|
product.push({
|
|
|
- "productId":ele.productId,
|
|
|
- "num":ele.refundCount,
|
|
|
- "unitType":ele.unitType,
|
|
|
- unitName:ele.xhUnitName,
|
|
|
- unitType:ele.xhUnitType,
|
|
|
- unitPrice:ele.xhUnitPrice
|
|
|
+ productId:ele.productId,
|
|
|
+ num:ele.refundCount,
|
|
|
+ unitType:0,
|
|
|
+ unitName:ele.bigUnit,
|
|
|
+ unitPrice:ele.bigPrice
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
@@ -131,20 +130,19 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
if(this.$util.isEmpty(product)&&this.refundType==1){
|
|
|
- uni.showToast({title:'请选择商品',icon:'none'})
|
|
|
+ uni.showToast({title:'请选择花材',icon:'none'})
|
|
|
return;
|
|
|
}
|
|
|
let refundParams = {
|
|
|
- id:this.option.id,
|
|
|
+ id:this.orderInfo.id,
|
|
|
product:JSON.stringify(product),
|
|
|
price:this.refundMoney,
|
|
|
remark:this.remark,
|
|
|
- refundType:this.refundType,
|
|
|
- getOriginalItem:1
|
|
|
+ refundType:this.refundType
|
|
|
};
|
|
|
- that.$util.confirmModal({content:'确认退款?'},() => {
|
|
|
+ that.$util.confirmModal({content:'确认申请?'},() => {
|
|
|
uni.showLoading({title: "提交中",mask:true})
|
|
|
- refund(refundParams).then(res => {
|
|
|
+ createOrder(refundParams).then(res => {
|
|
|
if(res.code == 1){
|
|
|
uni.hideLoading()
|
|
|
uni.navigateTo({url:'/common/success',query:{titleType:1}})
|
|
|
@@ -153,15 +151,15 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
async init() {
|
|
|
- //getOriginalItem 取原有的花材结构(小菊的花材结构有变化)
|
|
|
- const res = await getDetail({ id: this.option.id,getOriginalItem:1 })
|
|
|
+
|
|
|
+ const res = await getPurchaseDetailApi(this.option.orderSn)
|
|
|
this.orderInfo = res.data
|
|
|
-
|
|
|
+
|
|
|
this.couldRefundPrice = Number(res.data.orderPrice) - Number(res.data.tkPrice)
|
|
|
this.couldRefundPrice = this.couldRefundPrice.toFixed(2)
|
|
|
this.couldRefundPrice = parseFloat(this.couldRefundPrice)
|
|
|
|
|
|
- this.product = res.data.product.map(ele=>{
|
|
|
+ this.product = res.data.itemInfo.map(ele=>{
|
|
|
return {...ele,refundCount:null}
|
|
|
})
|
|
|
}
|