浏览代码

售后列表流程修改

skyblued 3 年之前
父节点
当前提交
a4c4a5e486

+ 180 - 91
src/views/goods-order/after-sale.tsx

@@ -7,6 +7,7 @@ import {
   Button,
   Cell,
   CellGroup,
+  Dialog,
   Field,
   Image,
   List,
@@ -18,6 +19,11 @@ import { defineComponent } from 'vue'
 import Item from './item'
 import styles from './index.module.less'
 
+const returnState = {
+  0: '待审核',
+  1: '等待退款'
+}
+
 export default defineComponent({
   name: 'after-sale',
   data() {
@@ -28,6 +34,7 @@ export default defineComponent({
       loading: false,
       finished: false,
       show: false,
+      kmsShow: false,
       params: {
         pageNum: 1,
         pageSize: 20
@@ -47,13 +54,12 @@ export default defineComponent({
         productPrice: 0,
         productRealPrice: 0,
         proofPics: '',
-        reason: '',
         returnName: '',
-        returnPhone: '',
-        returnOrderSn: ''
+        returnPhone: ''
       },
       reason: '', // 退货原因
-      returnOrderSn: '' // 退货快递单号
+      returnOrderSn: '', // 退货快递单号
+      returnGoodId: 0 // 退货申请服务单号
     }
   },
   watch: {
@@ -62,6 +68,9 @@ export default defineComponent({
       this.getList()
     }
   },
+  mounted() {
+    this.getList()
+  },
   methods: {
     init() {
       this.params.pageNum = 1
@@ -96,13 +105,12 @@ export default defineComponent({
     },
 
     //获取可退货列表
-    async getIsReturnOrderList() {
+    async getIsReturnOrderList(): Promise<object> {
       try {
         let res = await request.get('/api-mall-portal/order/list', {
           params: {
             ...this.params,
-            status:
-              this.active === '0' ? '1,2,3' : this.active === '1' ? '' : ''
+            status: '1,2,3'
           }
         })
         return res
@@ -111,12 +119,12 @@ export default defineComponent({
     },
 
     // 获取退货申请
-    async getReturnList() {
+    async getReturnList(): Promise<object> {
       try {
         let res = await request.post('/api-mall-portal/returnApply/list', {
           data: {
             ...this.params,
-            status: this.active === '1' ? '0' : '1'
+            status: this.active === '1' ? '0,1' : '2,3'
           }
         })
         return res
@@ -143,17 +151,16 @@ export default defineComponent({
       console.log(this.returnGood)
     },
     // 退商品
-    async setReturnShop() {
+    async setReturnShop(): Promise<void> {
       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
+            ...this.returnGood,
+            reason: this.reason
           }
         })
         if (res.code === 200) {
@@ -168,6 +175,48 @@ export default defineComponent({
           })
         }
       } catch (error) {}
+    },
+
+    // 填写快递单号
+    async setReturnApplySn(): Promise<void> {
+      if (!this.returnOrderSn) {
+        Toast('请填写退货快递单号')
+        return
+      }
+
+      try {
+        let { code, data } = await request.post(
+          '/api-mall-portal/returnApply/deliverySn',
+          {
+            data: {
+              deliverySn: this.returnOrderSn,
+              id: this.returnGoodId
+            }
+          }
+        )
+        if (code === 200) {
+          this.returnOrderSn = ''
+        }
+      } catch (error) {}
+    },
+    //撤销申请
+    deleteReturnApply(): void {
+      Dialog.confirm({
+        title: '提示',
+        message: '是否撤销退货申请?',
+        confirmButtonText: '撤销',
+        confirmButtonColor: 'var(--van-primary)'
+      }).then(async () => {
+        try {
+          let { code, data } = await request.post(
+            '/api-mall-portal/returnApply/delete/' + this.returnGoodId
+          )
+          if (code === 200) {
+            this.init()
+            this.getList()
+          }
+        } catch (err) {}
+      })
     }
   },
   render() {
@@ -190,80 +239,108 @@ export default defineComponent({
         />
 
         {this.dataShow ? (
-          <List
-            loading={this.loading}
-            finished={this.finished}
-            finishedText=" "
-            class={[styles.goodsList]}
-            onLoad={this.getList}
-          >
-            {this.list.map((item: any) => (
-              <>
-                {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 原路退还
+          <>
+            {this.list.length ? (
+              <List
+                loading={this.loading}
+                finished={this.finished}
+                finishedText=" "
+                class={[styles.goodsList]}
+                onLoad={this.getList}
+              >
+                {this.list.map((item: any) => (
+                  <>
+                    {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}>
+                        <Cell
+                          title={item.createTime}
+                          titleClass={styles.payTime}
+                          value={returnState[item.status]}
+                          // valueClass={}
+                        ></Cell>
+                        <Item item={item} />
+                        <Cell
+                          center
+                          v-slots={{
+                            default: () => (
+                              <div class={styles.btnList}>
+                                {item.status === 1 && !item.deliverySn ? (
+                                  <Button
+                                    size="small"
+                                    round
+                                    onClick={() => {
+                                      this.returnGoodId = item.id
+                                      this.kmsShow = true
+                                    }}
+                                  >
+                                    填写退货快递单号
+                                  </Button>
+                                ) : null}
+                                {item.status <= 1 ? (
+                                  <Button
+                                    size="small"
+                                    round
+                                    type="primary"
+                                    onClick={() => {
+                                      this.returnGoodId = item.id
+                                      this.deleteReturnApply()
+                                    }}
+                                  >
+                                    撤销申请
+                                  </Button>
+                                ) : null}
+                                {item.status === 2 ? (
+                                  <div class={styles.returnDes}>
+                                    该商品金额已于 {item.handleTime} 原路退还
+                                  </div>
+                                ) : null}
                               </div>
-                            )}
-                          </div>
-                        )
-                      }}
-                    ></Cell>
-                  </CellGroup>
-                )}
-              </>
-            ))}
-          </List>
-        ) : (
-          <ColResult btnStatus={false} classImgSize="SMALL" tips="暂无数据" />
-        )}
+                            )
+                          }}
+                        ></Cell>
+                      </CellGroup>
+                    )}
+                  </>
+                ))}
+              </List>
+            ) : (
+              <ColResult
+                btnStatus={false}
+                classImgSize="SMALL"
+                tips="暂无数据"
+              />
+            )}
+          </>
+        ) : null}
 
         <ActionSheet v-model:show={this.show} title="退货原因">
           <div style={{ paddingTop: '15px' }}>
@@ -274,11 +351,6 @@ export default defineComponent({
               rows={3}
               v-model={this.reason}
             />
-            <Field
-              v-model={this.returnOrderSn}
-              class={[styles.field]}
-              placeholder="请输入退货快递单号"
-            />
           </div>
           <div class={styles['btn-group']}>
             <Button
@@ -291,6 +363,23 @@ export default defineComponent({
             </Button>
           </div>
         </ActionSheet>
+        <ActionSheet v-model:show={this.kmsShow} title="填写退货快递单号">
+          <Field
+            v-model={this.returnOrderSn}
+            class={[styles.field]}
+            placeholder="请输入退货快递单号"
+          />
+          <div class={styles['btn-group']}>
+            <Button
+              type="primary"
+              block
+              round
+              onClick={() => this.setReturnApplySn()}
+            >
+              确定
+            </Button>
+          </div>
+        </ActionSheet>
       </div>
     )
   }

+ 1 - 1
src/views/goods-order/item.tsx

@@ -30,7 +30,7 @@ export default defineComponent({
                   <i>¥</i>
                   {moneyFormat(item.productPrice)}
                 </span>
-                <span class={styles.num}>x{item.productQuantity}</span>
+                <span class={styles.num}>x{item.productQuantity || item.productCount}</span>
               </div>
             </div>
           )

+ 1 - 1
src/views/shop-mall/shop-order-detail/index.tsx

@@ -114,7 +114,7 @@ export default defineComponent({
                 <Cell
                   class={styles.addressDetail}
                   border={false}
-                  title="物流公司(配送方式)"
+                  title="物流公司(配送方式):"
                   value={order.value?.deliveryCompany}
                 ></Cell>
                 <Cell

+ 0 - 42
src/views/shop-mall/shop-order-detail/shop-detial.ts

@@ -1,42 +0,0 @@
-export enum payType{
-    未支付 = 0,
-    支付宝 = 1,
-    微信 = 2,
-
-}
-export interface item {
-    couponAmount: number,
-    giftGrowth: number,
-    giftIntegration: number,
-    id: number | 0,
-    integrationAmount: number,
-    orderId: number,
-    orderSn: string,
-    productAttr: string,
-    productBrand: string,
-    productCategoryId: number,
-    productId: number,
-    productName: string,
-    productPic: string,
-    productPrice: number,
-    productQuantity: number,
-    productSkuCode: string,
-    productSkuId: number,
-    productSn: string,
-    promotionAmount: number,
-    promotionName: string,
-    realAmount: number
-}
-
-export interface order{
-    createTime: string,
-    id: number,
-    memberUsername: string
-    orderItemList: item[],
-    orderSn: string,
-    payAmount: number,
-    payType: payType,
-    promotionAmount: number,
-    status: number, // 0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单
-    totalAmount: number
-}