|
@@ -1,5 +1,7 @@
|
|
|
import ColHeader from '@/components/col-header'
|
|
|
import ColResult from '@/components/col-result'
|
|
|
+import request from '@/helpers/request'
|
|
|
+import { state } from '@/state'
|
|
|
import {
|
|
|
ActionSheet,
|
|
|
Button,
|
|
@@ -9,9 +11,11 @@ import {
|
|
|
Image,
|
|
|
List,
|
|
|
Tab,
|
|
|
- Tabs
|
|
|
+ Tabs,
|
|
|
+ Toast
|
|
|
} from 'vant'
|
|
|
import { defineComponent } from 'vue'
|
|
|
+import Item from './item'
|
|
|
import styles from './index.module.less'
|
|
|
|
|
|
export default defineComponent({
|
|
@@ -19,21 +23,152 @@ export default defineComponent({
|
|
|
data() {
|
|
|
return {
|
|
|
active: '0',
|
|
|
- list: [1],
|
|
|
+ list: [],
|
|
|
dataShow: true, // 判断是否有数据
|
|
|
loading: false,
|
|
|
finished: false,
|
|
|
+ show: false,
|
|
|
params: {
|
|
|
- search: '',
|
|
|
- groupStatus: 'APPLY',
|
|
|
- page: 1,
|
|
|
- rows: 20
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 20
|
|
|
},
|
|
|
- show: false
|
|
|
+
|
|
|
+ returnGood: {
|
|
|
+ description: '',
|
|
|
+ memberUsername: '',
|
|
|
+ orderId: 0,
|
|
|
+ orderSn: '',
|
|
|
+ productAttr: '',
|
|
|
+ productBrand: '',
|
|
|
+ productCount: 0,
|
|
|
+ productId: 0,
|
|
|
+ productName: '',
|
|
|
+ productPic: '',
|
|
|
+ productPrice: 0,
|
|
|
+ productRealPrice: 0,
|
|
|
+ proofPics: '',
|
|
|
+ reason: '',
|
|
|
+ returnName: '',
|
|
|
+ returnPhone: '',
|
|
|
+ returnOrderSn: ''
|
|
|
+ },
|
|
|
+ reason: '', // 退货原因
|
|
|
+ returnOrderSn: '' // 退货快递单号
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ active() {
|
|
|
+ this.init()
|
|
|
+ this.getList()
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- getList() {}
|
|
|
+ init() {
|
|
|
+ this.params.pageNum = 1
|
|
|
+ this.finished = false
|
|
|
+ this.list = []
|
|
|
+ },
|
|
|
+
|
|
|
+ async getList() {
|
|
|
+ //避免重复请求
|
|
|
+ if (this.loading && this.finished) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ let res: any
|
|
|
+ if (this.active === '0') {
|
|
|
+ // 可退货列表
|
|
|
+ res = await this.getIsReturnOrderList()
|
|
|
+ } else {
|
|
|
+ // 退货申请列表
|
|
|
+ res = await this.getReturnList()
|
|
|
+ }
|
|
|
+ // console.log(res)
|
|
|
+ if (!res.data.list) {
|
|
|
+ this.dataShow = false
|
|
|
+ }
|
|
|
+ if (res.code === 200 && res.data.list) {
|
|
|
+ this.list = [].concat(this.list, res.data.list)
|
|
|
+ this.params.pageNum = res.data.pageNum + 1
|
|
|
+ }
|
|
|
+ this.finished = this.params.pageNum >= res.data.totalPage
|
|
|
+ this.loading = false
|
|
|
+ },
|
|
|
+
|
|
|
+ //获取可退货列表
|
|
|
+ async getIsReturnOrderList() {
|
|
|
+ try {
|
|
|
+ let res = await request.get('/api-mall-portal/order/list', {
|
|
|
+ params: {
|
|
|
+ ...this.params,
|
|
|
+ status:
|
|
|
+ this.active === '0' ? '1,2,3' : this.active === '1' ? '' : ''
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return res
|
|
|
+ } catch (error) {}
|
|
|
+ return {}
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取退货申请
|
|
|
+ async getReturnList() {
|
|
|
+ try {
|
|
|
+ let res = await request.post('/api-mall-portal/returnApply/list', {
|
|
|
+ data: {
|
|
|
+ ...this.params,
|
|
|
+ status: this.active === '1' ? '0' : '1'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return res
|
|
|
+ } catch (error) {}
|
|
|
+ return {}
|
|
|
+ },
|
|
|
+
|
|
|
+ // 设置退货参数
|
|
|
+ setReturnParams(item: any, n: any): void {
|
|
|
+ this.returnGood.memberUsername = state.user.data.username
|
|
|
+ this.returnGood.orderId = item.id
|
|
|
+ this.returnGood.orderSn = item.orderSn
|
|
|
+ this.returnGood.productAttr = n.productAttr
|
|
|
+ this.returnGood.productBrand = n.productBrand
|
|
|
+ this.returnGood.productCount = n.productQuantity
|
|
|
+ this.returnGood.productId = n.productId
|
|
|
+ this.returnGood.productName = n.productName
|
|
|
+ this.returnGood.productPic = n.productPic
|
|
|
+ this.returnGood.productPrice = n.productPrice
|
|
|
+ this.returnGood.productRealPrice = n.productPrice
|
|
|
+ this.returnGood.proofPics = ''
|
|
|
+ this.returnGood.returnName = item.receiverName
|
|
|
+ this.returnGood.returnPhone = item.receiverPhone
|
|
|
+ console.log(this.returnGood)
|
|
|
+ },
|
|
|
+ // 退商品
|
|
|
+ async setReturnShop() {
|
|
|
+ if (!this.reason) {
|
|
|
+ Toast('请填写退货原因!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.returnGood.reason = this.reason
|
|
|
+ this.returnGood.returnOrderSn = this.returnOrderSn
|
|
|
+ try {
|
|
|
+ let res = await request.post('/api-mall-portal/returnApply/create', {
|
|
|
+ data: {
|
|
|
+ ...this.returnGood
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (res.code === 200) {
|
|
|
+ Toast({
|
|
|
+ message: '退货申请成功!',
|
|
|
+ onOpened: () => {
|
|
|
+ this.show = false
|
|
|
+ this.reason = ''
|
|
|
+ this.returnOrderSn = ''
|
|
|
+ this.active = '1'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (error) {}
|
|
|
+ }
|
|
|
},
|
|
|
render() {
|
|
|
return (
|
|
@@ -56,60 +191,74 @@ export default defineComponent({
|
|
|
|
|
|
{this.dataShow ? (
|
|
|
<List
|
|
|
- v-model:loading={this.loading}
|
|
|
+ loading={this.loading}
|
|
|
finished={this.finished}
|
|
|
finishedText=" "
|
|
|
class={[styles.goodsList]}
|
|
|
onLoad={this.getList}
|
|
|
>
|
|
|
{this.list.map((item: any) => (
|
|
|
- <CellGroup class={styles.cellGroup}>
|
|
|
- <Cell
|
|
|
- center
|
|
|
- v-slots={{
|
|
|
- icon: () => (
|
|
|
- <Image
|
|
|
- class={styles.goodsImg}
|
|
|
- src="https://cdn.jsdelivr.net/npm/@vant/assets/cat.jpeg"
|
|
|
- fit="cover"
|
|
|
- />
|
|
|
- ),
|
|
|
- default: () => (
|
|
|
- <div class={styles.goodsContainer}>
|
|
|
- <div class={[styles.goodsTitle, 'van-ellipsis']}>
|
|
|
- 次中音号降调JBBR-1220次中音号降调JBBR-1220次中音号降调JBBR-1220
|
|
|
- </div>
|
|
|
- <div class={styles.model}>型号:默认</div>
|
|
|
- <div class={styles.goodsPrice}>
|
|
|
- <span class={styles.price}>
|
|
|
- <i>¥</i>2,5000.0
|
|
|
- </span>
|
|
|
- <span class={styles.num}>x1</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }}
|
|
|
- ></Cell>
|
|
|
- <Cell
|
|
|
- center
|
|
|
- v-slots={{
|
|
|
- default: () => (
|
|
|
- <div class={styles.btnList}>
|
|
|
- <Button
|
|
|
- size="small"
|
|
|
- round
|
|
|
- type="primary"
|
|
|
- onClick={() => {
|
|
|
- this.show = true
|
|
|
- }}
|
|
|
- >
|
|
|
- 申请退货
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }}
|
|
|
- ></Cell>
|
|
|
- </CellGroup>
|
|
|
+ <>
|
|
|
+ {item.orderItemList && item.orderItemList.length ? (
|
|
|
+ item.orderItemList.map((n: any) => (
|
|
|
+ <CellGroup class={styles.cellGroup}>
|
|
|
+ <Item item={n} />
|
|
|
+ <Cell
|
|
|
+ center
|
|
|
+ v-slots={{
|
|
|
+ default: () => (
|
|
|
+ <div class={styles.btnList}>
|
|
|
+ {this.active === '0' &&
|
|
|
+ (item.status !== 0 || item.status !== 6) ? (
|
|
|
+ <Button
|
|
|
+ size="small"
|
|
|
+ round
|
|
|
+ type="primary"
|
|
|
+ onClick={() => {
|
|
|
+ this.show = true
|
|
|
+ this.setReturnParams(item, n)
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 退货申请
|
|
|
+ </Button>
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ ></Cell>
|
|
|
+ </CellGroup>
|
|
|
+ ))
|
|
|
+ ) : (
|
|
|
+ <CellGroup class={styles.cellGroup}>
|
|
|
+ <Item item={item} />
|
|
|
+ <Cell
|
|
|
+ center
|
|
|
+ v-slots={{
|
|
|
+ default: () => (
|
|
|
+ <div class={styles.btnList}>
|
|
|
+ {this.active !== '0' && item.status === 0 ? (
|
|
|
+ <Button
|
|
|
+ size="small"
|
|
|
+ round
|
|
|
+ type="primary"
|
|
|
+ onClick={() => {
|
|
|
+ this.show = true
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 撤销申请
|
|
|
+ </Button>
|
|
|
+ ) : (
|
|
|
+ <div class={styles.returnDes}>
|
|
|
+ 该商品金额已于 2021-03-24 13:34:24 原路退还
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ ></Cell>
|
|
|
+ </CellGroup>
|
|
|
+ )}
|
|
|
+ </>
|
|
|
))}
|
|
|
</List>
|
|
|
) : (
|
|
@@ -123,11 +272,21 @@ export default defineComponent({
|
|
|
placeholder="请输入退货原因"
|
|
|
type="textarea"
|
|
|
rows={3}
|
|
|
+ v-model={this.reason}
|
|
|
+ />
|
|
|
+ <Field
|
|
|
+ v-model={this.returnOrderSn}
|
|
|
+ class={[styles.field]}
|
|
|
+ placeholder="请输入退货快递单号"
|
|
|
/>
|
|
|
- <Field class={[styles.field]} placeholder="请输入退货快递单号" />
|
|
|
</div>
|
|
|
<div class={styles['btn-group']}>
|
|
|
- <Button type="primary" block round>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ block
|
|
|
+ round
|
|
|
+ onClick={() => this.setReturnShop()}
|
|
|
+ >
|
|
|
确定
|
|
|
</Button>
|
|
|
</div>
|