代码提交
This commit is contained in:
@ -1,38 +1,38 @@
|
||||
<template>
|
||||
<layout>
|
||||
<uv-navbar
|
||||
:fixed="false"
|
||||
title="选择商品"
|
||||
left-arrow
|
||||
@leftClick="$onClickLeft"
|
||||
:fixed="false"
|
||||
title="选择商品"
|
||||
left-arrow
|
||||
@leftClick="goBack"
|
||||
/>
|
||||
<uv-checkbox-group
|
||||
v-if="goodsList"
|
||||
v-model="goodsSelect"
|
||||
@change="handleGoodsSelect"
|
||||
v-if="goodsList"
|
||||
v-model="goodsSelect"
|
||||
shape="circle"
|
||||
activeColor="#ec6e47"
|
||||
@change="handleGoodsSelect"
|
||||
>
|
||||
<space
|
||||
direction="vertical"
|
||||
fill
|
||||
direction="vertical"
|
||||
fill
|
||||
>
|
||||
<card class="shopping-checkbox">
|
||||
<view
|
||||
v-for="(item, index) in goodsList"
|
||||
class="shopping-checkbox-cell"
|
||||
v-for="(item, index) in goodsList"
|
||||
class="shopping-checkbox-cell"
|
||||
>
|
||||
<uv-checkbox
|
||||
:name="item.id"
|
||||
v-model="goodsSelect"
|
||||
checked-color="#ee0a24"
|
||||
:disabled="item.isAfterSales != 1"
|
||||
:name="item.cartInfo.productAttrUnique"
|
||||
:disabled="item.isAfterSales != 1"
|
||||
/>
|
||||
<goods
|
||||
list
|
||||
interval
|
||||
showAction
|
||||
model
|
||||
:price="item.cartInfo.productInfo.price"
|
||||
:data="item.cartInfo.productInfo"
|
||||
list
|
||||
interval
|
||||
showAction
|
||||
model
|
||||
:price="item.cartInfo.truePrice"
|
||||
:data="item.cartInfo.productInfo"
|
||||
>
|
||||
</goods>
|
||||
</view>
|
||||
@ -42,12 +42,14 @@
|
||||
<view class="action-bar column">
|
||||
<view class="action-info">
|
||||
<view class="action-checkbox">
|
||||
<uv-checkbox-group>
|
||||
<uv-checkbox-group
|
||||
shape="circle"
|
||||
activeColor="#ec6e47"
|
||||
>
|
||||
<uv-checkbox
|
||||
name="all"
|
||||
:checked="goodsSelectAll"
|
||||
checked-color="#ee0a24"
|
||||
@change="handleGoodsSelectAll"
|
||||
name="all"
|
||||
:checked="goodsSelectAll"
|
||||
@change="handleGoodsSelectAll"
|
||||
>
|
||||
全选
|
||||
</uv-checkbox>
|
||||
@ -57,21 +59,23 @@
|
||||
{{ goodsSelect.length }} 件商品
|
||||
</view>
|
||||
<view class="action-total">
|
||||
|
||||
总计:¥{{ totalPrice }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="action-btns">
|
||||
<uv-button
|
||||
type="primary"
|
||||
text="仅退款"
|
||||
@click="toRefund(0)"
|
||||
></uv-button>
|
||||
<uv-button
|
||||
type="primary"
|
||||
text="退货退款"
|
||||
@click="toRefund(1)"
|
||||
></uv-button>
|
||||
<view
|
||||
class="button only-button"
|
||||
@click="toRefund(0)"
|
||||
>
|
||||
仅退款
|
||||
</view>
|
||||
<view
|
||||
v-if="status !== 0"
|
||||
class="button"
|
||||
@click="toRefund(1)"
|
||||
>
|
||||
退货退款
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</layout>
|
||||
@ -81,9 +85,10 @@
|
||||
|
||||
import { ref, watch } from 'vue'
|
||||
import { applyForAfterSalesInfo } from '@/api/order'
|
||||
import { navigateTo } from '@/utils/router'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useRouter } from "@/hooks/useRouter";
|
||||
|
||||
const {getParams, push, goBack} = useRouter()
|
||||
const goodsList = ref([])
|
||||
const goodsSelect = ref([])
|
||||
const goodsSelectAll = ref(false)
|
||||
@ -91,6 +96,7 @@ const totalPrice = ref(0);
|
||||
const orderId = ref(null)
|
||||
const id = ref(null)
|
||||
const refundType = ref(null)
|
||||
const status = ref(0)
|
||||
|
||||
|
||||
const handleGoodsSelectAll = (e) => {
|
||||
@ -99,17 +105,16 @@ const handleGoodsSelectAll = (e) => {
|
||||
goodsSelect.value = []
|
||||
return
|
||||
}
|
||||
|
||||
goodsSelect.value = goodsList.value.map(item => item.id)
|
||||
goodsSelect.value = goodsList.value.map(item => item.cartInfo.productAttrUnique)
|
||||
}
|
||||
|
||||
const handleGoodsSelect = (value) => {
|
||||
goodsSelectAll.value = value.length == goodsList.value.length
|
||||
goodsSelectAll.value = value.length === goodsList.value.length
|
||||
}
|
||||
|
||||
watch(goodsSelect, (goodsSelect) => {
|
||||
let price = 0
|
||||
goodsList.value.filter(item => goodsSelect.includes(item.id)).forEach(item => {
|
||||
goodsList.value.filter(item => goodsSelect.includes(item.cartInfo.productAttrUnique)).forEach(item => {
|
||||
price += item.cartInfo.truePrice * item.cartInfo.cartNum
|
||||
})
|
||||
|
||||
@ -118,7 +123,6 @@ watch(goodsSelect, (goodsSelect) => {
|
||||
|
||||
const handleOrderInfo = async (option) => {
|
||||
const res = await applyForAfterSalesInfo(option)
|
||||
console.log("gxs --> % handleOrderInfo % res:\n", res)
|
||||
// orderInfoData.value = res
|
||||
goodsList.value = res
|
||||
}
|
||||
@ -130,10 +134,8 @@ const toRefund = (type) => {
|
||||
}
|
||||
|
||||
refundType.value = type
|
||||
|
||||
navigateTo({
|
||||
url: '/pages/refund/refund',
|
||||
query: {
|
||||
push({url: '/pages/refund/refund'}, {
|
||||
data: {
|
||||
refundType: refundType.value,
|
||||
goods: goodsSelect.value.toString(),
|
||||
orderId: orderId.value,
|
||||
@ -143,19 +145,22 @@ const toRefund = (type) => {
|
||||
}
|
||||
|
||||
|
||||
onLoad((option) => {
|
||||
orderId.value = option.orderId
|
||||
id.value = option.id
|
||||
onLoad((options) => {
|
||||
const params = getParams(options)
|
||||
orderId.value = params.orderId
|
||||
id.value = params.id
|
||||
status.value = params.status
|
||||
handleOrderInfo({
|
||||
key: option.id
|
||||
key: params.id
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.shopping-checkbox {}
|
||||
<style lang="scss">
|
||||
.shopping-checkbox {
|
||||
}
|
||||
|
||||
.shopping-action {
|
||||
padding-left: 34rpx;
|
||||
@ -178,4 +183,26 @@ onLoad((option) => {
|
||||
width: 224rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.action-btns {
|
||||
gap: 20rpx;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
.button {
|
||||
flex: 1;
|
||||
height: 80%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: $primary-color;
|
||||
color: $white-color;
|
||||
}
|
||||
|
||||
.only-button {
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid #333;
|
||||
color: #333;
|
||||
background: $white-color;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user