代码提交
This commit is contained in:
@ -58,6 +58,21 @@
|
||||
</Goods>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 选中了的结算统计信息 -->
|
||||
<view :class="{'select-product-settle-info':true,show:goodsSelect.length>0}">
|
||||
<view
|
||||
class="row flex flex-ai__center flex-jc__sb"
|
||||
v-for="(item,index) in settleFields"
|
||||
:key="index"
|
||||
>
|
||||
<view class="label">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
<view v-if="statisticsInfo">
|
||||
{{ item.prefix }} {{ statisticsInfo[item.field].toFixed(2) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</card>
|
||||
</space>
|
||||
</uv-checkbox-group>
|
||||
@ -70,6 +85,7 @@
|
||||
>
|
||||
<uv-checkbox
|
||||
name="all"
|
||||
:disabled="allDisabled"
|
||||
:checked="goodsSelectAll"
|
||||
@change="handleGoodsSelectAll"
|
||||
>
|
||||
@ -81,7 +97,7 @@
|
||||
{{ goodsSelect.length }} 件商品
|
||||
</view>
|
||||
<view class="action-total">
|
||||
总计:¥{{ totalPrice }}
|
||||
总计:¥{{ statisticsInfo.totalPrice.toFixed(2) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="action-btns">
|
||||
@ -110,17 +126,23 @@ import { applyForAfterSalesInfo } from '@/api/order'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useRouter } from "@/hooks/useRouter";
|
||||
import Goods from "@/components/goodsComponents/Goods.vue";
|
||||
import { settleFields } from "@/pages/selectRefundGood/index.data";
|
||||
|
||||
const {getParams, push, goBack} = useRouter()
|
||||
const goodsList = ref([])
|
||||
const goodsSelect = ref([])
|
||||
const goodsSelectAll = ref(false)
|
||||
const totalPrice = ref(0);
|
||||
const orderId = ref(null)
|
||||
const id = ref(null)
|
||||
const refundType = ref(null)
|
||||
const status = ref(0)
|
||||
|
||||
const allDisabled = ref(true)
|
||||
const statisticsInfo = ref({
|
||||
truePrice: 0,
|
||||
couponPrice: 0,
|
||||
postagePrice: 0,
|
||||
totalPrice: 0
|
||||
})
|
||||
|
||||
const handleGoodsSelectAll = (e) => {
|
||||
goodsSelectAll.value = e
|
||||
@ -128,26 +150,46 @@ const handleGoodsSelectAll = (e) => {
|
||||
goodsSelect.value = []
|
||||
return
|
||||
}
|
||||
goodsSelect.value = goodsList.value.map(item => item.cartInfo.productAttrUnique)
|
||||
goodsSelect.value = goodsList.value.filter(item=> item.isAfterSales === 1).map(item => item.cartInfo.productAttrUnique)
|
||||
}
|
||||
|
||||
const handleGoodsSelect = (value) => {
|
||||
goodsSelectAll.value = value.length === goodsList.value.length
|
||||
goodsSelectAll.value = value.length === goodsList.value.filter(item=> item.isAfterSales === 1).length
|
||||
}
|
||||
|
||||
watch(goodsSelect, (goodsSelect) => {
|
||||
let price = 0
|
||||
statisticsInfo.value = {
|
||||
truePrice: 0,
|
||||
couponPrice: 0,
|
||||
postagePrice: 0,
|
||||
totalPrice: 0
|
||||
}
|
||||
let postagePrice = 0
|
||||
goodsList.value.filter(item => goodsSelect.includes(item.cartInfo.productAttrUnique)).forEach(item => {
|
||||
price += item.cartInfo.truePrice * item.cartInfo.cartNum
|
||||
statisticsInfo.value.truePrice += item.cartInfo.truePrice * item.cartInfo.cartNum
|
||||
statisticsInfo.value.couponPrice += item.cartInfo.couponPrice
|
||||
postagePrice += item.cartInfo.postagePrice
|
||||
})
|
||||
|
||||
totalPrice.value = price.toFixed(2)
|
||||
statisticsInfo.value.totalPrice = statisticsInfo.value.truePrice - statisticsInfo.value.couponPrice
|
||||
// 未发货退邮费
|
||||
if(status.value === 0){
|
||||
statisticsInfo.value.postagePrice = postagePrice
|
||||
statisticsInfo.value.totalPrice += statisticsInfo.value.postagePrice
|
||||
}
|
||||
})
|
||||
|
||||
const handleOrderInfo = async (option) => {
|
||||
const res = await applyForAfterSalesInfo(option)
|
||||
// orderInfoData.value = res
|
||||
goodsList.value = res
|
||||
orderId.value = res[0].orderId
|
||||
status.value = res[0].status
|
||||
for(let i=0;i<res.length;i++){
|
||||
if(res[i].isAfterSales === 1){
|
||||
allDisabled.value = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -171,9 +213,7 @@ const toRefund = (type) => {
|
||||
|
||||
onLoad((options) => {
|
||||
const params = getParams(options)
|
||||
orderId.value = params.orderId
|
||||
id.value = params.id
|
||||
status.value = params.status
|
||||
handleOrderInfo({
|
||||
key: params.id
|
||||
})
|
||||
@ -183,8 +223,6 @@ onLoad((options) => {
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.shopping-checkbox {
|
||||
}
|
||||
|
||||
.shopping-action {
|
||||
padding-left: 34rpx;
|
||||
|
Reference in New Issue
Block a user