skyblued 2 سال پیش
والد
کامیت
04f67e9216
3فایلهای تغییر یافته به همراه24 افزوده شده و 15 حذف شده
  1. 6 0
      src/constant/index.ts
  2. 1 1
      src/student/trade/index.tsx
  3. 17 14
      src/student/trade/list/index.tsx

+ 6 - 0
src/constant/index.ts

@@ -14,6 +14,12 @@ export const orderType = {
   FAIL: '支付失败'
 }
 
+export const returnType = {
+  DOING: '审核中',
+  PASS: '通过',
+  UNPASS: '不通过'
+}
+
 export const levelMember = {
   BEGINNER: '入门级',
   ADVANCED: '进阶级',

+ 1 - 1
src/student/trade/index.tsx

@@ -41,7 +41,7 @@ export default defineComponent({
             <List height={this.height} />
           </Tab>
           <Tab name="refund" title="退费记录">
-            {/* <List type="refund" /> */}
+            <List height={this.height} type="refund" />
           </Tab>
         </Tabs>
       </div>

+ 17 - 14
src/student/trade/list/index.tsx

@@ -15,7 +15,7 @@ import {
   Toast
 } from 'vant'
 import { formatterDate } from '@/helpers/utils'
-import { goodsType, orderType } from '@/constant'
+import { goodsType, orderType, returnType } from '@/constant'
 
 import iconTeacher from '@common/images/icon_teacher.png'
 import request from '@/helpers/request'
@@ -64,28 +64,31 @@ export default defineComponent({
   },
   methods: {
     async getList() {
+      this.loading = true
       try {
         const params = {
           ...this.params,
           searchDate: dayjs(this.currentDate).format('YYYY-MM')
         }
-        const res = await request.post('/api-student/userOrder/page', {
+        const url =
+          this.type === 'buy'
+            ? '/api-student/userOrder/page'
+            : '/api-student/UserOrderRefunds/page'
+        const { code, data } = await request.post(url, {
           data: params
         })
-        this.loading = false
-        const result = res.data || {}
-        // 处理重复请求数据
-        if (this.list.length > 0 && result.pageNo === 1) {
-          return
+        if (code === 200) {
+          const result = data || {}
+          this.list = this.list.concat(result.rows || [])
+          this.finished = result.pageNo >= result.totalPage
+          this.params.page = result.pageNo + 1
+          this.dataShow = this.list.length > 0
         }
-        this.list = this.list.concat(result.rows || [])
-        this.finished = result.pageNo >= result.totalPage
-        this.params.page = result.pageNo + 1
-        this.dataShow = this.list.length > 0
       } catch {
         this.dataShow = false
         this.finished = true
       }
+      this.loading = false
     },
     onDetail(item: any) {
       this.$router.push({
@@ -203,7 +206,7 @@ export default defineComponent({
         </Sticky>
         {this.dataShow ? (
           <List
-            v-model:loading={this.loading}
+            loading={this.loading}
             finished={this.finished}
             finishedText=" "
             class={[styles.list]}
@@ -218,7 +221,7 @@ export default defineComponent({
               >
                 <Cell
                   title={dayjs(item.createTime).format('YYYY-MM-DD HH:mm')}
-                  value={orderType[item.status]}
+                  value={this.type ==='buy' ? orderType[item.status] : returnType[item.status]}
                   valueClass={styles.tradeType}
                 />
                 <Cell
@@ -236,7 +239,7 @@ export default defineComponent({
                       <div class={styles.content}>
                         <span class={styles.price}>
-                          {(this as any).$filters.moneyFormat(item.actualPrice)}
+                          {(this as any).$filters.moneyFormat(item.actualPrice || item.actualAmount)}
                         </span>
                       </div>
                     )