lex 2 năm trước cách đây
mục cha
commit
22d0ad0469

+ 15 - 6
.eslintrc.js

@@ -5,19 +5,28 @@ module.exports = {
   },
   extends: [
     'plugin:vue/vue3-essential',
-    'eslint:recommended',
+    // 'eslint:recommended',
     '@vue/typescript/recommended',
     '@vue/prettier',
     '@vue/prettier/@typescript-eslint'
   ],
   rules: {
     '@typescript-eslint/no-explicit-any': ['off'],
-    "prettier/prettier": ["off", {
-      "singleQuote": true,
-      "semi": false
-    }]
+    'prettier/prettier': [
+      'off',
+      {
+        singleQuote: true,
+        semi: false
+      }
+    ],
+    'vue/multi-word-component-names': [
+      'error',
+      {
+        ignores: ['index'] //需要忽略的组件名
+      }
+    ]
   },
   parserOptions: {
     ecmaVersion: 2020
   }
-};
+}

+ 72 - 36
src/components/col-protocol/index.tsx

@@ -17,6 +17,22 @@ export default defineComponent({
     modelValue: {
       type: Boolean,
       default: false
+    },
+    userId: {
+      type: String,
+      default: ''
+    },
+    musicGroupId: {
+      type: String,
+      default: ''
+    },
+    courseView: {
+      type: String,
+      default: ''
+    },
+    protocolTitle: {
+      type: String,
+      default: '产品及服务协议'
     }
   },
   data() {
@@ -26,27 +42,40 @@ export default defineComponent({
       popupStatus: false,
       protocolHTML: '',
       protocolPopup: null as any,
-      baseUrl:
-        state.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
+      isProtocol: true
     }
   },
   async mounted() {
     try {
-      const res = await request.get(
-        this.baseUrl + '/sysUserContractRecord/checkContractSign',
-        {
-          params: {
-            contractType: 'BUY_ORDER'
+      console.log('getContractDetail')
+      // 判断是否有协议内容
+      if (!this.protocolHTML) {
+        const res = await request.get(
+          state.platformApi + '/contracts/queryProduceContract',
+          {
+            params: {
+              userId: this.userId ? this.userId : null,
+              musicGroupId: this.musicGroupId ? this.musicGroupId : null,
+              courseViewType: this.courseView
+            }
           }
-        }
-      )
-      // console.log(res)
-      this.exists = res.data
-      this.checked = this.checked || this.exists
-      this.$emit('update:modelValue', this.checked || this.exists)
+        )
+        this.protocolHTML = res.data.productContract || ''
+        console.log(res)
+
+        this.exists = res.data
+        this.checked = this.checked || this.exists
+        this.$emit('update:modelValue', this.checked || this.exists)
+      }
+
+      // 如果没有协议内容则不 显示协议
+      if (!this.protocolHTML) {
+        this.isProtocol = this.protocolHTML ? true : false
+        this.checked = true // 默认选中,学生端则不用默认选中
+        this.$emit('input', this.checked || this.exists)
+      }
     } catch {}
     this.checked = this.modelValue
-    // this.getContractDetail()
     window.addEventListener('hashchange', this.onHash, false)
   },
   unmounted() {
@@ -64,7 +93,7 @@ export default defineComponent({
         // 判断是否有协议内容
         if (!this.protocolHTML) {
           const res = await request.get(
-            this.baseUrl + '/sysUserContractRecord/queryContract',
+            state.platformApi + '/contracts/queryProduceContract',
             {
               params: {
                 contractType: 'BUY_ORDER'
@@ -103,27 +132,34 @@ export default defineComponent({
   },
   render() {
     return (
-      <div class={styles.colProtocol}>
-        {!this.exists && (
-          <Checkbox
-            v-model={this.checked}
-            v-slots={{
-              icon: (props: any) => (
-                <Icon
-                  class={styles.boxStyle}
-                  name={props.checked ? activeButtonIcon : inactiveButtonIcon}
-                  size="15"
-                />
-              )
-            }}
-          >
-            我已阅读并同意
-          </Checkbox>
+      <div class={this.isProtocol && styles.colProtocol}>
+        {/* 判断是否显示协议 */}
+        {this.isProtocol && (
+          <>
+            {!this.exists && (
+              <Checkbox
+                v-model={this.checked}
+                v-slots={{
+                  icon: (props: any) => (
+                    <Icon
+                      class={styles.boxStyle}
+                      name={
+                        props.checked ? activeButtonIcon : inactiveButtonIcon
+                      }
+                      size="15"
+                    />
+                  )
+                }}
+              >
+                我已阅读并同意
+              </Checkbox>
+            )}
+            {this.exists && <>查看</>}
+            <span onClick={this.onPopupClose} class={styles.protocolText}>
+              《{this.protocolTitle}》
+            </span>
+          </>
         )}
-        {this.exists && <>查看</>}
-        <span onClick={this.getContractDetail} class={styles.protocolText}>
-          《酷乐秀平台服务协议》
-        </span>
 
         <Popup
           ref={this.protocolPopup}
@@ -131,7 +167,7 @@ export default defineComponent({
           position="bottom"
           style={{ height: '100%' }}
         >
-          {this.showHeader && <ColHeader title="酷乐秀平台服务协议" />}
+          {this.showHeader && <ColHeader title={this.protocolTitle} />}
           {this.popupStatus && (
             <div class={styles.protocolContent} id="mProtocol">
               <div

+ 21 - 0
src/helpers/utils.ts

@@ -134,3 +134,24 @@ export const dateFormat = (
 ) => {
   return dayjs(value).format(format)
 }
+
+// 学生地址
+export function validStudentUrl() {
+  const url = window.location.href
+  let returnUrl = ''
+  if (/test/.test(url)) {
+    // test环境
+    returnUrl = 'http://mstutest.dayaedu.com'
+  } else if (/dev/.test(url)) {
+    // dev 环境
+    returnUrl = 'http://mstudev.dayaedu.com'
+  } else if (/online/.test(url)) {
+    //线上
+    returnUrl = 'https://mstuonline.dayaedu.com'
+  } else {
+    // 默认dev环境
+    // returnUrl = 'http://mstudev.dayaedu.com'
+    returnUrl = 'http://192.168.3.120:9001'
+  }
+  return returnUrl
+}

+ 50 - 15
src/views/cart/cart-confirm-agin/index.tsx

@@ -39,7 +39,10 @@ export default defineComponent({
     const authPopup = ref(false)
     const orderInfo = reactive({
       orderNo: cartConfirm.orderInfo?.orderSn || '',
-      actualPrice: cartConfirm.orderInfo?.payAmount || 0
+      actualPrice: cartConfirm.orderInfo?.payAmount || 0,
+      payMap: {
+        amount: cartConfirm.orderInfo?.payAmount || 0
+      }
     })
     //修复实名认证头部问题
     watch(authPopup, (value, oldValue) => {
@@ -58,24 +61,56 @@ export default defineComponent({
       }
       const users = state.user.data
       // 判断是否需要实名认证
-      if (!users?.realName || !users?.idCardNo) {
+      if (!users?.student.realName || !users?.student.idCardNo) {
         authPopup.value = true
         return
       }
-
+      console.log(orderInfo)
       // 判断是否有订单号
-      if (orderInfo.orderNo) {
-        paymentPopup.value = true
-        return
-      }
-      Toast('没有订单号!')
+      createOrder()
     }
     const router = useRouter()
 
-    //认证成功
-    const onAuthSuccess = () => {
-      authPopup.value = false
-      onSubmit() // 实名成功后自动支付
+    const createOrder = async () => {
+      const ids = cartConfirm.cartPromotionItemList.reduce(
+        (arr, value: any) => {
+          arr.push(value.id)
+          return arr
+        },
+        []
+      )
+      const body = {
+        cartIds: ids,
+        memberReceiveAddressId: address.value?.id,
+        platformType: state.platformType,
+        orderAmount: (
+          cartConfirm.calcAmount.payAmount -
+          cartConfirm.calcAmount.promotionAmount
+        ).toFixed(2)
+        // couponId: orderInfo.couponId
+      }
+      try {
+        const { code, data } = await request.post(
+          '/api-mall-portal/order/generateOrder',
+          { data: body }
+        )
+        if (code === 200) {
+          if (data.order.status === 1) {
+            router.replace({
+              path: `/shopTrade`,
+              query: {
+                orderNo: data?.order.orderSn,
+                id: data?.order.id
+              }
+            })
+            return
+          }
+          paymentPopup.value = true
+          // orderInfo.orderNo = data?.order.orderSn || ''
+          // orderInfo.actualPrice = data?.order.payAmount || 0
+          orderInfo.value = data?.pay
+        }
+      } catch (error) {}
     }
     return () => (
       <>
@@ -104,8 +139,8 @@ export default defineComponent({
                   </div>
                 ))}
               </div>
-              <CellGroup border={false}>
-                <Cell
+              <CellGroup border={true}>
+                {/* <Cell
                   border={false}
                   title="优惠劵"
                   v-slots={{
@@ -121,7 +156,7 @@ export default defineComponent({
                       </span>
                     )
                   }}
-                ></Cell>
+                ></Cell> */}
                 <Cell
                   border={false}
                   title="总额"

+ 11 - 18
src/views/cart/cart-confirm/index.tsx

@@ -27,6 +27,7 @@ import {
 } from '@/helpers/native-message'
 import UseCoupons, { couponEnum } from '@/views/order-detail/use-coupons'
 import { addressInfo, resestState } from '@/views/address/address'
+import { orderInfos } from '@/views/order-detail/orderStatus'
 export default defineComponent({
   name: 'cartConfirm',
   setup() {
@@ -74,11 +75,7 @@ export default defineComponent({
     const agreeStatus = ref(false)
     const paymentPopup = ref(false)
     const authPopup = ref(false)
-    const orderInfo = reactive({
-      orderNo: '',
-      actualPrice: 0,
-      couponId: ''
-    })
+    const orderInfo = ref<any>()
     //修复实名认证头部问题
     watch(authPopup, (value, oldValue) => {
       if (authPopup.value) {
@@ -95,21 +92,16 @@ export default defineComponent({
         return
       }
       if (!agreeStatus.value) {
-        Toast('请先阅读并同意《酷乐秀平台服务协议》')
+        Toast('请先阅读并同意《产品及服务协议》')
         return
       }
       const users = state.user.data
       // 判断是否需要实名认证
-      if (!users?.realName || !users?.idCardNo) {
+      if (!users?.student.realName || !users?.student.idCardNo) {
         authPopup.value = true
         return
       }
 
-      // 判断是否有订单号
-      if (orderInfo.orderNo) {
-        paymentPopup.value = true
-        return
-      }
       createOrder()
     }
     const router = useRouter()
@@ -129,8 +121,8 @@ export default defineComponent({
         orderAmount: (
           cartConfirm.calcAmount.payAmount -
           cartConfirm.calcAmount.promotionAmount
-        ).toFixed(2),
-        couponId: orderInfo.couponId
+        ).toFixed(2)
+        // couponId: orderInfo.couponId
       }
       try {
         const { code, data } = await request.post(
@@ -149,8 +141,9 @@ export default defineComponent({
             return
           }
           paymentPopup.value = true
-          orderInfo.orderNo = data?.order.orderSn || ''
-          orderInfo.actualPrice = data?.order.payAmount || 0
+          // orderInfo.orderNo = data?.order.orderSn || ''
+          // orderInfo.actualPrice = data?.order.payAmount || 0
+          orderInfo.value = data?.pay
         }
       } catch (error) {}
     }
@@ -189,7 +182,7 @@ export default defineComponent({
                       </div>
                     ))}
                   </div>
-                  <CellGroup border={false}>
+                  <CellGroup border={true}>
                     {/* <UseCoupons
                       orderType="GOODS"
                       orderAmount={cartConfirm.calcAmount.totalAmount}
@@ -253,7 +246,7 @@ export default defineComponent({
                 >
                   <Payment
                     v-model={paymentPopup.value}
-                    orderInfo={orderInfo}
+                    orderInfo={orderInfo.value}
                     paymentType="goodsPay"
                     onBackOut={() => (paymentPopup.value = false)}
                   />

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

@@ -27,7 +27,7 @@ export default defineComponent({
       page: {
         pageNum: 1,
         pageSize: 20
-      },
+      }
     }
   },
   watch: {
@@ -119,8 +119,7 @@ export default defineComponent({
           })
         }
         console.log(res)
-      } catch (error) {
-      }
+      } catch (error) {}
     },
 
     // 确认收货
@@ -155,8 +154,8 @@ export default defineComponent({
         <ColHeader
           ref="colHeader"
           class="header"
-          rightText="售后服务"
-          onClickRight={this.onClickRight}
+          // rightText="售后服务"
+          // onClickRight={this.onClickRight}
         />
         <Tabs
           v-model:active={this.active}

+ 1 - 25
src/views/order-detail/index.tsx

@@ -7,26 +7,14 @@ import styles from './index.module.less'
 import UserAuth from './userAuth'
 import request from '@/helpers/request'
 
-// 调用原生支付
-// postMessage({ api: 'paymentOrder', content: { orderNo: 0 } })
-// listenerMessage({ api: 'paymentResult', callback: (res: any) => {
-//   status: 'success | fail'
-// }})
-
 import iconTips from '@common/images/icon_tips.png'
 import Payment from './payment'
 import ColHeader from '@/components/col-header'
 import { state } from '@/state'
 import { orderInfos, orderStatus, resestState } from './orderStatus'
-import OrderVideo from './order-video'
-import OrderLive from './order-live'
-import OrderPractice from './order-practice'
 import OrderVip from './order-vip'
-import OrderMusic from './order-music'
 import { moneyFormat } from '@/helpers/utils'
-import OrderPinao from './order-pinao'
 import { getMusicDetail } from '@/student/trade/tradeOrder'
-import OrderActive from './order-active'
 import UseCoupon from './use-coupons'
 
 export default defineComponent({
@@ -207,20 +195,8 @@ export default defineComponent({
         {!this.loading && (
           <>
             {this.orderList.map((item: any) => {
-              if (item.orderType === 'VIDEO') {
-                return <OrderVideo item={item} />
-              } else if (item.orderType === 'LIVE') {
-                return <OrderLive item={item} />
-              } else if (item.orderType === 'PRACTICE') {
-                return <OrderPractice item={item} />
-              } else if (item.orderType === 'VIP') {
+              if (item.orderType === 'VIP') {
                 return <OrderVip item={item} />
-              } else if (item.orderType === 'MUSIC') {
-                return <OrderMusic item={item} />
-              } else if (item.orderType === 'PINAO_ROOM') {
-                return <OrderPinao item={item} />
-              } else if (item.orderType === 'ACTI_REGIST') {
-                return <OrderActive item={item} />
               }
             })}
 

+ 0 - 83
src/views/order-detail/order-active/index.module.less

@@ -1,83 +0,0 @@
-.liveOrder {
-  .tag {
-    margin-right: 5px;
-    padding: 2px 5px;
-    font-size: 11px;
-    font-weight: 500;
-    color: var(--van-primary);
-    line-height: 16px;
-    background: #e0f7f3;
-    border-radius: 4px;
-    vertical-align: middle;
-  }
-  .title {
-    font-size: 16px;
-    font-weight: 500;
-    color: #333333;
-  }
-
-  .collapseItem {
-    :global(.van-cell) {
-      background: #f7f8f9;
-      padding-top: 9px;
-      padding-bottom: 9px;
-    }
-  }
-
-  .line {
-    margin-right: 6px;
-    display: inline-block;
-    width: 4px;
-    height: 12px;
-    border-radius: 4px;
-    background: linear-gradient(to bottom, #59e5d5, #01c1b5);
-    vertical-align: middle;
-  }
-
-  .teacher {
-    flex: 1 auto;
-    margin-left: 12px;
-    color: #1a1a1a;
-    font-size: 16px;
-    font-weight: 500;
-    max-width: 180px;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
-  }
-
-  .price {
-    font-size: 16px;
-    font-weight: 500;
-    color: #ff3535;
-    line-height: 20px;
-    i {
-      font-style: normal;
-      font-size: 14px;
-    }
-  }
-  .userLogo {
-    width: 42px;
-    height: 42px;
-    overflow: hidden;
-    border-radius: 50%;
-  }
-  .classItem {
-    font-size: 14px;
-    color: #333333;
-    line-height: 20px;
-    .time {
-      padding-bottom: 6px;
-    }
-    p {
-      color: var(--van-primary);
-    }
-  }
-  :global {
-    .van-cell-group {
-      margin-bottom: 10px;
-      border-radius: 8px;
-      overflow: hidden;
-    }
-  }
-}

+ 0 - 73
src/views/order-detail/order-active/index.tsx

@@ -1,73 +0,0 @@
-import { Cell, CellGroup, Collapse, CollapseItem, Image } from 'vant'
-import { defineComponent } from 'vue'
-import styles from './index.module.less'
-
-import activityLogo from '../images/activity_logo.png'
-import { moneyFormat } from '@/helpers/utils'
-
-export default defineComponent({
-  name: 'OrderLive',
-  props: {
-    item: {
-      type: Object,
-      default: {}
-    }
-  },
-  data() {
-    return {
-      collapse: [1]
-    }
-  },
-  render() {
-    const item = this.item
-    return (
-      <div class={styles.liveOrder}>
-        <CellGroup border={false}>
-          <Cell
-            center
-            v-slots={{
-              title: () => (
-                <div class={[styles.title, 'van-ellipsis']}>
-                  <span class={styles.line}></span>
-                  活动报名
-                </div>
-              )
-            }}
-          />
-          <Cell
-            center
-            border={false}
-            title={item.goodsName}
-            titleClass={styles.teacher}
-            v-slots={{
-              icon: () => <Image class={styles.userLogo} src={activityLogo} />,
-              default: () => (
-                <span class={styles.price}>
-                  <i>¥</i>
-                  {moneyFormat(item.actualPrice)}
-                </span>
-              )
-            }}
-          />
-          {/* 
-          <Cell border={false}>
-            <Collapse border={false} v-model={this.collapse}>
-              <CollapseItem
-                title="课程详情"
-                name={1}
-                class={styles.collapseItem}
-              >
-                <div class={styles.classItem}>
-                  {item.courseInfo.map((item: any) => (
-                    <div class={styles.time}>{item.courseTime}</div>
-                  ))}
-                </div>
-              </CollapseItem>
-            </Collapse>
-          </Cell> */}
-        </CellGroup>
-      </div>
-      // 视频课
-    )
-  }
-})

+ 0 - 68
src/views/order-detail/order-live/index.module.less

@@ -1,68 +0,0 @@
-.liveOrder {
-  .tag {
-    margin-right: 5px;
-    padding: 2px 5px;
-    font-size: 11px;
-    font-weight: 500;
-    color: var(--van-primary);
-    line-height: 16px;
-    background: #e0f7f3;
-    border-radius: 4px;
-    vertical-align: middle;
-  }
-  .title {
-    font-size: 16px;
-    font-weight: 500;
-    color: #333333;
-  }
-
-  .collapseItem {
-    :global(.van-cell) {
-      background: #f7f8f9;
-      padding-top: 9px;
-      padding-bottom: 9px;
-    }
-  }
-
-  .teacher {
-    margin-left: 5px;
-    color: #1a1a1a;
-    font-size: 16px;
-    font-weight: 500;
-  }
-
-  .price {
-    font-size: 16px;
-    font-weight: 500;
-    color: #ff3535;
-    line-height: 20px;
-    i {
-      font-style: normal;
-      font-size: 14px;
-    }
-  }
-  .userLogo {
-    width: 28px;
-    height: 28px;
-    overflow: hidden;
-    border-radius: 50%;
-  }
-  .classItem {
-    font-size: 14px;
-    color: #333333;
-    line-height: 20px;
-    .time {
-      padding-bottom: 6px;
-    }
-    p {
-      color: var(--van-primary);
-    }
-  }
-  :global {
-    .van-cell-group {
-      margin-bottom: 10px;
-      border-radius: 8px;
-      overflow: hidden;
-    }
-  }
-}

+ 0 - 77
src/views/order-detail/order-live/index.tsx

@@ -1,77 +0,0 @@
-import { Cell, CellGroup, Collapse, CollapseItem, Image } from 'vant'
-import { defineComponent } from 'vue'
-import styles from './index.module.less'
-
-import iconTeacher from '@common/images/icon_teacher.png'
-import { moneyFormat } from '@/helpers/utils'
-
-export default defineComponent({
-  name: 'OrderLive',
-  props: {
-    item: {
-      type: Object,
-      default: {}
-    }
-  },
-  data() {
-    return {
-      collapse: [1]
-    }
-  },
-  render() {
-    const item = this.item
-    return (
-      <div class={styles.liveOrder}>
-        <CellGroup border={false}>
-          <Cell
-            center
-            v-slots={{
-              title: () => (
-                <div class={[styles.title, 'van-ellipsis']}>
-                  <span class={styles.tag}>直播课</span>
-                  {item.courseGroupName}
-                </div>
-              )
-            }}
-          />
-          <Cell
-            center
-            border={false}
-            title={item.teacherName}
-            titleClass={styles.teacher}
-            v-slots={{
-              icon: () => (
-                <Image
-                  class={styles.userLogo}
-                  src={item.avatar || iconTeacher}
-                />
-              ),
-              default: () => (
-                <span class={styles.price}>
-                  <i>¥</i>
-                  {moneyFormat(item.coursePrice)}
-                </span>
-              )
-            }}
-          />
-          <Cell border={false}>
-            <Collapse border={false} v-model={this.collapse}>
-              <CollapseItem
-                title="课程详情"
-                name={1}
-                class={styles.collapseItem}
-              >
-                <div class={styles.classItem}>
-                  {item.courseInfo.map((item: any) => (
-                    <div class={styles.time}>{item.courseTime}</div>
-                  ))}
-                </div>
-              </CollapseItem>
-            </Collapse>
-          </Cell>
-        </CellGroup>
-      </div>
-      // 视频课
-    )
-  }
-})

+ 0 - 81
src/views/order-detail/order-music/index.module.less

@@ -1,81 +0,0 @@
-.item {
-  background-color: var(--music-list-item-background-color);
-  // margin: 10px 14px;
-  margin-bottom: 12px;
-  padding: 10px;
-  border-radius: 9px;
-  .header {
-    display: flex;
-    align-items: center;
-    border-bottom: 1px solid var(--music-list-item-border-color);
-    padding-bottom: 12px;
-    .mate {
-      display: flex;
-      flex: 1;
-      align-items: center;
-      .icon {
-        width: 40px;
-        height: 40px;
-      }
-      .info {
-        margin-left: 14px;
-        > h4 {
-          color: var(--music-list-item-title-color);
-          font-size: 14px;
-          font-weight: 600;
-        }
-        > p {
-          color: var(--music-list-item-mate-color);
-          line-height: 17px;
-        }
-      }
-    }
-    .btn {
-      width: 54px;
-      height: 22px;
-      font-size: 12px;
-      border-radius: 11px;
-      padding: 0;
-      border: none;
-      &.vip {
-        background-color: var(--music-list-item-vip-bg);
-        color: var(--music-list-item-vip-color);
-      }
-      &.free {
-        background-color: var(--music-list-item-free-bg);
-        color: var(--music-list-item-free-color);
-      }
-      &.charge {
-        background-color: var(--music-list-item-charge-bg);
-        color: var(--music-list-item-charge-color);
-      }
-    }
-  }
-  .footer {
-    display: flex;
-    padding-top: 8px;
-    align-items: center;
-    justify-content: space-between;
-    .user {
-      display: flex;
-      align-items: center;
-      padding: 0 10px;
-      .userIcon {
-        width: 20px;
-        height: 20px;
-        margin-right: 8px;
-      }
-    }
-    .favorite {
-      font-size: 16px;
-    }
-    .tags {
-      display: flex;
-      align-items: center;
-      --van-tag-default-color: #fff1de;
-      --van-tag-text-color: #ff8c00;
-    }
-  }
-
-  --van-button-disabled-opacity: 1;
-}

+ 0 - 75
src/views/order-detail/order-music/index.tsx

@@ -1,75 +0,0 @@
-import { Button, Icon, Image, Tag } from 'vant'
-import classNames from 'classnames'
-import MusicIcon from '@/views/music/list/icons/music-icon.png'
-import InitUserIcon from '@/views/music/list/icons/init-user-icon.png'
-// import FavoriteIcon from '@/student/music/album/favorite.svg'
-// import FavoritedIcon from '@/student/music/album/favorited.svg'
-import { defineComponent } from 'vue'
-import styles from './index.module.less'
-
-const chargeTypes = {
-  CHARGE: '点播',
-  FREE: '免费',
-  VIP: 'VIP'
-}
-
-export default defineComponent({
-  name: 'OrderMusic',
-  props: {
-    item: {
-      type: Object,
-      default: {}
-    }
-  },
-  render() {
-    const item = this.item
-    return (
-      <div class={styles.item}>
-        <header class={styles.header}>
-          <div class={styles.mate}>
-            <Image src={item.titleImg || MusicIcon} round class={styles.icon} />
-            <div class={styles.info}>
-              <h4>{item.musicSheetName}</h4>
-              <p>{item.composer}</p>
-            </div>
-          </div>
-          <div class={styles.buttons}>
-            <Button
-              class={classNames(
-                styles.btn,
-                styles[item.chargeType.toLocaleLowerCase()]
-              )}
-              disabled
-            >
-              {chargeTypes[item.chargeType]}
-              <Icon name="arrow" />
-            </Button>
-          </div>
-        </header>
-        <footer class={styles.footer}>
-          <div class={styles.user}>
-            <Image
-              round
-              src={item.addUserAvatar || InitUserIcon}
-              class={styles.userIcon}
-            />
-            <p>{item.addName}</p>
-            <div class={styles.tags}>
-              {(item.subjectNames || '').split(',').map(item => (
-                <Tag>{item}</Tag>
-              ))}
-            </div>
-          </div>
-          <div class={styles.icons}>
-            {/* <Button style={{ border: 'none' }} disabled>
-              <Icon
-                class={styles.favorite}
-                name={this.data.value ? FavoritedIcon : FavoriteIcon}
-              />
-            </Button> */}
-          </div>
-        </footer>
-      </div>
-    )
-  }
-})

+ 0 - 48
src/views/order-detail/order-pinao/index.module.less

@@ -1,48 +0,0 @@
-.memberLogo {
-  width: 53px;
-  height: 50px;
-}
-
-.titleClass {
-  padding-left: 20px;
-}
-
-.title {
-  font-size: 16px;
-  font-weight: 500;
-  color: #333333;
-  line-height: 22px;
-}
-
-.price {
-  padding-top: 3px;
-  font-size: 16px;
-  font-weight: 500;
-  color: #ff4e19;
-  line-height: 20px;
-  i {
-    font-style: normal;
-    font-size: 14px;
-  }
-}
-
-.timerTitle {
-  display: flex;
-  align-items: center;
-  font-size: 14px;
-  font-weight: 500;
-  color: #333333;
-  line-height: 20px;
-  padding-right: 12px;
-}
-
-.timer {
-  font-size: 13px;
-  color: #999999;
-  line-height: 18px;
-}
-
-.timerCell {
-  display: flex;
-  align-items: center;
-}

+ 0 - 62
src/views/order-detail/order-pinao/index.tsx

@@ -1,62 +0,0 @@
-import { Cell, CellGroup, Icon, Image } from 'vant'
-import { defineComponent } from 'vue'
-import styles from './index.module.less'
-import iconPinao from '@common/images/icon_pinao.png'
-
-export default defineComponent({
-  name: 'OrderPinao',
-  props: {
-    item: {
-      type: Object,
-      default: {}
-    }
-  },
-  render() {
-    const item = this.item
-    console.log(item)
-    return (
-      <div class={styles.videoOrder}>
-        <CellGroup
-          class={'mb12'}
-          border={false}
-          style={{ borderRadius: '8px' }}
-        >
-          <Cell
-            center
-            titleClass={styles.titleClass}
-            v-slots={{
-              icon: () => <Image class={styles.memberLogo} src={iconPinao} />,
-              title: () => (
-                <div class={styles.container}>
-                  <div class={styles.title}>{item.times}分钟琴房时长</div>
-                  <div class={styles.price}>
-                    <i>¥</i>
-                    {(this as any).$filters.moneyFormat(item.salePrice)}
-                  </div>
-                </div>
-              )
-            }}
-          />
-
-          {/* <Cell
-            center
-            v-slots={{
-              title: () => (
-                <div class={styles.timerCell}>
-                  <div class={styles.timerTitle}>
-                    <Icon name={iconTimer} size={18} />
-                    <span style={{ paddingLeft: '5px' }}>生效时间</span>
-                  </div>
-                  <div class={styles.timer}>
-                    {item.startTime} 至 {item.endTime}
-                  </div>
-                </div>
-              )
-            }}
-          /> */}
-        </CellGroup>
-      </div>
-      // 视频课
-    )
-  }
-})

+ 0 - 68
src/views/order-detail/order-practice/index.module.less

@@ -1,68 +0,0 @@
-.videoOrder {
-  .tag {
-    margin-right: 5px;
-    padding: 2px 5px;
-    font-size: 11px;
-    font-weight: 500;
-    color: #ff3535;
-    line-height: 16px;
-    background: #ffece6;
-    border-radius: 4px;
-    vertical-align: middle;
-  }
-  .title {
-    font-size: 16px;
-    font-weight: 500;
-    color: #333333;
-  }
-
-  .collapseItem {
-    :global(.van-cell) {
-      background: #f7f8f9;
-      padding-top: 9px;
-      padding-bottom: 9px;
-    }
-  }
-
-  .teacher {
-    margin-left: 5px;
-    color: #1a1a1a;
-    font-size: 16px;
-    font-weight: 500;
-  }
-
-  .price {
-    font-size: 16px;
-    font-weight: 500;
-    color: #ff3535;
-    line-height: 20px;
-    i {
-      font-style: normal;
-      font-size: 14px;
-    }
-  }
-  .userLogo {
-    width: 28px;
-    height: 28px;
-    overflow: hidden;
-    border-radius: 50%;
-  }
-  .classItem {
-    font-size: 14px;
-    color: #333333;
-    line-height: 20px;
-    .time {
-      padding-bottom: 6px;
-    }
-    p {
-      color: var(--van-primary);
-    }
-  }
-  :global {
-    .van-cell-group {
-      margin-bottom: 10px;
-      border-radius: 8px;
-      overflow: hidden;
-    }
-  }
-}

+ 0 - 84
src/views/order-detail/order-practice/index.tsx

@@ -1,84 +0,0 @@
-import { Cell, CellGroup, Collapse, CollapseItem, Image, Rate } from 'vant'
-import { defineComponent } from 'vue'
-import styles from './index.module.less'
-
-import iconTeacher from '@common/images/icon_teacher.png'
-import { moneyFormat } from '@/helpers/utils'
-import dayjs from 'dayjs'
-
-export default defineComponent({
-  name: 'OrderPractice',
-  props: {
-    item: {
-      type: Object,
-      default: {}
-    }
-  },
-  data() {
-    return {
-      collapse: [1]
-    }
-  },
-  render() {
-    const item = this.item
-    console.log(item.classTime)
-    return (
-      <div class={styles.videoOrder}>
-        <CellGroup border={false}>
-          <Cell
-            center
-            v-slots={{
-              title: () => (
-                <div class={[styles.title, 'van-ellipsis']}>
-                  <span class={styles.tag}>陪练课</span>
-                  {item.courseGroupName}
-                </div>
-              )
-            }}
-          />
-          <Cell
-            center
-            border={false}
-            title={item.teacherName}
-            titleClass={styles.teacher}
-            v-slots={{
-              icon: () => (
-                <Image
-                  class={styles.userLogo}
-                  src={item.avatar || iconTeacher}
-                />
-              ),
-              default: () => (
-                <>
-                  <span class={styles.price}>
-                    <i>¥</i>
-                    {moneyFormat(item.coursePrice)}
-                  </span>
-                  /{item.classTime.length}课时
-                </>
-              )
-            }}
-          />
-          <Cell border={false}>
-            <Collapse border={false} v-model={this.collapse}>
-              <CollapseItem
-                title="课程详情"
-                name={1}
-                class={styles.collapseItem}
-              >
-                <div class={styles.classItem}>
-                  {item.classTime.map((item: any) => {
-                    const dateTime = `${item.classDate} ${dayjs(
-                      item.startTime
-                    ).format('HH:mm')}-${dayjs(item.endTime).format('HH:mm')}`
-                    return <div class={styles.time}>{dateTime}</div>
-                  })}
-                </div>
-              </CollapseItem>
-            </Collapse>
-          </Cell>
-        </CellGroup>
-      </div>
-    )
-  }
-})

+ 0 - 61
src/views/order-detail/order-video/index.module.less

@@ -1,61 +0,0 @@
-.videoOrder {
-  .tag {
-    margin-right: 5px;
-    padding: 2px 5px;
-    font-size: 11px;
-    font-weight: 500;
-    color: #ff8900;
-    line-height: 16px;
-    background: #fff0d9;
-    border-radius: 4px;
-    vertical-align: middle;
-  }
-  .title {
-    font-size: 16px;
-    font-weight: 500;
-    color: #333333;
-  }
-
-  .teacher {
-    margin-left: 5px;
-    color: #1a1a1a;
-    font-size: 16px;
-    font-weight: 500;
-  }
-
-  .price {
-    font-size: 16px;
-    font-weight: 500;
-    color: #ff3535;
-    line-height: 20px;
-    i {
-      font-style: normal;
-      font-size: 14px;
-    }
-  }
-  .userLogo {
-    width: 28px;
-    height: 28px;
-    overflow: hidden;
-    border-radius: 50%;
-  }
-  .classItem {
-    font-size: 14px;
-    color: #333333;
-    line-height: 20px;
-    padding-bottom: 10px;
-    .time {
-      padding-bottom: 6px;
-    }
-    p {
-      color: var(--van-primary);
-    }
-  }
-  :global {
-    .van-cell-group {
-      margin-bottom: 10px;
-      border-radius: 8px;
-      overflow: hidden;
-    }
-  }
-}

+ 0 - 57
src/views/order-detail/order-video/index.tsx

@@ -1,57 +0,0 @@
-import { Cell, CellGroup, Image } from 'vant'
-import { defineComponent } from 'vue'
-import styles from './index.module.less'
-import { orderStatus } from '../orderStatus'
-
-import iconTeacher from '@common/images/icon_teacher.png'
-import request from '@/helpers/request'
-import { moneyFormat } from '@/helpers/utils'
-
-export default defineComponent({
-  name: 'OrderVideo',
-  props: {
-    item: {
-      type: Object,
-      default: {}
-    }
-  },
-  render() {
-    const item = this.item
-    return (
-      <div class={styles.videoOrder}>
-        <CellGroup border={false}>
-          <Cell
-            center
-            v-slots={{
-              title: () => (
-                <div class={[styles.title, 'van-ellipsis']}>
-                  <span class={styles.tag}>视频课</span>
-                  {item.courseGroupName}
-                </div>
-              )
-            }}
-          />
-          <Cell
-            center
-            title={item.teacherName}
-            titleClass={styles.teacher}
-            v-slots={{
-              icon: () => (
-                <Image
-                  class={styles.userLogo}
-                  src={item.avatar || iconTeacher}
-                />
-              ),
-              default: () => (
-                <span class={styles.price}>
-                  <i>¥</i>
-                  {moneyFormat(item.coursePrice)}
-                </span>
-              )
-            }}
-          />
-        </CellGroup>
-      </div>
-    )
-  }
-})

+ 61 - 104
src/views/order-detail/payment/index.tsx

@@ -18,25 +18,7 @@ import { defineComponent, PropType } from 'vue'
 
 import styles from './index.module.less'
 import { state } from '@/state'
-import { orderStatus } from '../orderStatus'
-
-interface IOrderInfo {
-  orderNo: string | number
-  actualPrice: string | number
-}
-
-const urlFix =
-  state.platformType === 'TEACHER' ? '/api-teacher' : '/api-student'
-const urlType = {
-  goodsPay: {
-    cancelUrl: '/api-mall-portal/order/cancelUserOrder',
-    payUrl: '/api-mall-portal/payment/orderPay'
-  },
-  orderPay: {
-    cancelUrl: urlFix + '/userOrder/orderCancel',
-    payUrl: urlFix + '/userOrder/orderPay'
-  }
-}
+import { validStudentUrl } from '@/helpers/utils'
 
 export default defineComponent({
   name: 'payment',
@@ -46,10 +28,9 @@ export default defineComponent({
       default: false
     },
     orderInfo: {
-      type: Object as PropType<IOrderInfo>,
-      default: {
-        orderNo: '',
-        actualPrice: 0
+      type: Object,
+      default: () => {
+        return {}
       }
     },
     onBackOut: {
@@ -67,9 +48,6 @@ export default defineComponent({
       pay_channel: ''
     }
   },
-  unmounted() {
-    removeListenerMessage('paymentOperation', this.paymentOperation)
-  },
   methods: {
     onClose() {
       Dialog.confirm({
@@ -83,20 +61,8 @@ export default defineComponent({
         })
     },
     async onCancel(noBack?: boolean) {
-      try {
-        await request.post(urlType[this.paymentType].cancelUrl, {
-          data: {
-            orderNo: this.orderInfo.orderNo
-          }
-        })
-      } catch {}
       // 不管接口是否报错,都返回
       this.$emit('update:modelValue', false)
-      // 为了单独处理支付 曲目购买
-      if (!noBack && orderStatus.orderObject.orderType == 'MUSIC') {
-        postMessage({ api: 'back', content: {} })
-        return
-      }
 
       !noBack && this.$router.go(-1)
       this.onBackOut && this.onBackOut()
@@ -104,83 +70,72 @@ export default defineComponent({
     async onSubmit() {
       // 支付...
       try {
-        const params = {
-          orderNo: this.orderInfo.orderNo,
-          payChannel: this.payType,
-          paymentClient: null as any
-        }
-        if (this.paymentType === 'goodsPay') {
-          params.paymentClient = state.platformType
-        }
-        const res = await request.post(urlType[this.paymentType].payUrl, {
-          data: {
-            ...params
-          }
-        })
-        postMessage({
-          api: 'paymentOrder',
-          content: {
-            orderNo: this.orderInfo.orderNo,
-            payChannel: this.payType,
-            // payInfo: `alipays://platformapi/startapp?saId=10000007&qrcode=${res.data.pay_info}`
-            payInfo: res.data.pay_info
-          }
-        })
+        console.log(this.orderInfo, 'orderInfo payment')
         Toast.loading({
           message: '支付中...',
           forbidClick: true,
           duration: 3000,
           loadingType: 'spinner'
         })
-        Toast.clear()
+
+        const pt = this.payType,
+          ua = window.navigator.userAgent.toLowerCase()
+        // 判断当前浏览器
+        if (ua.match(/MicroMessenger/i) + '' == 'micromessenger') {
+          // 微信浏览器
+          if (pt == 'ali_app') {
+            this.pay_channel = 'alipay_qr'
+            this.getCodePay('qrCode')
+          } else if (pt == 'wx_app') {
+            this.pay_channel = 'wx_pub'
+            this.getCodePay('pay')
+          }
+        } else if (ua.match(/AlipayClient/i) + '' == 'alipayclient') {
+          // 支付宝浏览器
+          if (pt == 'ali_app') {
+            this.pay_channel = 'alipay_wap'
+            // 支付宝 H5 支付
+            this.getCodePay('pay')
+          } else if (pt == 'wx_app') {
+            this.pay_channel = 'wx_pub'
+            this.getCodePay('qrCode')
+          }
+        } else {
+          if (pt == 'ali_app') {
+            this.pay_channel = 'alipay_qr'
+          } else if (pt == 'wx_app') {
+            this.pay_channel = 'wx_pub'
+          }
+          this.getCodePay('qrCode')
+        }
         this.$emit('update:modelValue', false)
-        // 唤起支付时状态
-        listenerMessage('paymentOperation', result => {
-          console.log(result, 'init paymentOperation')
-          this.paymentOperation(result?.content)
-        })
+
+        setTimeout(() => {
+          Toast.clear()
+        }, 1000)
       } catch (e: any) {
         console.log(e)
       }
     },
-    paymentOperation(res: any) {
-      console.log(res, 'paymentOperation', this.paymentType, this.orderInfo)
-
-      // 支付状态
-      // paymentOperation  支付成功:success 支付失败:error 支付取消:cancel 未安装:fail
-      // error 只有安卓端有
-      if (res.status === 'success' || res.status === 'error') {
-        Toast.clear()
-        this.$emit('update:modelValue', false)
-        if (this.paymentType === 'goodsPay') {
-          this.$router.replace({
-            path: '/shopTrade',
-            query: {
-              orderNo: this.orderInfo.orderNo
-            }
-          })
-          return
-        }
-        this.$router.replace({
-          path: '/tradeDetail',
-          query: {
-            orderNo: this.orderInfo.orderNo
-          }
-        })
-      } else if (res.status === 'cancel') {
-        Toast.clear()
-        this.$emit('update:modelValue', false)
-      } else if (res.status === 'fail') {
-        const message =
-          this.payType === 'ali_app' ? '您尚未安装支付宝' : '您尚未安装微信'
-        Dialog.alert({
-          title: '提示',
-          message
-        }).then(() => {
-          Toast.clear()
-          this.$emit('update:modelValue', false)
-        })
+    getCodePay(code) {
+      // 二维码页面, 唤起支付页面
+      let url = validStudentUrl()
+      if (code == 'qrCode') {
+        url += `/#/payQRCode`
+      } else {
+        url += `/#/payResult`
       }
+      const orderInfo = this.orderInfo
+      orderInfo.payMap.returnUrl = orderInfo.payMap.returnUrl.replace(
+        /&/gi,
+        '^^'
+      )
+      const navHeight = sessionStorage.getItem('navHeight') || 0
+      // p 表示是商品购买,需要单独去学生端处理
+      url += `?payType=${this.pay_channel}&payment=${JSON.stringify(
+        this.orderInfo
+      )}&navHeight=${navHeight}'&platform=goods`
+      window.location.href = url
     }
   },
   render() {
@@ -192,7 +147,9 @@ export default defineComponent({
         <div class={styles.payAmount}>
           <p>应付金额</p>
           <div class={styles.amount}>
-            {(this as any).$filters.moneyFormat(this.orderInfo.actualPrice)}
+            {(this as any).$filters.moneyFormat(
+              this.orderInfo.payMap.amount || 0
+            )}
             <span>元</span>
           </div>
         </div>

+ 15 - 3
src/views/order-detail/userAuth/index.tsx

@@ -17,21 +17,33 @@ export default defineComponent({
       default: () => {}
     }
   },
+  computed: {
+    students() {
+      const students = state.user.data?.student || {}
+      return students
+    }
+  },
   data() {
     return {
       form: {
+        id: state.user.data.id,
+        certificateType: 'IDENTITY',
         realName: '',
         idCardNo: ''
       }
     }
   },
+  mounted() {
+    this.form.realName = this.students.realName
+    this.form.idCardNo = this.students.idCardNo
+  },
   methods: {
     async onSubmit() {
       try {
-        await request.post('/api-auth/user/realNameAuth', {
+        await request.post('/api-auth/user/update', {
+          requestType: 'form',
           data: {
-            ...this.form,
-            save: true
+            ...this.form
           }
         })
         Toast('实名成功')

+ 0 - 2
src/views/shop-mall/index.tsx

@@ -162,14 +162,12 @@ export default defineComponent({
                 isTab={true}
                 productAttributeCategoryId={0}
                 onOpenWebView={this.openWebView}
-                showAdd={false}
               />
             </Tab>
             {this.productCategoryList.map((item: any) => (
               <Tab title={item.name} name={item.id}>
                 <TabList
                   isTab={true}
-                  showAdd={false}
                   productAttributeCategoryId={item.id}
                   onOpenWebView={this.openWebView}
                 />

+ 14 - 11
src/views/shop-mall/modal/add-goods-cart/index.tsx

@@ -22,7 +22,7 @@ export default defineComponent({
   props: {
     show: {
       type: Boolean,
-      default: false,
+      default: false
     },
     item: {
       type: Object,
@@ -41,9 +41,10 @@ export default defineComponent({
       default: (n: any) => {}
     }
   },
-  watch:{
-    show(val){ // 添加购物车显示
-      if (val){
+  watch: {
+    show(val) {
+      // 添加购物车显示
+      if (val) {
         this.totalData = {}
         this.total = 1
         this.radio = ''
@@ -64,7 +65,7 @@ export default defineComponent({
       const radio = this.radio
       const select = this.skuStockList.find((n: any) => n.id == radio) as any
       if (select) {
-        let stock : number = select.stock - select.lockStock //- select.cartNum
+        let stock: number = select.stock - select.lockStock //- select.cartNum
         return {
           ...select,
           stock
@@ -75,11 +76,11 @@ export default defineComponent({
       }
     }
   },
-  mounted(){
+  mounted() {
     this.setList()
   },
   methods: {
-    setList(){
+    setList() {
       // 处理规格
       let skuStockList = [] as any
       const item = JSON.parse(JSON.stringify(this.item))
@@ -123,7 +124,9 @@ export default defineComponent({
         quantity: this.total, // 数量
         productId: item.id,
         hidden: this.showType === 'cart' ? 0 : 1,
-        promoterId: this.$route.query.promoterId ? this.$route.query.promoterId : undefined
+        promoterId: this.$route.query.promoterId
+          ? this.$route.query.promoterId
+          : undefined
       }
       // console.log(body)
       try {
@@ -180,11 +183,11 @@ export default defineComponent({
     },
 
     // 更新产品规格的库存
-    setProductStock(n: number){
+    setProductStock(n: number) {
       // 根据当前用户的购物车,当前产品规格的数量,限制库存
-      for(let i = 0; i < this.skuStockList.length; i++){
+      for (let i = 0; i < this.skuStockList.length; i++) {
         if ((this.skuStockList[i] as any).id === this.radio) {
-          (this.skuStockList[i] as any).cartNum = n
+          ;(this.skuStockList[i] as any).cartNum = n
         }
       }
     }