Browse Source

添加议标

lex 2 years ago
parent
commit
f54be98dbf

+ 1 - 0
public/MP_verify_JBxw7GJRojiTpURa.txt

@@ -0,0 +1 @@
+JBxw7GJRojiTpURa

+ 4 - 4
src/helpers/utils.ts

@@ -32,10 +32,10 @@ export const browser = () => {
 }
 
 // 获取授权的code码
-export const getUrlCode = () => {
+export const getUrlCode = (name = 'code') => {
   // 截取url中的code方法
   const url = location.search;
-  const theRequest = new Object();
+  const theRequest: any = new Object();
   if (url.indexOf("?") != -1) {
     const str = url.substr(1);
     const strs = str.split("&");
@@ -43,8 +43,8 @@ export const getUrlCode = () => {
       theRequest[strs[i].split("=")[0]] = strs[i].split("=")[1];
     }
   }
-  console.log(theRequest);
-  return theRequest;
+  console.log(theRequest, 'theRequest');
+  return theRequest[name];
 
 };
 

+ 1 - 1
src/school/approval-manage/course-adjust.tsx

@@ -200,7 +200,7 @@ export default defineComponent({
           </div>
 
           {/* 选择训练开始日期 */}
-          <OPopup v-model:modelValue={state.showPopoverTime} position="bottom">
+          <OPopup v-model:modelValue={state.showPopoverTime} position="bottom" destroy>
             <Calendar
               list={state.calendarList}
               nextMonth={(date: Date) => getList(date)}

+ 9 - 6
src/school/companion-teacher/index.tsx

@@ -41,7 +41,7 @@ export default defineComponent({
       statusText: '状态',
       params: {
         keyword: null,
-        status: null,
+        delFlag: null,
         subjectId: null,
         page: 1,
         rows: 20
@@ -228,8 +228,9 @@ export default defineComponent({
                     </div>
                   ),
                   value: () => (
-                    <span class={[styles.status, item.status === 'LOCKED' ? styles.frozen : '']}>
-                      {manageTeacherType[item.status]}
+                    <span class={[styles.status, !item.delFlag ? styles.frozen : '']}>
+                      {/* {manageTeacherType[item.status]} */}
+                      {item.delFlag ? '绑定' : '解绑'}
                     </span>
                   )
                 }}
@@ -355,14 +356,16 @@ export default defineComponent({
           actions={
             [
               { name: '全部', id: 'ALL' },
+              { name: '解绑', id: false },
+              { name: '绑定', id: true }
               // { name: '注销', id: 'CANCEL' },
-              { name: '冻结', id: 'LOCKED' },
-              { name: '正常', id: 'ACTIVATION' }
+              // { name: '冻结', id: 'LOCKED' },
+              // { name: '正常', id: 'ACTIVATION' }
             ] as any
           }
           onSelect={(val: any) => {
             form.statusText = val.name
-            form.params.status = val.id === 'ALL' ? null : val.id
+            form.params.delFlag = val.id === 'ALL' ? null : val.id
             form.oPopover = false
             onSearch()
           }}

+ 1 - 1
src/school/train-planning/component/standard/index.tsx

@@ -270,7 +270,7 @@ export default defineComponent({
         </Popup>
 
         {/* 选择训练开始日期 */}
-        <OPopup v-model:modelValue={forms.calendarStatus} position="bottom">
+        <OPopup v-model:modelValue={forms.calendarStatus} position="bottom" destroy>
           <Calendar
             list={forms.calendarList}
             nextMonth={(date: Date) => getList(date)}

+ 2 - 0
src/school/train-planning/modal/calendar/index.tsx

@@ -120,12 +120,14 @@ export default defineComponent({
       if (this.arrowStatus) return
       const tempDate = dayjs(this.currentDate).subtract(1, 'month')
       this._monthChange(tempDate)
+      // this._dayChange(this.minDate)
       this.prevMonth && this.prevMonth(this.minDate)
     },
     onNextMonth() {
       // 下一月
       const tempDate = dayjs(this.currentDate).add(1, 'month')
       this._monthChange(tempDate)
+      // this._dayChange(this.minDate)
       this.nextMonth && this.nextMonth(this.minDate)
     },
     _monthChange(date: any) {

+ 1 - 1
src/school/train-planning/modal/timer/index.tsx

@@ -176,7 +176,7 @@ export default defineComponent({
       <div class={styles.timer}>
         <OHeader title="训练时间" desotry={false} />
 
-        <div class={styles.selectTimer}>{dayjs(state.calendarDate).format('YYYY年MM月DD日')}</div>
+        {/* <div class={styles.selectTimer}>{dayjs(state.calendarDate).format('YYYY年MM月DD日')}</div> */}
 
         <CellGroup inset class={styles.cellGroup}>
           {state.useTimer.map((item: any) => (

+ 13 - 19
src/student/music-group/pre-apply/component/order.tsx

@@ -43,7 +43,13 @@ export default defineComponent({
         if (form.list.length > 0 && result.current === 1) {
           return
         }
-        form.list = form.list.concat(result.rows || [])
+        const rows = result.rows || []
+        rows.goodsInfos &&
+          rows.goodsInfos.forEach((item: any) => {
+            const img = item.goodsUrl ? item.goodsUrl.split(',')[0] : ''
+            item.goodsUrl = img
+          })
+        form.list = form.list.concat(rows)
         form.listState.finished = result.current >= result.pages
         form.params.page = result.current + 1
         form.listState.dataShow = form.list.length > 0
@@ -88,24 +94,12 @@ export default defineComponent({
                   {{
                     title: () => (
                       <Grid border={false}>
-                        <GridItem>
-                          <Image
-                            class={styles.img}
-                            src="https://daya.ks3-cn-beijing.ksyuncs.com/12/1670231208704.png"
-                          />
-                        </GridItem>
-                        <GridItem>
-                          <Image
-                            class={styles.img}
-                            src="https://daya.ks3-cn-beijing.ksyuncs.com/12/1670231208704.png"
-                          />
-                        </GridItem>
-                        <GridItem>
-                          <Image
-                            class={styles.img}
-                            src="https://daya.ks3-cn-beijing.ksyuncs.com/12/1670231208704.png"
-                          />
-                        </GridItem>
+                        {item.goodsInfos &&
+                          item.goodsInfos.map((goods: any) => (
+                            <GridItem>
+                              <Image class={styles.img} src={goods.goodsUrl} />
+                            </GridItem>
+                          ))}
                       </Grid>
                     )
                   }}

+ 51 - 3
src/student/music-group/pre-apply/component/payment.tsx

@@ -1,5 +1,16 @@
 import OSticky from '@/components/o-sticky'
-import { Button, Cell, CellGroup, Checkbox, CheckboxGroup, Icon, Image, showToast, Tag } from 'vant'
+import {
+  Button,
+  Cell,
+  CellGroup,
+  Checkbox,
+  CheckboxGroup,
+  Icon,
+  Image,
+  showConfirmDialog,
+  showToast,
+  Tag
+} from 'vant'
 import { defineComponent, nextTick, onMounted, reactive, ref } from 'vue'
 import styles from '../index.module.less'
 import radioCheck from '@/common/images/icon-radio-check.png'
@@ -30,6 +41,42 @@ export default defineComponent({
       }
     })
 
+    // 查询未支付订单
+    const paymentOrderUnpaid = async () => {
+      try {
+        const { data } = await request.get('/api-student/userPaymentOrder/unpaid')
+        console.log(data, 'data')
+        // 判断是否有待支付订单
+        if (data.id) {
+          showConfirmDialog({
+            message: '您有待支付的订单,是否继续支付',
+            cancelButtonText: '取消订单',
+            confirmButtonText: '继续支付'
+          })
+            .then(() => {
+              const paymentConfig = data.paymentConfig
+              router.push({
+                path: '/orderDetail',
+                query: {
+                  config: JSON.stringify(paymentConfig.paymentConfig),
+                  orderNo: paymentConfig.orderNo
+                }
+              })
+            })
+            .catch(async () => {
+              console.log('cancel')
+              try {
+                await request.post('/api-student/userPaymentOrder/cancelPayment/' + data.orderNo)
+              } catch {
+                //
+              }
+            })
+        }
+      } catch {
+        //
+      }
+    }
+
     // 获取商品信息
     const registerGoods = async () => {
       try {
@@ -173,8 +220,7 @@ export default defineComponent({
           path: '/orderDetail',
           query: {
             config: JSON.stringify(data.paymentConfig),
-            orderNo: data.orderNo,
-            id: route.query.id
+            orderNo: data.orderNo
           }
         })
       } catch (e: any) {
@@ -185,6 +231,8 @@ export default defineComponent({
     }
 
     onMounted(() => {
+      // 查询未支付订单
+      paymentOrderUnpaid()
       registerGoods()
     })
     return () => (

+ 9 - 4
src/student/music-group/pre-apply/index.tsx

@@ -19,10 +19,14 @@ export default defineComponent({
       tabValue: 'apply',
       heightV: 235,
       registerInfo: {} as any,
-      purchase: false // 购买状态
+      purchase: false, // 购买状态
+      register: true // 是否注册
     })
 
-    const onNext = (name: string) => {
+    const onNext = async (name: string) => {
+      if (name === 'payment') {
+        await getRegisterStatus()
+      }
       state.tabValue = name
     }
 
@@ -34,6 +38,7 @@ export default defineComponent({
         state.registerInfo = data || {}
 
         // 判断是否报名注册过
+        state.register = data.register
         if (data.register) {
           state.tabValue = 'payment'
         }
@@ -93,8 +98,8 @@ export default defineComponent({
         <Sticky position="top">
           <Tabs lineWidth={20} lineHeight={4} v-model:active={state.tabValue}>
             <Tab title="报名信息" name="apply" disabled={state.purchase}></Tab>
-            <Tab title="缴费信息" name="payment" disabled={state.purchase}></Tab>
-            <Tab title="我的订单" name="order"></Tab>
+            <Tab title="缴费信息" name="payment" disabled={state.purchase || !state.register}></Tab>
+            <Tab title="我的订单" name="order" disabled={!state.register}></Tab>
           </Tabs>
         </Sticky>
 

+ 74 - 37
src/student/music-group/pre-apply/order-detail.tsx

@@ -9,7 +9,7 @@ import { useRoute, useRouter } from 'vue-router'
 import OQrcode from '@/components/o-qrcode'
 import request from '../request-music'
 import item from '@/student/coupons/item'
-import { moneyFormat } from '@/helpers/utils'
+import { browser, moneyFormat } from '@/helpers/utils'
 import { state as baseState } from '@/state'
 
 export default defineComponent({
@@ -23,7 +23,8 @@ export default defineComponent({
       qrCodeUrl: '',
       orderNo: route.query.orderNo,
       orderInfo: {} as any, // 订单信息
-      goodsInfos: [] as any // 订单信息列表
+      goodsInfos: [] as any, // 订单信息列表
+      config: route.query.config ? JSON.parse(route.query.config as any) : {}
     })
 
     const getOrderDetails = async () => {
@@ -42,8 +43,77 @@ export default defineComponent({
       }
     }
 
+    const onConfirm = (val: any) => {
+      const config: any = state.config
+      if (val.payCode === 'payResult') {
+        router.push({
+          path: '/payResult',
+          query: {
+            pay_channel: val.pay_channel,
+            wxAppId: config.wxAppId,
+            body: config.body,
+            price: config.price
+          }
+        })
+      } else {
+        console.log(baseState.user)
+        state.qrCodeUrl =
+          window.location.origin +
+          '/orchestra-student/#/payDefine?pay_channel=' +
+          val.pay_channel +
+          '&wxAppId=' +
+          config.wxAppId +
+          '&body=' +
+          config.body +
+          '&price=' +
+          config.price +
+          '&orderNo=' +
+          config.merOrderNo +
+          '&userId=' +
+          config.userId
+        console.log(state.qrCodeUrl, 'qrCodeUrl')
+        state.showQrcode = true
+        state.paymentStatus = false
+      }
+    }
+
+    const beforeSubmit = () => {
+      const pt = state.config.paymentChannel
+      let payCode = 'qrCode'
+      // 判断当前浏览器
+      if (browser().weixin) {
+        // 微信浏览器
+        if (pt == 'alipay_qr' || pt == 'alipay_wap') {
+          payCode = 'qrCode'
+        } else if (pt == 'wx_pub') {
+          payCode = 'pay'
+        }
+      } else if (browser().alipay) {
+        // 支付宝浏览器
+        if (pt == 'alipay_wap') {
+          // 支付宝 H5 支付
+          payCode = 'pay'
+        } else {
+          payCode = 'qrCode'
+        }
+      } else {
+        payCode = 'qrCode'
+      }
+
+      onConfirm({
+        payCode: payCode == 'qrCode' ? 'payDefine' : 'payResult',
+        pay_channel: pt
+      })
+    }
+
     const onSubmit = () => {
-      state.paymentStatus = true
+      const pt = state.config.paymentChannel
+      // 判断是否有支付方式
+      if (pt) {
+        beforeSubmit()
+      } else {
+        state.paymentStatus = true
+      }
     }
 
     onMounted(() => {
@@ -114,41 +184,8 @@ export default defineComponent({
             onClose={() => (state.paymentStatus = false)}
             onBackOut={() => {
               console.log('back')
-              // router.back()
-            }}
-            onConfirm={(val: any) => {
-              const config: any = route.query.config ? JSON.parse(route.query.config as any) : {}
-              if (val.payCode === 'payResult') {
-                router.push({
-                  path: '/payResult',
-                  query: {
-                    pay_channel: val.pay_channel,
-                    wxAppId: config.wxAppId,
-                    body: config.body,
-                    price: config.price
-                  }
-                })
-              } else {
-                console.log(baseState.user)
-                state.qrCodeUrl =
-                  window.location.origin +
-                  '/orchestra-student/#/payCenter?pay_channel=' +
-                  val.pay_channel +
-                  '&wxAppId=' +
-                  config.wxAppId +
-                  '&body=' +
-                  config.body +
-                  '&price=' +
-                  config.price +
-                  '&orderNo=' +
-                  config.merOrderNo +
-                  '&userId=' +
-                  config.userId
-                console.log(state.qrCodeUrl, 'qrCodeUrl')
-                state.showQrcode = true
-                state.paymentStatus = false
-              }
             }}
+            onConfirm={(val: any) => onConfirm(val)}
           />
         </Popup>
 

+ 19 - 6
src/views/adapay/pay-define/index.tsx

@@ -13,7 +13,7 @@ export default defineComponent({
     const state = reactive({
       browserStatus: false,
       errorText: '',
-      code: (route.query.code || '') as any,
+      code: null as any,
       pay_channel: route.query.pay_channel as any,
       wxAppId: route.query.wxAppId as any,
       body: route.query.body as any,
@@ -233,18 +233,26 @@ export default defineComponent({
     //   }
     // },
 
-    onMounted(() => {
-      if (window.location.href.indexOf('?#') < 0) {
-        window.location.href = window.location.href.replace('#', '?#')
-      }
-      // 判断当前浏览器
+    const goAuth = () => {
+      // 用户授权
+      const urlNow = encodeURIComponent(window.location.href)
+      const scope = 'snsapi_base' //snsapi_userinfo   //静默授权 用户无感知
+      const appid = state.wxAppId || 'wx8654c671631cfade'
+      const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${urlNow}&response_type=code&scope=${scope}&state=STATE&connect_redirect=1#wechat_redirect`
+      window.location.replace(url)
+    }
+
+    const init = () => {
       const pay_channel = state.pay_channel
       if (browser().weixin) {
         if (pay_channel === 'wx_pub') {
           //授权
           const code = getUrlCode()
+          console.log(code)
           if (code) {
             state.code = code // 赋值code码
+          } else {
+            goAuth()
           }
           state.browserStatus = true
           document.title = '微信支付'
@@ -263,6 +271,11 @@ export default defineComponent({
         state.errorText = '请在微信或支付宝客户端打开'
       }
       state.errorText && (document.title = 'ERROR')
+    }
+
+    onMounted(() => {
+      console.log(state)
+      init()
     })
     return () => (
       <div class={styles.paydefine}>

+ 2 - 2
vite.config.ts

@@ -12,8 +12,8 @@ function resolve(dir: string) {
 // https://vitejs.dev/config/
 // https://github.com/vitejs/vite/issues/1930 .env
 // const proxyUrl = 'https://mstutest.dayaedu.com/';
-const proxyUrl = 'http://47.98.131.38:8989/'
-// const proxyUrl = 'http://192.168.3.143:8989/' // 尚科
+// const proxyUrl = 'http://47.98.131.38:8989/'
+const proxyUrl = 'http://192.168.3.143:8989/' // 尚科
 // const proxyUrl = 'http://192.168.3.26:8989/' // 刘俊驰
 export default defineConfig({
   base: './',