lex 2 years ago
parent
commit
1347798b40

+ 8 - 1
src/router/routes-student.ts

@@ -7,7 +7,14 @@ type metaType = {
 }
 
 const noLoginRouter = [
-
+  {
+    path: '/payment-result',
+    name: 'payment-result',
+    component: () => import('@/student/payment-result/index'),
+    meta: {
+      title: '支付详情'
+    }
+  }
 ]
 
 export default [

+ 10 - 0
src/school/companion-teacher/companion-detail.module.less

@@ -4,6 +4,16 @@
   border-radius: 10px;
 }
 
+.subjectContainer {
+  display: flex;
+  & > span {
+    flex-shrink: 0;
+  }
+  .tagSubject {
+    margin-right: 10px;
+  }
+}
+
 .detailCell {
   padding: 15px 13px;
 

+ 17 - 10
src/school/companion-teacher/companion-detail.tsx

@@ -117,15 +117,6 @@ export default defineComponent({
                 <div class={styles.teacherContent}>
                   <div class={styles.content}>
                     <p class={[styles.name, 'van-ellipsis']}>{state.detail.nickname}</p>
-                    {state.detail.subjectName ? (
-                      <p class={styles.subjects}>
-                        {state.detail.subjectNames.map((subject: any) => (
-                          <Tag type="primary">{subject}</Tag>
-                        ))}
-                      </p>
-                    ) : (
-                      ''
-                    )}
                   </div>
                   <div class={styles.classNum}>
                     <p class={styles.num}>
@@ -145,6 +136,23 @@ export default defineComponent({
               )
             }}
           </Cell>
+          <Cell>
+            {{
+              title: () => (
+                <div class={styles.subjectContainer}>
+                  <span>声部:</span>
+                  <div>
+                    {state.detail.subjectNames &&
+                      state.detail.subjectNames.map((subject: any) => (
+                        <Tag type="primary" class={styles.tagSubject}>
+                          {subject}
+                        </Tag>
+                      ))}
+                  </div>
+                </div>
+              )
+            }}
+          </Cell>
         </CellGroup>
 
         <div class={styles.sectionTitle}>
@@ -201,7 +209,6 @@ export default defineComponent({
           v-model:show={state.showMessage}
           position="bottom"
           style={{ background: 'transparent' }}
-          safeAreaInsetBottom={true}
         >
           <div class={styles.codeContainer}>
             <div class={styles.codeBottom}>

+ 10 - 0
src/school/companion-teacher/index.module.less

@@ -5,6 +5,16 @@
   color: #333333;
 }
 
+.subjectContainer {
+  display: flex;
+  & > span {
+    flex-shrink: 0;
+  }
+  .tagSubject {
+    margin-right: 10px;
+  }
+}
+
 .manageCell {
   padding: 15px 13px;
   :global {

+ 67 - 43
src/school/companion-teacher/index.tsx

@@ -2,7 +2,19 @@ import OHeader from '@/components/o-header'
 import OQrcode from '@/components/o-qrcode'
 import OSearch from '@/components/o-search'
 import OSticky from '@/components/o-sticky'
-import { ActionSheet, Cell, Grid, GridItem, Icon, Image, List, Picker, Popup, Tag } from 'vant'
+import {
+  ActionSheet,
+  Cell,
+  CellGroup,
+  Grid,
+  GridItem,
+  Icon,
+  Image,
+  List,
+  Picker,
+  Popup,
+  Tag
+} from 'vant'
 import { defineComponent, onMounted, reactive } from 'vue'
 import styles from './index.module.less'
 import iconSaveImage from '@/school/orchestra/images/icon-save-image.png'
@@ -191,50 +203,63 @@ export default defineComponent({
             immediateCheck={false}
           >
             {form.list.map((item: any) => (
-              <Cell center isLink class={styles.manageCell} onClick={() => onDetail(item)}>
-                {{
-                  icon: () => (
-                    <Image class={styles.img} src={item.avatar ? item.avatar : iconTeacher} />
-                  ),
-                  title: () => (
-                    <div class={styles.teacherContent}>
-                      <div class={styles.content}>
-                        <p class={[styles.name, 'van-ellipsis']}>{item.nickname}</p>
-                        <p class={styles.subjects}>
+              <CellGroup inset style={{ marginBottom: '12px' }}>
+                <Cell center isLink class={styles.manageCell} onClick={() => onDetail(item)}>
+                  {{
+                    icon: () => (
+                      <Image class={styles.img} src={item.avatar ? item.avatar : iconTeacher} />
+                    ),
+                    title: () => (
+                      <div class={styles.teacherContent}>
+                        <div class={styles.content}>
+                          <p class={[styles.name, 'van-ellipsis']}>{item.nickname}</p>
+                        </div>
+                        <div class={styles.classNum}>
+                          <p class={styles.num}>
+                            {item.completedCourseScheduleNum || 0}/
+                            {item.totalCourseScheduleNum || 0}
+                          </p>
+                          <p class={styles.numText}>课时</p>
+                        </div>
+                        <div
+                          class={styles.message}
+                          onClick={(e: any) => {
+                            e.stopPropagation()
+                            e.preventDefault()
+                            form.showMessage = true
+                            form.selectItem = item
+                          }}
+                        >
+                          <Image class={styles.messageImg} src={iconMessage} />
+                        </div>
+                      </div>
+                    ),
+                    value: () => (
+                      <span class={[styles.status, item.delFlag ? styles.frozen : '']}>
+                        {!item.delFlag ? '绑定' : '解绑'}
+                      </span>
+                    )
+                  }}
+                </Cell>
+                <Cell>
+                  {{
+                    title: () => (
+                      <div class={styles.subjectContainer}>
+                        <span>声部:</span>
+                        <div>
                           {item.subjectNames &&
                             item.subjectNames.length > 0 &&
                             item.subjectNames.map((subject: any) => (
-                              <Tag type="primary">{subject}</Tag>
+                              <Tag type="primary" class={styles.tagSubject}>
+                                {subject}
+                              </Tag>
                             ))}
-                        </p>
+                        </div>
                       </div>
-                      <div class={styles.classNum}>
-                        <p class={styles.num}>
-                          {item.completedCourseScheduleNum || 0}/{item.totalCourseScheduleNum || 0}
-                        </p>
-                        <p class={styles.numText}>课时</p>
-                      </div>
-                      <div
-                        class={styles.message}
-                        onClick={(e: any) => {
-                          e.stopPropagation()
-                          e.preventDefault()
-                          form.showMessage = true
-                          form.selectItem = item
-                        }}
-                      >
-                        <Image class={styles.messageImg} src={iconMessage} />
-                      </div>
-                    </div>
-                  ),
-                  value: () => (
-                    <span class={[styles.status, !item.delFlag ? styles.frozen : '']}>
-                      {/* {manageTeacherType[item.status]} */}
-                      {item.delFlag ? '绑定' : '解绑'}
-                    </span>
-                  )
-                }}
-              </Cell>
+                    )
+                  }}
+                </Cell>
+              </CellGroup>
             ))}
           </List>
         ) : (
@@ -245,7 +270,6 @@ export default defineComponent({
           v-model:show={form.showQrcode}
           position="bottom"
           style={{ background: 'transparent' }}
-          safeAreaInsetBottom={true}
         >
           <div class={styles.codeContainer}>
             <div class={styles.codeImg}>
@@ -356,8 +380,8 @@ export default defineComponent({
           actions={
             [
               { name: '全部', id: 'ALL' },
-              { name: '解绑', id: false },
-              { name: '绑定', id: true }
+              { name: '解绑', id: true },
+              { name: '绑定', id: false }
               // { name: '注销', id: 'CANCEL' },
               // { name: '冻结', id: 'LOCKED' },
               // { name: '正常', id: 'ACTIVATION' }

+ 6 - 5
src/school/orchestra/compontent/information.tsx

@@ -54,10 +54,12 @@ export default defineComponent({
       val.color = 'var(--van-primary-color)'
       state.actionText = val.text
       state.actionType = val.value
-      if (val === 'up') {
+
+      if (val.value === 'up') {
         state.params.startTime = dayjs().year() + '-03-01 00:00:00'
         state.params.endTime = dayjs().year() + '-09-01 00:00:00'
-      } else if (val === 'down') {
+      } else if (val.value === 'down') {
+        console.log(dayjs().add(1, 'year'), 'dayjs().add(1, ')
         state.params.startTime = dayjs().year() + '-09-01 00:00:00'
         state.params.endTime = dayjs().add(1, 'year').year() + '-03-01 00:00:00'
       }
@@ -70,11 +72,10 @@ export default defineComponent({
         state.params.startTime = date.selectedValues[0] + '-03-01 00:00:00'
         state.params.endTime = date.selectedValues[0] + '-09-01 00:00:00'
       } else if (state.actionType == 'down') {
-        state.params.startTime = date.selectedValues[0] + 1 + '-03-01 00:00:00'
-        state.params.endTime = date.selectedValues[0] + 1 + '-09-01 00:00:00'
+        state.params.startTime = date.selectedValues[0] + '-09-01 00:00:00'
+        state.params.endTime = Number(date.selectedValues[0]) + 1 + '-03-01 00:00:00'
       }
       state.timeShow = false
-      console.log(state.params)
       onSearch()
     }
 

+ 7 - 6
src/school/orchestra/compontent/plan.tsx

@@ -49,10 +49,12 @@ export default defineComponent({
       val.color = 'var(--van-primary-color)'
       state.actionText = val.text
       state.actionType = val.value
-      if (val === 'up') {
+
+      if (val.value === 'up') {
         state.params.startTime = dayjs().year() + '-03-01 00:00:00'
         state.params.endTime = dayjs().year() + '-09-01 00:00:00'
-      } else if (val === 'down') {
+      } else if (val.value === 'down') {
+        console.log(dayjs().add(1, 'year'), 'dayjs().add(1, ')
         state.params.startTime = dayjs().year() + '-09-01 00:00:00'
         state.params.endTime = dayjs().add(1, 'year').year() + '-03-01 00:00:00'
       }
@@ -65,11 +67,10 @@ export default defineComponent({
         state.params.startTime = date.selectedValues[0] + '-03-01 00:00:00'
         state.params.endTime = date.selectedValues[0] + '-09-01 00:00:00'
       } else if (state.actionType == 'down') {
-        state.params.startTime = date.selectedValues[0] + 1 + '-03-01 00:00:00'
-        state.params.endTime = date.selectedValues[0] + 1 + '-09-01 00:00:00'
+        state.params.startTime = date.selectedValues[0] + '-09-01 00:00:00'
+        state.params.endTime = Number(date.selectedValues[0]) + 1 + '-03-01 00:00:00'
       }
       state.timeShow = false
-      console.log(state.params)
       onSearch()
     }
 
@@ -116,7 +117,7 @@ export default defineComponent({
       getList()
     })
     return () => (
-      <div style={{ paddingTop: '12px' }}>
+      <div>
         <div style={{ padding: '12px 13px 16px', background: '#F8F8F8' }}>
           <div class={styles.searchBand} onClick={() => (state.timeShow = true)}>
             {state.currentData[0]}年 <Icon name={state.showPopover ? 'arrow-up' : 'arrow-down'} />

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

@@ -27,9 +27,9 @@ export default defineComponent({
 
     const addressInfo = computed(() => {
       return [
-        props.item.province,
-        props.item.city,
-        props.item.region,
+        props.item.provinceName,
+        props.item.cityName,
+        props.item.regionName,
         props.item.detailAddress
       ].join('')
     })

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

@@ -111,7 +111,7 @@ export default defineComponent({
                     ),
                     value: () => (
                       <div class={styles.btns}>
-                        {item.status === 'WAIT_PAY' && (
+                        {/* {item.status === 'WAIT_PAY' && (
                           <>
                             <Button round plain color="#AAAAAA">
                               修改订单
@@ -120,7 +120,7 @@ export default defineComponent({
                               继续支付
                             </Button>
                           </>
-                        )}
+                        )} */}
                       </div>
                     )
                   }}

+ 203 - 177
src/student/music-group/pre-apply/component/payment.tsx

@@ -64,7 +64,6 @@ export default defineComponent({
               })
             })
             .catch(async () => {
-              console.log('cancel')
               try {
                 await request.post('/api-student/userPaymentOrder/cancelPayment/' + data.orderNo)
               } catch {
@@ -84,8 +83,14 @@ export default defineComponent({
           '/api-student/orchestraRegister/registerGoods/' + route.query.id
         )
 
-        const details = data.details || []
+        // 获取已经购买商品信息
+        const paymentOrderDetails = data.paymentOrderDetails || []
+        paymentOrderDetails.forEach((item: any) => {
+          state.paymentOrderDetails.push(item.goodsType)
+        })
 
+        // 初始化数据商品数据
+        const details = data.details || []
         details.forEach((item: any) => {
           if (item.goodsType === 'INSTRUMENTS') {
             const img = item.goodsUrl ? item.goodsUrl.split(',')[0] : ''
@@ -101,9 +106,10 @@ export default defineComponent({
           state.details = details
 
           // 默认选中所有的
-          state.check.push(item.goodsId)
+          if (!state.paymentOrderDetails.includes(item.goodsType)) {
+            state.check.push(item.goodsId)
+          }
         })
-        state.paymentOrderDetails = data.paymentOrderDetails || []
 
         calcPrice()
       } catch {
@@ -127,7 +133,10 @@ export default defineComponent({
       }
       details.forEach((item: any) => {
         // 是否选中
-        if (state.check.includes(item.goodsId)) {
+        if (
+          state.check.includes(item.goodsId) &&
+          !state.paymentOrderDetails.includes(item.goodsType)
+        ) {
           tempPrice.needPrice += parseFloat(item.currentPrice)
           tempPrice.originalPrice += parseFloat(item.originalPrice)
         }
@@ -185,7 +194,10 @@ export default defineComponent({
         const details = state.details
         details.forEach((item: any) => {
           // 是否选中
-          if (state.check.includes(item.goodsId)) {
+          if (
+            state.check.includes(item.goodsId) &&
+            !state.paymentOrderDetails.includes(item.goodsType)
+          ) {
             params.push({
               goodsId: item.goodsId,
               goodsNum: 1,
@@ -252,179 +264,193 @@ export default defineComponent({
             calcPrice()
           }}
         >
-          <div class={styles.applyTitle}>乐器</div>
-          <CellGroup
-            inset
-            class={[styles.mlr13, styles.sectionCell]}
-            onClick={() => onSelect(state.goodsInfo.goodsId)}
-          >
-            <Cell border={false}>
-              {{
-                icon: () => (
-                  <Checkbox
-                    name={state.goodsInfo.goodsId}
-                    class={styles.checkbox}
-                    ref={(el: any) => (state.checkboxRefs[state.goodsInfo.goodsId] = el)}
-                    v-slots={{
-                      icon: (props: any) => (
-                        <Icon
-                          class={styles.iconChecked}
-                          name={props.checked ? radioCheck : radioDefault}
-                        />
-                      )
-                    }}
-                  />
-                ),
-                title: () => (
-                  <div class={styles.section}>
-                    <Image class={styles.img} src={state.goodsInfo.goodsUrl} />
-                    <div class={styles.sectionContent}>
-                      <h2>{state.goodsInfo.goodsName}</h2>
-                      <Tag type="primary">{state.goodsInfo.brandName}</Tag>
-                      <p class={styles.model}>{state.goodsInfo.desciption}</p>
-                    </div>
-                  </div>
-                )
-              }}
-            </Cell>
-            <Cell>
-              {{
-                title: () => (
-                  <div class={styles.extra}>
-                    <div class={styles.sectionPrice}>
-                      <p class={styles.price}>
-                        新团特惠:<span>¥{moneyFormat(state.goodsInfo.currentPrice)}</span>
-                      </p>
-                      <p class={styles.originPrice}>
-                        原价:<del>¥{moneyFormat(state.goodsInfo.originalPrice)}</del>
-                      </p>
-                    </div>
-                    <div class={styles.sectionTips}>
-                      赠价值{state.repaireInfo.originalPrice}元乐器维保服务一年
-                    </div>
-                  </div>
-                )
-              }}
-            </Cell>
-          </CellGroup>
+          {/* 判断是否已经购买乐器 */}
+          {!state.paymentOrderDetails.includes('INSTRUMENTS') && (
+            <>
+              <div class={styles.applyTitle}>乐器</div>
+              <CellGroup
+                inset
+                class={[styles.mlr13, styles.sectionCell]}
+                onClick={() => onSelect(state.goodsInfo.goodsId)}
+              >
+                <Cell border={false}>
+                  {{
+                    icon: () => (
+                      <Checkbox
+                        name={state.goodsInfo.goodsId}
+                        class={styles.checkbox}
+                        ref={(el: any) => (state.checkboxRefs[state.goodsInfo.goodsId] = el)}
+                        v-slots={{
+                          icon: (props: any) => (
+                            <Icon
+                              class={styles.iconChecked}
+                              name={props.checked ? radioCheck : radioDefault}
+                            />
+                          )
+                        }}
+                      />
+                    ),
+                    title: () => (
+                      <div class={styles.section}>
+                        <Image class={styles.img} src={state.goodsInfo.goodsUrl} />
+                        <div class={styles.sectionContent}>
+                          <h2>{state.goodsInfo.goodsName}</h2>
+                          <Tag type="primary">{state.goodsInfo.brandName}</Tag>
+                          <p class={styles.model}>{state.goodsInfo.desciption}</p>
+                        </div>
+                      </div>
+                    )
+                  }}
+                </Cell>
+                <Cell>
+                  {{
+                    title: () => (
+                      <div class={styles.extra}>
+                        <div class={styles.sectionPrice}>
+                          <p class={styles.price}>
+                            新团特惠:<span>¥{moneyFormat(state.goodsInfo.currentPrice)}</span>
+                          </p>
+                          <p class={styles.originPrice}>
+                            原价:<del>¥{moneyFormat(state.goodsInfo.originalPrice)}</del>
+                          </p>
+                        </div>
+                        <div class={styles.sectionTips}>
+                          赠价值{state.repaireInfo.originalPrice}元乐器维保服务一年
+                        </div>
+                      </div>
+                    )
+                  }}
+                </Cell>
+              </CellGroup>
+            </>
+          )}
 
-          <div class={styles.applyTitle}>教材</div>
-          <CellGroup
-            inset
-            class={[styles.mlr13, styles.sectionCell]}
-            onClick={() => {
-              return
-              // onSelect(state.textBookInfo.goodsId)
-            }}
-          >
-            <Cell border={false}>
-              {{
-                icon: () => (
-                  <Checkbox
-                    name={state.textBookInfo.goodsId}
-                    disabled
-                    class={styles.checkbox}
-                    ref={(el: any) => (state.checkboxRefs[state.textBookInfo.goodsId] = el)}
-                    v-slots={{
-                      icon: (props: any) => (
-                        <Icon
-                          class={styles.iconChecked}
-                          name={props.checked ? radioCheck : radioDefault}
-                        />
-                      )
-                    }}
-                  />
-                ),
-                title: () => (
-                  <div class={styles.section}>
-                    <Image class={styles.img} src={state.textBookInfo.goodsUrl} />
-                    <div class={styles.sectionContent}>
-                      <h2>{state.textBookInfo.goodsName}</h2>
-                      <Tag type="primary">{state.textBookInfo.brandName}</Tag>
-                      <p class={styles.model}>{state.textBookInfo.description}</p>
-                    </div>
-                  </div>
-                )
-              }}
-            </Cell>
-            <Cell>
-              {{
-                title: () => (
-                  <div class={styles.extra}>
-                    <div class={styles.sectionPrice}>
-                      <p class={styles.price}>
-                        新团特惠:
-                        <span class={styles.free}>
-                          {state.textBookInfo.currentPrice > 0
-                            ? moneyFormat(state.textBookInfo.currentPrice)
-                            : '免费赠送'}
-                        </span>
-                      </p>
-                      <p class={styles.originPrice}>
-                        原价:<del>¥{moneyFormat(state.textBookInfo.originalPrice)}</del>
-                      </p>
-                    </div>
-                  </div>
-                )
-              }}
-            </Cell>
-          </CellGroup>
+          {/* 判断是否已经购买教材 */}
+          {!state.paymentOrderDetails.includes('TEXTBOOK') && (
+            <>
+              <div class={styles.applyTitle}>教材</div>
+              <CellGroup
+                inset
+                class={[styles.mlr13, styles.sectionCell]}
+                onClick={() => {
+                  return
+                  // onSelect(state.textBookInfo.goodsId)
+                }}
+              >
+                <Cell border={false}>
+                  {{
+                    icon: () => (
+                      <Checkbox
+                        name={state.textBookInfo.goodsId}
+                        disabled
+                        class={styles.checkbox}
+                        ref={(el: any) => (state.checkboxRefs[state.textBookInfo.goodsId] = el)}
+                        v-slots={{
+                          icon: (props: any) => (
+                            <Icon
+                              class={styles.iconChecked}
+                              name={props.checked ? radioCheck : radioDefault}
+                            />
+                          )
+                        }}
+                      />
+                    ),
+                    title: () => (
+                      <div class={styles.section}>
+                        <Image class={styles.img} src={state.textBookInfo.goodsUrl} />
+                        <div class={styles.sectionContent}>
+                          <h2>{state.textBookInfo.goodsName}</h2>
+                          <Tag type="primary">{state.textBookInfo.brandName}</Tag>
+                          <p class={styles.model}>{state.textBookInfo.description}</p>
+                        </div>
+                      </div>
+                    )
+                  }}
+                </Cell>
+                <Cell>
+                  {{
+                    title: () => (
+                      <div class={styles.extra}>
+                        <div class={styles.sectionPrice}>
+                          <p class={styles.price}>
+                            新团特惠:
+                            <span class={styles.free}>
+                              {state.textBookInfo.currentPrice > 0
+                                ? moneyFormat(state.textBookInfo.currentPrice)
+                                : '免费赠送'}
+                            </span>
+                          </p>
+                          <p class={styles.originPrice}>
+                            原价:<del>¥{moneyFormat(state.textBookInfo.originalPrice)}</del>
+                          </p>
+                        </div>
+                      </div>
+                    )
+                  }}
+                </Cell>
+              </CellGroup>
+            </>
+          )}
 
-          <div class={styles.applyTitle}>乐团学习系统</div>
-          <CellGroup
-            inset
-            class={[styles.mlr13, styles.sectionCell]}
-            onClick={() => onSelect(state.vipInfo.goodsId)}
-          >
-            <Cell border={false}>
-              {{
-                icon: () => (
-                  <Checkbox
-                    name={state.vipInfo.goodsId}
-                    class={styles.checkbox}
-                    ref={(el: any) => (state.checkboxRefs[state.vipInfo.goodsId] = el)}
-                    onClick={(e: Event) => {
-                      e.stopPropagation()
-                    }}
-                    v-slots={{
-                      icon: (props: any) => (
-                        <Icon
-                          class={styles.iconChecked}
-                          name={props.checked ? radioCheck : radioDefault}
-                        />
-                      )
-                    }}
-                  />
-                ),
-                title: () => (
-                  <div class={styles.section}>
-                    <Image class={styles.img} src={state.vipInfo.goodsUrl} />
-                    <div class={styles.sectionContent}>
-                      <h2>{state.vipInfo.goodsName}</h2>
-                      <Tag type="primary">6个月</Tag>
-                      <p class={styles.model}>{state.vipInfo.description}</p>
-                    </div>
-                  </div>
-                )
-              }}
-            </Cell>
-            <Cell>
-              {{
-                title: () => (
-                  <div class={styles.extra}>
-                    <div class={styles.sectionPrice}>
-                      <p class={styles.price}>
-                        新团特惠:<span>¥{moneyFormat(state.vipInfo.currentPrice)}</span>
-                      </p>
-                      <p class={styles.originPrice}>
-                        原价:<del>¥{moneyFormat(state.vipInfo.originalPrice)}</del>
-                      </p>
-                    </div>
-                  </div>
-                )
-              }}
-            </Cell>
-          </CellGroup>
+          {!state.paymentOrderDetails.includes('VIP') && (
+            <>
+              <div class={styles.applyTitle}>乐团学习系统</div>
+              <CellGroup
+                inset
+                class={[styles.mlr13, styles.sectionCell]}
+                onClick={() => onSelect(state.vipInfo.goodsId)}
+              >
+                <Cell border={false}>
+                  {{
+                    icon: () => (
+                      <Checkbox
+                        name={state.vipInfo.goodsId}
+                        class={styles.checkbox}
+                        ref={(el: any) => (state.checkboxRefs[state.vipInfo.goodsId] = el)}
+                        onClick={(e: Event) => {
+                          e.stopPropagation()
+                        }}
+                        v-slots={{
+                          icon: (props: any) => (
+                            <Icon
+                              class={styles.iconChecked}
+                              name={props.checked ? radioCheck : radioDefault}
+                            />
+                          )
+                        }}
+                      />
+                    ),
+                    title: () => (
+                      <div class={styles.section}>
+                        <Image class={styles.img} src={state.vipInfo.goodsUrl} />
+                        <div class={styles.sectionContent}>
+                          <h2>{state.vipInfo.goodsName}</h2>
+                          <Tag type="primary">6个月</Tag>
+                          <p class={styles.model}>{state.vipInfo.description}</p>
+                        </div>
+                      </div>
+                    )
+                  }}
+                </Cell>
+                <Cell>
+                  {{
+                    title: () => (
+                      <div class={styles.extra}>
+                        <div class={styles.sectionPrice}>
+                          <p class={styles.price}>
+                            新团特惠:<span>¥{moneyFormat(state.vipInfo.currentPrice)}</span>
+                          </p>
+                          <p class={styles.originPrice}>
+                            原价:<del>¥{moneyFormat(state.vipInfo.originalPrice)}</del>
+                          </p>
+                        </div>
+                      </div>
+                    )
+                  }}
+                </Cell>
+              </CellGroup>
+            </>
+          )}
         </CheckboxGroup>
 
         <OSticky position="bottom" background="white">

+ 116 - 13
src/student/music-group/pre-apply/order-detail.tsx

@@ -1,9 +1,19 @@
 import OHeader from '@/components/o-header'
-import { defineComponent, onMounted, reactive } from 'vue'
+import { defineComponent, onMounted, reactive, ref } from 'vue'
 import styles from './order-detail.module.less'
 import Addres from './component/addres'
 import OSticky from '@/components/o-sticky'
-import { Button, Cell, CellGroup, Image, Popup, Tag } from 'vant'
+import {
+  Button,
+  Cell,
+  CellGroup,
+  Image,
+  Popup,
+  showConfirmDialog,
+  showDialog,
+  showToast,
+  Tag
+} from 'vant'
 import Payment from '@/views/adapay/payment'
 import { useRoute, useRouter } from 'vue-router'
 import OQrcode from '@/components/o-qrcode'
@@ -18,6 +28,7 @@ export default defineComponent({
     const route = useRoute()
     const router = useRouter()
     const state = reactive({
+      orderTimer: null as any,
       paymentStatus: false,
       showQrcode: false,
       qrCodeUrl: '',
@@ -28,6 +39,8 @@ export default defineComponent({
       config: route.query.config ? JSON.parse(route.query.config as any) : {}
     })
 
+    const addressDetails = ref<any>({})
+
     const getOrderDetails = async () => {
       try {
         const { data } = await request.get('/api-student/userPaymentOrder/detail/' + state.orderNo)
@@ -39,6 +52,29 @@ export default defineComponent({
           item.goodsUrl = img
         })
         state.goodsInfos = goodsInfos
+
+        if (!addressDetails.value.id) {
+          addressDetails.value = data.addresses || {}
+        }
+
+        // 判断订单状态,如果不是待支付则返回
+        // WAIT_PAY: '待支付',
+        // PAYING: '支付中',
+        // PAID: '已付款',
+        // TIMEOUT: '订单超时',
+        // FAIL: '支付失败',
+        // CLOSED: '订单关闭',
+        // REFUNDING: '退款中',
+        // REFUNDED: '已退款'
+        if (data.status !== 'WAIT_PAY') {
+          // status
+          showConfirmDialog({
+            message: '订单处理中,请稍等',
+            showCancelButton: false
+          }).then(() => {
+            router.back()
+          })
+        }
       } catch {
         //
       }
@@ -76,9 +112,43 @@ export default defineComponent({
         console.log(state.qrCodeUrl, 'qrCodeUrl')
         state.showQrcode = true
         state.paymentStatus = false
+
+        setTimeout(() => {
+          getPaymentOrderStatus()
+        }, 300)
       }
     }
 
+    const getPaymentOrderStatus = async () => {
+      // 循环查询订单
+      const orderNo = state.orderNo
+      const orderTimer = setInterval(async () => {
+        // 判断是否在当前路由,如果不是则清除定时器
+        if (route.name != 'orderDetail') {
+          clearInterval(orderTimer)
+          return
+        }
+        state.orderTimer = orderTimer
+        try {
+          const { data } = await request.post(
+            '/api-student/open/userOrder/paymentStatus/' + state.orderNo
+          )
+          console.log(data)
+          if (data.status !== 'WAIT_PAY') {
+            clearInterval(orderTimer)
+            window.location.replace(
+              window.location.origin +
+                '/orchestra-student/#/payment-result?orderNo=' +
+                state.orderNo
+            )
+          }
+        } catch {
+          //
+          clearInterval(orderTimer)
+        }
+      }, 5000)
+    }
+
     const beforeSubmit = () => {
       const pt = state.config.paymentChannel
       let payCode = 'qrCode'
@@ -108,17 +178,52 @@ export default defineComponent({
       })
     }
 
-    const onSubmit = () => {
-      const pt = state.config.paymentChannel
-      // 判断是否有支付方式
-      if (pt) {
-        beforeSubmit()
-      } else {
-        state.paymentStatus = true
+    const onSubmit = async () => {
+      // 请选择收货地址
+      if (!addressDetails.value.id) {
+        showToast('请选择收货地址')
+        return
+      }
+
+      try {
+        await request.post('/api-student/userPaymentOrder/updateReceiveAddress', {
+          data: {
+            orderNo: state.orderNo,
+            orderType: 'ORCHESTRA',
+            receiveAddress: addressDetails.value.id
+          }
+        })
+
+        const pt = state.config.paymentChannel
+        // 判断是否有支付方式
+        if (pt) {
+          beforeSubmit()
+        } else {
+          state.paymentStatus = true
+        }
+      } catch {
+        //
+      }
+    }
+
+    const onBackOut = async () => {
+      // api-student/userPaymentOrder/cancelPayment/{orderNo}
+      try {
+        await request.post('/api-student/userPaymentOrder/cancelPayment/' + state.orderNo)
+
+        router.back()
+      } catch {
+        //
       }
     }
 
     onMounted(() => {
+      // 获取收货地址
+      let details = sessionStorage.getItem('addressDetails')
+      details = details ? JSON.parse(details) : {}
+      addressDetails.value = details
+      sessionStorage.removeItem('addressDetails')
+
       getOrderDetails()
     })
     return () => (
@@ -126,7 +231,7 @@ export default defineComponent({
         <OHeader />
         <div class={styles.cartConfirm}>
           <div class={styles.cartConfirmBox}>
-            <Addres />
+            <Addres item={addressDetails.value} />
           </div>
 
           <CellGroup style={{ margin: 0 }}>
@@ -184,9 +289,7 @@ export default defineComponent({
           <Payment
             paymentConfig={state.orderInfo}
             onClose={() => (state.paymentStatus = false)}
-            onBackOut={() => {
-              console.log('back')
-            }}
+            onBackOut={onBackOut}
             onConfirm={(val: any) => onConfirm(val)}
           />
         </Popup>

+ 94 - 12
src/student/music-group/shop-address/address-operation.tsx

@@ -1,15 +1,20 @@
 import OSticky from '@/components/o-sticky'
-import { Button, Cell, CellGroup, Field, Picker, Popup, Switch } from 'vant'
-import { defineComponent, reactive } from 'vue'
+import { Button, Cell, CellGroup, Field, Picker, Popup, showToast, Switch } from 'vant'
+import { defineComponent, onMounted, reactive } from 'vue'
 import request from '../request-music'
 import styles from './index.module.less'
 import { areas } from '@/helpers/area'
 import { verifiyNumberInteger } from '@/helpers/toolsValidate'
+import { router } from '@/router/routes-common'
+import { useRoute, useRouter } from 'vue-router'
 
 export default defineComponent({
   name: 'address-operation',
   setup() {
+    const route = useRoute()
+    const router = useRouter()
     const state = reactive({
+      isClick: false,
       showPicker: false,
       defaultStatus: false,
       phoneNumber: null,
@@ -31,11 +36,88 @@ export default defineComponent({
 
     const onSubmit = async () => {
       try {
-        await request.post('/api-student/userReceiveAddress/save', {
-          data: {}
-        })
-      } catch {}
+        if (!state.name) {
+          showToast('请选择收货人')
+          return
+        }
+        if (!state.phoneNumber) {
+          showToast('请输入手机号')
+          return
+        }
+        if (!state.pcrStr) {
+          showToast('请选择所在地区')
+          return
+        }
+        if (!state.detailAddress) {
+          showToast('请输入详细地址')
+          return
+        }
+        state.isClick = true
+        const params: any = {
+          name: state.name,
+          phoneNumber: state.phoneNumber,
+          province: state.province,
+          city: state.city,
+          region: state.region,
+          detailAddress: state.detailAddress,
+          defaultStatus: state.defaultStatus
+        }
+        if (route.query.id) {
+          await request.post('/api-student/userReceiveAddress/update', {
+            data: {
+              id: route.query.id,
+              ...params
+            }
+          })
+          setTimeout(() => {
+            showToast('修改成功')
+          }, 100)
+        } else {
+          await request.post('/api-student/userReceiveAddress/save', {
+            data: {
+              ...params
+            }
+          })
+          setTimeout(() => {
+            showToast('添加成功')
+          }, 100)
+        }
+
+        setTimeout(() => {
+          state.isClick = false
+          router.back()
+        }, 1100)
+      } catch (e: any) {
+        //
+        state.isClick = false
+        console.log(e)
+      }
     }
+
+    const getDetails = async () => {
+      try {
+        const { data } = await request.get(
+          '/api-student/userReceiveAddress/detail/' + route.query.id
+        )
+
+        state.name = data.name
+        state.phoneNumber = data.phoneNumber
+        state.province = data.province
+        state.city = data.city
+        state.region = data.region ? data.region : ''
+        state.pcrStr = (data.provinceName || '') + (data.cityName || '') + (data.regionName || '')
+        state.detailAddress = data.detailAddress
+        state.defaultStatus = data.defaultStatus
+      } catch {
+        //
+      }
+    }
+    onMounted(() => {
+      // 判断是否有编号,有则为修改
+      if (route.query.id) {
+        getDetails()
+      }
+    })
     return () => (
       <div class={styles.operation}>
         <CellGroup inset class={styles.form}>
@@ -74,7 +156,7 @@ export default defineComponent({
 
         <OSticky position="bottom">
           <div class="btnGroup">
-            <Button type="primary" block round>
+            <Button type="primary" block round onClick={onSubmit} disabled={state.isClick}>
               确认
             </Button>
           </div>
@@ -94,20 +176,20 @@ export default defineComponent({
                 selectedOptions.forEach((item: any, index: number) => {
                   state.pcrStr += item.name
                   if (index === 0) {
-                    state.province = item.id
+                    state.province = item.code
                   } else if (index === 1) {
-                    state.city = item.id
+                    state.city = item.code
                   }
                 })
               } else {
                 selectedOptions.forEach((item: any, index: number) => {
                   state.pcrStr += item.name
                   if (index === 0) {
-                    state.province = item.id
+                    state.province = item.code
                   } else if (index === 1) {
-                    state.city = item.id
+                    state.city = item.code
                   } else if (index === 2) {
-                    state.region = item.id
+                    state.region = item.code
                   }
                 })
               }

+ 66 - 15
src/student/music-group/shop-address/index.tsx

@@ -1,5 +1,5 @@
-import { Button, Cell, SwipeCell, Tag, Image, Icon, showConfirmDialog, List } from 'vant'
-import { defineComponent, onMounted, reactive } from 'vue'
+import { Button, Cell, SwipeCell, Tag, Image, Icon, showConfirmDialog, List, showToast } from 'vant'
+import { defineComponent, onMounted, onUpdated, reactive } from 'vue'
 import styles from './index.module.less'
 import iconEdit from '../pre-apply/images/icon-edit.png'
 import OSticky from '@/components/o-sticky'
@@ -22,13 +22,33 @@ export default defineComponent({
       params: {
         page: 1,
         rows: 20
-      }
+      },
+      selectItem: {} // 选择的地址
     })
-    const onBeforeClose = ({ position }: any) => {
+    const onBeforeClose = ({ position }: any, item: any) => {
       if (position === 'right') {
         showConfirmDialog({
           title: '确定删除吗?'
-        }).then(() => {
+        }).then(async () => {
+          await request.post('/api-student/userReceiveAddress/remove', {
+            requestType: 'form',
+            data: {
+              id: item.id
+            }
+          })
+
+          setTimeout(() => {
+            showToast('删除成功')
+          }, 100)
+
+          setTimeout(() => {
+            form.params.page = 1
+            form.list = []
+            form.listState.dataShow = true // 判断是否有数据
+            form.listState.loading = false
+            form.listState.finished = false
+            getList()
+          }, 1100)
           return true
         })
       } else {
@@ -36,6 +56,15 @@ export default defineComponent({
       }
     }
 
+    const onUpdate = (item: any) => {
+      router.push({
+        path: '/addressOperation',
+        query: {
+          id: item.id
+        }
+      })
+    }
+
     // api-student/userReceiveAddress/page
     const getList = async () => {
       try {
@@ -64,9 +93,14 @@ export default defineComponent({
       }
     }
 
+    // 选择地址
+    const onDetails = (item: any) => {
+      sessionStorage.setItem('addressDetails', JSON.stringify(item))
+      router.back()
+    }
+
     onMounted(() => {
       getList()
-      console.log('1111')
     })
     return () => (
       <div class={styles.shopAddress}>
@@ -80,26 +114,43 @@ export default defineComponent({
             immediateCheck={false}
           >
             {form.list.map((item: any) => (
-              <SwipeCell class={styles.swipeCell} beforeClose={onBeforeClose}>
+              <SwipeCell
+                class={styles.swipeCell}
+                beforeClose={(args: any) => onBeforeClose(args, item)}
+              >
                 {{
                   default: () => (
-                    <Cell center>
+                    <Cell center onClick={() => onDetails(item)}>
                       {{
                         title: () => (
                           <div class={styles.title}>
-                            <span class={styles.name}>小林林</span>
-                            <span class={styles.phone}>15353535353</span>
-                            <Tag round color="#FF8057">
-                              默认
-                            </Tag>
+                            <span class={styles.name}>{item.name}</span>
+                            <span class={styles.phone}>{item.phoneNumber}</span>
+                            {item.defaultStatus && (
+                              <Tag round color="#FF8057">
+                                默认
+                              </Tag>
+                            )}
                           </div>
                         ),
                         label: () => (
                           <div class={styles.content}>
-                            湖北省武汉市武昌区水果湖街街道楚河汉街总部国际A座3801
+                            {item.provinceName}
+                            {item.cityName}
+                            {item.regionName}
+                            {item.detailAddress}
                           </div>
                         ),
-                        'right-icon': () => <Icon name={iconEdit} size="18" />
+                        'right-icon': () => (
+                          <Icon
+                            name={iconEdit}
+                            size="18"
+                            onClick={(e: Event) => {
+                              e.stopPropagation()
+                              onUpdate(item)
+                            }}
+                          />
+                        )
                       }}
                     </Cell>
                   ),

BIN
src/student/payment-result/images/icon_refunded.png


BIN
src/student/payment-result/images/icon_refunding.png


BIN
src/student/payment-result/images/icon_success.png


+ 4 - 0
src/student/payment-result/index.module.less

@@ -0,0 +1,4 @@
+.paymentTitle {
+  min-height: 226px;
+  background: linear-gradient(180deg, #ffe4d4 0%, #ffffff 100%);
+}

+ 16 - 0
src/student/payment-result/index.tsx

@@ -0,0 +1,16 @@
+import OHeader from '@/components/o-header'
+import { defineComponent } from 'vue'
+import styles from './index.module.less'
+
+export default defineComponent({
+  name: 'payment-result',
+  setup() {
+    return () => (
+      <div class={styles.paymentResult}>
+        <div class={styles.paymentTitle}>
+          <OHeader border={false} background="transparent" />
+        </div>
+      </div>
+    )
+  }
+})