Bläddra i källkod

Merge branch 'master' of http://git.dayaedu.com/lex/h5-colexiu

lex-wxl 2 år sedan
förälder
incheckning
bf09597cc3

+ 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: '进阶级',

+ 3 - 6
src/helpers/request.ts

@@ -74,16 +74,12 @@ request.interceptors.request.use(
 
 request.interceptors.response.use(
   async res => {
-    
     toast = setTimeout(() => {
       Toast.clear()
-    }, 300)
-    // setTimeout(() => {
-    //   // closeLoading();
-    // Toast.clear()
-    // }, 100)
+    }, 100)
 
     if (res.status > 299 || res.status < 200) {
+      clearTimeout(toast)
       const msg = '服务器错误,状态码' + res.status
       Toast(msg)
       throw new Error(msg)
@@ -99,6 +95,7 @@ request.interceptors.response.use(
         }
       }
       if (!(data.code === 403 || data.code === 401)) {
+        clearTimeout(toast)
         Toast(msg)
       }
       const browserInfo = browser()

+ 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>

+ 49 - 30
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,30 +64,34 @@ 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) {
+      if (this.type === 'refund') return
       this.$router.push({
         path: '/tradeDetail',
         query: {
@@ -182,28 +186,33 @@ export default defineComponent({
                   />
                 </div>
               ),
-              value: () => (
-                <div
-                  class={styles.searchType}
-                  onClick={() => {
-                    this.typeStatus = true
-                  }}
-                >
-                  <span>{this.searchName}</span>
-                  <Icon
-                    classPrefix="iconfont"
-                    name="down"
-                    size={12}
-                    color="var(--van-primary)"
-                  />
-                </div>
-              )
+              value: () => {
+                if (this.type === 'buy') {
+                  return (
+                    <div
+                      class={styles.searchType}
+                      onClick={() => {
+                        this.typeStatus = true
+                      }}
+                    >
+                      <span>{this.searchName}</span>
+                      <Icon
+                        classPrefix="iconfont"
+                        name="down"
+                        size={12}
+                        color="var(--van-primary)"
+                      />
+                    </div>
+                  )
+                }
+                return null
+              }
             }}
           ></Cell>
         </Sticky>
         {this.dataShow ? (
           <List
-            v-model:loading={this.loading}
+            loading={this.loading}
             finished={this.finished}
             finishedText=" "
             class={[styles.list]}
@@ -218,7 +227,11 @@ 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 +249,13 @@ export default defineComponent({
                       <div class={styles.content}>
                         <span class={styles.price}>
-                          {(this as any).$filters.moneyFormat(item.actualPrice)}
+                          {this.type === 'buy'
+                            ? (this as any).$filters.moneyFormat(
+                                item.actualPrice
+                              )
+                            : (this as any).$filters.moneyFormat(
+                                item.actualAmount
+                              )}
                         </span>
                       </div>
                     )

+ 2 - 2
src/views/cart/cart-confirm-agin/index.tsx

@@ -1,6 +1,6 @@
 import { computed, ref, defineComponent, onMounted, reactive } from 'vue'
 import { Card, Cell, CellGroup, Popup, SubmitBar, Toast } from 'vant'
-import { addressType, cartConfirm } from '../cart'
+import { addressType, cartConfirm, formateAttr } from '../cart'
 import styles from '../index.module.less'
 import Address from '../components/address'
 import request from '@/helpers/request'
@@ -85,7 +85,7 @@ export default defineComponent({
                   >
                     <Card
                       price={moneyFormat(item.productPrice)}
-                      desc={item.productAttr}
+                      desc={formateAttr(item.productAttr)}
                       title={item.productName}
                       thumb={item.productPic}
                       num={item.productQuantity}

+ 40 - 19
src/views/cart/cart-confirm/index.tsx

@@ -1,6 +1,13 @@
-import { computed, ref, defineComponent, onMounted, reactive } from 'vue'
+import {
+  computed,
+  ref,
+  defineComponent,
+  onMounted,
+  reactive,
+  onUnmounted
+} from 'vue'
 import { Card, Cell, CellGroup, Popup, SubmitBar, Toast } from 'vant'
-import { addressType, cartConfirm } from '../cart'
+import { addressType, cartConfirm, formateAttr } from '../cart'
 import styles from '../index.module.less'
 import Address from '../components/address'
 import request from '@/helpers/request'
@@ -12,23 +19,32 @@ import ColPopup from '@/components/col-popup'
 import UserAuth from '@/views/order-detail/userAuth'
 import ColResult from '@/components/col-result'
 import { moneyFormat } from '@/helpers/utils'
+import { listenerMessage, removeListenerMessage } from '@/helpers/native-message'
 export default defineComponent({
   name: 'cartConfirm',
   setup() {
     const list = cartConfirm.cartPromotionItemList
     const calcAmount = cartConfirm.calcAmount
 
+    const address = ref<addressType>()
+    if (cartConfirm.memberReceiveAddressList.length) {
+      const a =
+        cartConfirm.memberReceiveAddressList.find(
+          (n: any) => n.defaultStatus
+        ) || cartConfirm.memberReceiveAddressList[0]
+      if (a) address.value = a
+    }
+    const setAddress = (result: addressType) => {
+      address.value = result
+    }
     onMounted(() => {
-      // console.log(cartConfirm, '确认订单商品')
+      listenerMessage('getAddress', result => {
+        setAddress(result?.content || {})
+      })
+    })
+    onUnmounted(() => {
+      removeListenerMessage('getAddress', () => {})
     })
-
-    const payType = ref(0) // 0->未支付;1->支付宝;2->微信
-
-    const address = cartConfirm.memberReceiveAddressList.length
-      ? cartConfirm.memberReceiveAddressList.find(
-          (n: any) => n.defaultStatus
-        ) || cartConfirm.memberReceiveAddressList[0] || {}
-      : {}
 
     const agreeStatus = ref(false)
     const paymentPopup = ref(false)
@@ -39,7 +55,7 @@ export default defineComponent({
     })
     // 提交
     const onSubmit = () => {
-      if (!(address as any).id){
+      if (!address.value?.id) {
         Toast('请选择收货地址')
         return
       }
@@ -70,8 +86,7 @@ export default defineComponent({
       }, [])
       const body = {
         cartIds: ids,
-        memberReceiveAddressId: (address as any).id,
-        payType: payType.value
+        memberReceiveAddressId: address.value?.id
       }
       try {
         let { code, data } = await request.post(
@@ -96,7 +111,7 @@ export default defineComponent({
         {list.length ? (
           <div class={styles.cartConfirm}>
             <div class={styles.cartConfirmBox}>
-              <Address item={address as any} />
+              <Address item={address.value} setAddress={setAddress} />
             </div>
             <div
               style={{ marginTop: '20px' }}
@@ -110,7 +125,7 @@ export default defineComponent({
                   >
                     <Card
                       price={moneyFormat(item.price)}
-                      desc={item.productAttr}
+                      desc={formateAttr(item.productAttr)}
                       title={item.productName}
                       thumb={item.productPic}
                       num={item.quantity}
@@ -129,7 +144,11 @@ export default defineComponent({
                   title="运费"
                   value={moneyFormat(calcAmount.freightAmount)}
                 ></Cell>
-                <Cell border={false} title="优惠" value={'-¥ ' + moneyFormat(calcAmount.promotionAmount)}></Cell>
+                <Cell
+                  border={false}
+                  title="优惠"
+                  value={'-¥ ' + moneyFormat(calcAmount.promotionAmount)}
+                ></Cell>
                 {/* <Cell border={false} title="优惠卷" value="暂无可用优惠卷"></Cell>
             <Cell border={false} title="乐乐币抵扣" value={"-¥" + calcAmount.promotionAmount}></Cell> */}
               </CellGroup>
@@ -146,7 +165,9 @@ export default defineComponent({
             >
               <div class={styles.confirmBottom}>
                 合计{' '}
-                <span class={styles['price-des']}>¥{moneyFormat(calcAmount.payAmount)}</span>
+                <span class={styles['price-des']}>
+                  ¥{moneyFormat(calcAmount.payAmount)}
+                </span>
               </div>
             </SubmitBar>
             <div style={{ height: 'var(--van-submit-bar-height)' }}></div>
@@ -174,7 +195,7 @@ export default defineComponent({
           <ColResult
             buttonText="去购物车"
             onClick={() => {
-              router.push({path: '/cart'})
+              router.push({ path: '/cart' })
             }}
           ></ColResult>
         )}

+ 44 - 25
src/views/cart/cart.ts

@@ -1,30 +1,49 @@
-import { reactive,ref } from "vue";
-interface amout{
-    freightAmount: number,
-    payAmount: number,
-    promotionAmount: number,
-    totalAmount: number
+import { reactive, ref } from 'vue'
+interface amout {
+  freightAmount: number
+  payAmount: number
+  promotionAmount: number
+  totalAmount: number
 }
-interface cart{
-    calcAmount: amout,
-    cartPromotionItemList: Array<any>[]
+interface cart {
+  calcAmount: amout
+  cartPromotionItemList: Array<any>[]
 }
 
 export interface addressType {
-    city: string
-    defaultStatus?: number
-    detailAddress: string
-    id?: number
-    memberId?: number
-    name: string
-    phoneNumber: string
-    postCode: string
-    province: string
-    region: string
-  }
+  city: string
+  defaultStatus?: number
+  detailAddress: string
+  id?: number
+  memberId?: number
+  name: string
+  phoneNumber: string
+  postCode: string
+  province: string
+  region: string
+}
 export const cartConfirm = reactive({
-    calcAmount: {} as amout,
-    cartPromotionItemList: [] as Array<any>[],
-    memberReceiveAddressList: [] as Array<addressType>[],
-    orderInfo: {} as any
-})
+  calcAmount: {} as amout,
+  cartPromotionItemList: [] as Array<any>[],
+  memberReceiveAddressList: [] as Array<addressType>,
+  orderInfo: {} as any
+})
+type Item = {
+  key: string
+  value: string
+}
+export const formateAttr = (productAttr: string) => {
+  let arr = null as any
+  try {
+    arr = JSON.parse(productAttr)
+  } catch (err) {}
+  if (Array.isArray(arr)) {
+    let str: string = ''
+    let item: Item
+    for (item of arr) {
+      str += `${item.key}: ${item.value} `
+    }
+    return str
+  }
+  return productAttr
+}

+ 1 - 0
src/views/cart/components/address/index.module.less

@@ -27,6 +27,7 @@
 .phone{
     font-size: 16px;
     color: #333;
+    margin-left: 14px;
 }
 .addressInfo{
     font-size: 14px;

+ 16 - 25
src/views/cart/components/address/index.tsx

@@ -1,18 +1,15 @@
 import { Cell, Icon } from 'vant'
 import {
   defineComponent,
-  onMounted,
-  ref,
   computed,
-  PropType,
-  toRef,
-  onUnmounted
+  PropType
 } from 'vue'
 import styles from './index.module.less'
 import iconAddress from '@views/shop-mall/images/icon-address.png'
-import request from '@/helpers/request'
-import { cartConfirm, addressType } from '../../cart'
-import { postMessage, removeListenerMessage, listenerMessage } from '@/helpers/native-message'
+import {  addressType } from '../../cart'
+import {
+  postMessage
+} from '@/helpers/native-message'
 
 export default defineComponent({
   name: 'cart-address',
@@ -24,36 +21,30 @@ export default defineComponent({
     isLink: {
       type: Boolean,
       default: true
+    },
+    setAddress:{
+      type: Function,
+      default: (n: any) => {}
     }
   },
   setup(props) {
-    let address = props.item
     const addressInfo = computed(() => {
       return [
-        address.province,
-        address.city,
-        address.region,
-        address.detailAddress
+        props.item.province,
+        props.item.city,
+        props.item.region,
+        props.item.detailAddress
       ].join('')
     })
-    const setAddress =(data: any) => {
-      console.log(data)
-      address = data
-    }
 
     const selectAddress = () => {
+      if (!props.isLink) return
       postMessage({
         api: 'setAddress',
         content: {}
       })
     }
-    onMounted(() => {
-      listenerMessage('getAddress', setAddress)
-    })
 
-    onUnmounted(() => {
-      removeListenerMessage('getAddress', () => {})
-    })
 
     return () => (
       <>
@@ -65,9 +56,9 @@ export default defineComponent({
             icon: () => <Icon name={iconAddress} size={19} />,
             title: () => (
               <div>
-                <span class={styles.userName}>{address?.name}</span>
+                <span class={styles.userName}>{props.item.name}</span>
                 <span class={styles.phone}>
-                  {address?.phoneNumber || '去填写收货地址'}
+                  {props.item && props.item.phoneNumber && props.item.phoneNumber.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2") || '去填写收货地址'}
                 </span>
               </div>
             ),

+ 83 - 85
src/views/cart/index.tsx

@@ -3,7 +3,7 @@ import ColHeader from '@/components/col-header'
 import styles from './index.module.less'
 import { Checkbox, SubmitBar, Card, Stepper, CheckboxGroup } from 'vant'
 import request from '@/helpers/request'
-import { cartConfirm } from './cart'
+import { cartConfirm, formateAttr } from './cart'
 import ColResult from '@/components/col-result'
 import { moneyFormat } from '@/helpers/utils'
 
@@ -133,92 +133,90 @@ export default defineComponent({
       <>
         {this.dataShow ? (
           <div>
-            {!this.cartList.length ? (
-              <ColResult
-                tips="购物车空空如也"
-                buttonText="去商城逛逛"
-                onClick={() => this.gotoShopMall()}
-              ></ColResult>
-            ) : (
-              <>
-                <ColHeader
-                  onClickRight={() => (this.isManage = !this.isManage)}
-                  v-slots={{
-                    right: () => (
-                      <span style={{ color: '#333', fontSize: '14px' }}>
-                        {this.isManage ? '完成' : '管理'}
-                      </span>
-                    )
-                  }}
-                ></ColHeader>
-                <div class={styles.cartBox}>
-                  <CheckboxGroup v-model={this.selectItems}>
-                    {this.cartList.map((item: any) => (
-                      <div class={styles.cartItem}>
-                        <Checkbox name={item.id}>
-                          <Card
-                            price={moneyFormat(item.price)}
-                            desc={item.productAttr}
-                            title={item.productName}
-                            thumb={item.productPic}
-                            v-slots={{
-                              num: () => (
-                                <Stepper
-                                  v-model={item.quantity}
-                                  onClick={e => {
-                                    e.stopPropagation()
-                                  }}
-                                  onChange={() => this.setCartItem(item)}
-                                  inputWidth="50px"
-                                  buttonSize="24px"
-                                  min={1}
-                                />
-                              )
-                            }}
-                          ></Card>
-                        </Checkbox>
-                      </div>
-                    ))}
-                  </CheckboxGroup>
-                  <div style={{ height: 'var(--van-submit-bar-height)' }}></div>
-
-                  {this.isManage ? (
-                    <div class={styles.delete}>
-                      <SubmitBar
-                        buttonText="删除"
-                        buttonColor="var(--van-primary)"
-                        disabled={this.totalPrice === 0}
-                        onSubmit={() => this.onDeleteCartItem()}
-                      >
-                        <Checkbox
-                          modelValue={this.checkAll}
-                          onClick={value => this.setCheckAll()}
-                        >
-                          全选
-                        </Checkbox>
-                      </SubmitBar>
-                    </div>
-                  ) : (
-                    <div class={styles.submit}>
-                      <SubmitBar
-                        price={this.totalPrice}
-                        buttonText={`结算(${this.len})`}
-                        buttonColor="var(--van-primary)"
-                        disabled={this.totalPrice === 0}
-                        onSubmit={() => this.generateConfirmOrder()}
-                      >
-                        <Checkbox
-                          modelValue={this.checkAll}
-                          onClick={value => this.setCheckAll()}
-                        >
-                          全选
-                        </Checkbox>
-                      </SubmitBar>
+            <ColHeader
+              onClickRight={() => (this.isManage = !this.isManage)}
+              v-slots={{
+                right: () => (
+                  <span style={{ color: '#333', fontSize: '14px' }}>
+                    {this.isManage ? '完成' : '管理'}
+                  </span>
+                )
+              }}
+            ></ColHeader>
+            <div class={styles.cartBox}>
+              {this.cartList.length ? (
+                <CheckboxGroup v-model={this.selectItems}>
+                  {this.cartList.map((item: any) => (
+                    <div class={styles.cartItem}>
+                      <Checkbox name={item.id}>
+                        <Card
+                          price={moneyFormat(item.price)}
+                          desc={formateAttr(item.productAttr)}
+                          title={item.productName}
+                          thumb={item.productPic}
+                          v-slots={{
+                            num: () => (
+                              <Stepper
+                                v-model={item.quantity}
+                                onClick={e => {
+                                  e.stopPropagation()
+                                }}
+                                onChange={() => this.setCartItem(item)}
+                                inputWidth="50px"
+                                buttonSize="24px"
+                                min={1}
+                              />
+                            )
+                          }}
+                        ></Card>
+                      </Checkbox>
                     </div>
-                  )}
+                  ))}
+                </CheckboxGroup>
+              ) : (
+                <ColResult
+                  tips="购物车空空如也"
+                  buttonText="去商城逛逛"
+                  onClick={() => this.gotoShopMall()}
+                ></ColResult>
+              )}
+              <div style={{ height: 'var(--van-submit-bar-height)' }}></div>
+
+              {this.isManage ? (
+                <div class={styles.delete}>
+                  <SubmitBar
+                    buttonText="删除"
+                    buttonColor="var(--van-primary)"
+                    disabled={this.totalPrice === 0}
+                    onSubmit={() => this.onDeleteCartItem()}
+                  >
+                    <Checkbox
+                      modelValue={this.checkAll}
+                      onClick={value => this.setCheckAll()}
+                    >
+                      全选
+                    </Checkbox>
+                  </SubmitBar>
+                </div>
+              ) : (
+                <div class={styles.submit}>
+                  <SubmitBar
+                    price={this.totalPrice}
+                    buttonText={`结算(${this.len})`}
+                    buttonColor="var(--van-primary)"
+                    disabled={this.totalPrice === 0}
+                    onSubmit={() => this.generateConfirmOrder()}
+                  >
+                    <Checkbox
+                      modelValue={this.checkAll}
+                      onClick={value => this.setCheckAll()}
+                    >
+                      全选
+                    </Checkbox>
+                  </SubmitBar>
                 </div>
-              </>
-            )}
+              )}
+            </div>
           </div>
         ) : null}
       </>

+ 122 - 107
src/views/goods-order/after-sale.tsx

@@ -26,22 +26,22 @@ const returnState = {
   3: '已拒绝'
 }
 type good = {
-  description: string;
-  memberUsername: string;
-  orderId: number;
-  orderSn: string;
-  productAttr: string;
-  productBrand: string;
-  productCount: number;
-  productId: number;
-  productName: string;
-  productPic: string;
-  productPrice: number;
-  productRealPrice: number;
-  proofPics: string;
-  returnName: string;
-  returnPhone: string;
-  orderItemId: string;
+  description: string
+  memberUsername: string
+  orderId: number
+  orderSn: string
+  productAttr: string
+  productBrand: string
+  productCount: number
+  productId: number
+  productName: string
+  productPic: string
+  productPrice: number
+  productRealPrice: number
+  proofPics: string
+  returnName: string
+  returnPhone: string
+  orderItemId: string
 }
 
 export default defineComponent({
@@ -102,7 +102,26 @@ export default defineComponent({
         this.dataShow = false
       }
       if (res.code === 200 && res.data.list) {
-        this.list = [].concat(this.list, res.data.list)
+        let data = res.data
+        if (Array.isArray(data.list)) {
+          let list = [] as any
+          // 过滤一个订单里面所有商品都申请了退货
+          for (let i = 0; i < data.list.length; i++) {
+            if (data.list[i].orderItemList) {
+              let isHave =
+                data.list[i].orderItemList.findIndex(n => n.returnStatus < 0) >
+                -1
+              if (isHave) {
+                list.push(data.list[i])
+              }
+            } else {
+              list.push(data.list[i])
+            }
+          }
+          this.list = this.list.concat(this.list, list)
+        }
+        // this.list = [].concat(this.list, res.data.list)
+
         this.params.pageNum = res.data.pageNum + 1
       }
       this.finished = this.params.pageNum >= res?.data?.totalPage
@@ -171,14 +190,15 @@ export default defineComponent({
         })
         if (res.code === 200) {
           Toast({
-            message: '退货申请成功!',
-            onOpened: () => {
-              this.show = false
-              this.reason = ''
-              this.returnOrderSn = ''
-              this.active = '1'
-            }
+            message: '退货申请成功',
+            icon: 'success'
           })
+          setTimeout(() => {
+            this.show = false
+            this.reason = ''
+            this.returnOrderSn = ''
+            this.active = '1'
+          }, 500)
         }
       } catch (error) {}
       this.returnGood = {} as good
@@ -237,28 +257,13 @@ export default defineComponent({
     ]
     return (
       <div class={styles.shopOrder}>
-        <ColHeader
-        // v-slots={{
-        //   default: () => (
-        //     <Tabs
-        //       v-model:active={this.active}
-        //       color="var(--van-primary)"
-        //       lineWidth={28}
-        //     >
-        //       <Tab name="0" title="全部"></Tab>
-        //       <Tab name="1" title="处理中"></Tab>
-        //       <Tab name="2" title="已处理"></Tab>
-        //     </Tabs>
-        //   )
-        // }}
-        />
+        <ColHeader />
 
         <Tabs
           v-model:active={this.active}
           color="var(--van-primary)"
           lineWidth={28}
           animated
-          sticky
           swipeable
         >
           {tabs.map(tab => (
@@ -273,93 +278,103 @@ export default defineComponent({
                       class={[styles.goodsList]}
                       onLoad={this.getList}
                     >
-                      {this.active === tab.name && this.list.map((item: any) => (
-                        <>
-                          {item.orderItemList && item.orderItemList.length ? (
-                            item.orderItemList.filter(n => n.returnStatus < 0).map((n: any) => (
+                      {this.active === tab.name &&
+                        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) &&
+                                          n.returnStatus < 0 ? (
+                                            <Button
+                                              size="small"
+                                              round
+                                              type="primary"
+                                              onClick={() => {
+                                                this.show = true
+                                                this.setReturnParams(item, n)
+                                              }}
+                                            >
+                                              退货申请
+                                            </Button>
+                                          ) : null}
+                                          {n.returnStatus >= 0 ? (
+                                            <div>
+                                              {returnState[n.returnStatus]}
+                                            </div>
+                                          ) : null}
+                                        </div>
+                                      )
+                                    }}
+                                  ></Cell>
+                                </CellGroup>
+                              ))
+                            ) : (
                               <CellGroup class={styles.cellGroup}>
-                                <Item item={n} />
+                                <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}>
-                                        {this.active === '0' &&
-                                        (item.status !== 0 ||
-                                          item.status !== 6) ? (
+                                        {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.show = true
-                                              this.setReturnParams(item, n)
+                                              this.returnGoodId = item.id
+                                              this.deleteReturnApply()
                                             }}
                                           >
-                                            退货申请
+                                            撤销申请
                                           </Button>
                                         ) : null}
+                                        {item.status === 2 ? (
+                                          <div class={styles.returnDes}>
+                                            该商品金额已于 {item.handleTime}{' '}
+                                            原路退还
+                                          </div>
+                                        ) : item.status === 3 ? (
+                                          <div class={styles.returnDes}>
+                                            拒绝原因: {item.handleNote}
+                                          </div>
+                                        ) : 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>
-                                      ) : item.status === 3 ? (
-                                        <div class={styles.returnDes}>拒绝原因: {item.handleNote}</div>
-                                      ) : null}
-                                    </div>
-                                  )
-                                }}
-                              ></Cell>
-                            </CellGroup>
-                          )}
-                        </>
-                      ))}
+                            )}
+                          </>
+                        ))}
                     </List>
                   ) : (
                     <ColResult

+ 14 - 11
src/views/goods-order/components/after-sale-btns/index.tsx

@@ -84,17 +84,20 @@ export default defineComponent({
                 </Button>
               ) : null}
               {item.status === 3 ? (
-                <Button
-                  size="small"
-                  round
-                  type="primary"
-                  onClick={(e: Event) => {
-                    e.stopPropagation()
-                    onAginOrder(item)
-                  }}
-                >
-                  再来一单
-                </Button>
+                <>
+                  <span class={styles.confirmReceipt}>已确认收货</span>
+                  <Button
+                    size="small"
+                    round
+                    type="primary"
+                    onClick={(e: Event) => {
+                      e.stopPropagation()
+                      onAginOrder(item)
+                    }}
+                  >
+                    再来一单
+                  </Button>
+                </>
               ) : null}
             </div>
           )

+ 16 - 6
src/views/goods-order/index.module.less

@@ -1,5 +1,10 @@
 .shopOrder {
   --van-nav-bar-text-color: #666666;
+  :global {
+    .van-tab__panel {
+      min-height: calc(100vh - var(--van-tabs-line-height) - var(--van-nav-bar-height) - 45px);
+    }
+  }
 }
 
 .goodsList {
@@ -9,12 +14,11 @@
 .payTime {
   font-size: 13px;
   color: #666666;
-  line-height: 18px;
 }
-.payStatus{
-  color: #FF4E19;
+.payStatus {
+  color: #ff4e19;
 }
-.paySuccess{
+.paySuccess {
   color: var(--van-primary);
 }
 
@@ -98,8 +102,14 @@
 .btn-group {
   padding: 0 15% 12px;
 }
-.returnDes{
+.returnDes {
   color: #666;
   font-size: 14px;
   margin-right: auto;
-}
+}
+
+.confirmReceipt{
+  font-size: 12px;
+  color: #999;
+  margin-right: 19px;
+}

+ 4 - 17
src/views/goods-order/index.tsx

@@ -27,7 +27,7 @@ export default defineComponent({
       page: {
         pageNum: 1,
         pageSize: 20
-      }
+      },
     }
   },
   watch: {
@@ -120,8 +120,6 @@ export default defineComponent({
         }
         console.log(res)
       } catch (error) {
-        // console.dir(error)
-        // Dialog.alert()
       }
     },
 
@@ -151,31 +149,20 @@ export default defineComponent({
       { name: 1, title: '待收货' },
       { name: 2, title: '已收货' }
     ]
+
     return (
       <div class={styles.shopOrder}>
         <ColHeader
+          ref="colHeader"
+          class="header"
           rightText="售后服务"
           onClickRight={this.onClickRight}
-          // v-slots={{
-          //   default: () => (
-          //     <Tabs
-          //       v-model:active={this.active}
-          //       color="var(--van-primary)"
-          //       lineWidth={28}
-          //     >
-          //       <Tab name={0} title="待支付"></Tab>
-          //       <Tab name={1} title="待收货"></Tab>
-          //       <Tab name={2} title="已收货"></Tab>
-          //     </Tabs>
-          //   )
-          // }}
         />
         <Tabs
           v-model:active={this.active}
           color="var(--van-primary)"
           lineWidth={28}
           animated
-          sticky
           swipeable
         >
           {tabs.map(tab => (

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

@@ -1,6 +1,7 @@
 import { moneyFormat } from '@/helpers/utils'
 import { Cell, Image } from 'vant'
 import { defineComponent } from 'vue'
+import { formateAttr } from '../cart/cart'
 import styles from './index.module.less'
 
 export default defineComponent({
@@ -24,7 +25,7 @@ export default defineComponent({
               <div class={[styles.goodsTitle, 'van-ellipsis']}>
                 {item.productName}
               </div>
-              <div class={styles.model}>{item.productAttr}</div>
+              <div class={styles.model}>{formateAttr(item.productAttr)}</div>
               <div class={styles.goodsPrice}>
                 <span class={styles.price}>
                   <i>¥</i>

+ 2 - 1
src/views/shop-mall/components/shop-item/index.tsx

@@ -1,4 +1,5 @@
 import { moneyFormat } from '@/helpers/utils'
+import { formateAttr } from '@/views/cart/cart'
 import { Card } from 'vant'
 import { defineComponent } from 'vue'
 import styles from './index.module.less'
@@ -23,7 +24,7 @@ export default defineComponent({
         class={styles.item}
         thumb={item.productPic}
         title={item.productName}
-        desc={item.productAttr}
+        desc={formateAttr(item.productAttr)}
         price={moneyFormat(item.productPrice)}
         num={item.productQuantity}
       ></Card>

+ 0 - 8
src/views/shop-mall/modal/add-goods-cart/index.tsx

@@ -93,18 +93,10 @@ export default defineComponent({
       const selectItem = this.selectItem
       const item = this.item
       const body = {
-        productBrand: item.brandName,
         price: selectItem.price, //添加到购物车的价格
-        productCategoryId: item.productCategoryId, //商品分类
-        productName: item.name, // 商品名称
-        productPic: selectItem.pic, // 商品主图
-        productSkuCode: selectItem.skuCode, //商品sku条码
         productSkuId: selectItem.id,
-        productSn: item.productSn,
-        productSubTitle: item.subTitle, // 副标题
         quantity: this.total, // 数量
         productId: item.id,
-        productAttr: selectItem.spDataJson
       }
       // console.log(body)
       try {