|  | @@ -8,8 +8,7 @@ import {
 | 
	
		
			
				|  |  |    Icon,
 | 
	
		
			
				|  |  |    Popup,
 | 
	
		
			
				|  |  |    showConfirmDialog,
 | 
	
		
			
				|  |  | -  showToast,
 | 
	
		
			
				|  |  | -  closeToast
 | 
	
		
			
				|  |  | +  showToast
 | 
	
		
			
				|  |  |  } from 'vant';
 | 
	
		
			
				|  |  |  import { computed, defineComponent, onMounted, reactive } from 'vue';
 | 
	
		
			
				|  |  |  import styles from './index.module.less';
 | 
	
	
		
			
				|  | @@ -21,16 +20,9 @@ import { useRoute, useRouter } from 'vue-router';
 | 
	
		
			
				|  |  |  import RegisterModal from './register-modal';
 | 
	
		
			
				|  |  |  import { useStudentRegisterStore } from '@/store/modules/student-register-store';
 | 
	
		
			
				|  |  |  import request from '@/helpers/request';
 | 
	
		
			
				|  |  | -import {
 | 
	
		
			
				|  |  | -  // browser,
 | 
	
		
			
				|  |  | -  // getUrlCode,
 | 
	
		
			
				|  |  | -  moneyFormat
 | 
	
		
			
				|  |  | -} from '@/helpers/utils';
 | 
	
		
			
				|  |  | +import { moneyFormat } from '@/helpers/utils';
 | 
	
		
			
				|  |  |  import deepClone from '@/helpers/deep-clone';
 | 
	
		
			
				|  |  | -import MDialog from '@/components/m-dialog';
 | 
	
		
			
				|  |  |  import OWxTip from '@/components/m-wx-tip';
 | 
	
		
			
				|  |  | -// import { goWechatAuth } from '@/state';
 | 
	
		
			
				|  |  | -// import qs from 'query-string';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default defineComponent({
 | 
	
		
			
				|  |  |    name: 'student-register',
 | 
	
	
		
			
				|  | @@ -48,11 +40,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        schoolType: '', // 学校类型
 | 
	
		
			
				|  |  |        gradeYear: '', // 学制
 | 
	
		
			
				|  |  |        bugGoods: false, // 是否购买AI
 | 
	
		
			
				|  |  | -      submitLoading: false,
 | 
	
		
			
				|  |  | -      dialogStatus: false,
 | 
	
		
			
				|  |  | -      dialogMessage: '',
 | 
	
		
			
				|  |  | -      dialogConfig: {} as any,
 | 
	
		
			
				|  |  | -      code: '' as any
 | 
	
		
			
				|  |  | +      submitLoading: false
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 查询未支付订单
 | 
	
	
		
			
				|  | @@ -61,9 +49,9 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          const { data } = await request.get('/edu-app/userPaymentOrder/unpaid');
 | 
	
		
			
				|  |  |          // 判断是否有待支付订单
 | 
	
		
			
				|  |  |          if (data.id) {
 | 
	
		
			
				|  |  | -          forms.dialogMessage = '您有待支付的订单,是否继续支付';
 | 
	
		
			
				|  |  | -          forms.dialogStatus = true;
 | 
	
		
			
				|  |  | -          forms.dialogConfig = data;
 | 
	
		
			
				|  |  | +          await request.post(
 | 
	
		
			
				|  |  | +            '/edu-app/userPaymentOrder/cancelPayment/' + data.orderNo
 | 
	
		
			
				|  |  | +          );
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        } catch {
 | 
	
		
			
				|  |  |          //
 | 
	
	
		
			
				|  | @@ -85,8 +73,6 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          forms.bugGoods = data.bugGoods;
 | 
	
		
			
				|  |  |          forms.schoolType = data.schoolType;
 | 
	
		
			
				|  |  |          forms.gradeYear = data.gradeYear;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        console.log(studentRegisterStore.getGoods);
 | 
	
		
			
				|  |  |        } catch {}
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -118,7 +104,8 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          message: '是否删除该商品',
 | 
	
		
			
				|  |  |          confirmButtonColor: '#FF8633'
 | 
	
		
			
				|  |  |        }).then(() => {
 | 
	
		
			
				|  |  | -        studentRegisterStore.deleteGoods(item.goodsId);
 | 
	
		
			
				|  |  | +        console.log(item, 'item');
 | 
	
		
			
				|  |  | +        studentRegisterStore.deleteGoods(item.productSkuId);
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -126,11 +113,8 @@ export default defineComponent({
 | 
	
		
			
				|  |  |      const onRegisterSubmit = async () => {
 | 
	
		
			
				|  |  |        try {
 | 
	
		
			
				|  |  |          forms.submitLoading = true;
 | 
	
		
			
				|  |  | +        // 请求是否有待支付订单,如果有则自动关闭
 | 
	
		
			
				|  |  |          await paymentOrderUnpaid();
 | 
	
		
			
				|  |  | -        if (forms.dialogStatus) {
 | 
	
		
			
				|  |  | -          forms.submitLoading = false;
 | 
	
		
			
				|  |  | -          return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |          const schoolInfo = await request.get(
 | 
	
		
			
				|  |  |            '/edu-app/userPaymentOrder/registerStatus/' + forms.schoolId
 | 
	
		
			
				|  |  |          );
 | 
	
	
		
			
				|  | @@ -200,44 +184,10 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // const getAppIdAndCode = async (url?: string) => {
 | 
	
		
			
				|  |  | -    //   try {
 | 
	
		
			
				|  |  | -    //     const { data } = await request.get(
 | 
	
		
			
				|  |  | -    //       '/edu-app/open/paramConfig/wechatAppId'
 | 
	
		
			
				|  |  | -    //     );
 | 
	
		
			
				|  |  | -    //     // 判断是否有微信appId
 | 
	
		
			
				|  |  | -    //     if (data) {
 | 
	
		
			
				|  |  | -    //       closeToast();
 | 
	
		
			
				|  |  | -    //       goWechatAuth(data, url);
 | 
	
		
			
				|  |  | -    //     }
 | 
	
		
			
				|  |  | -    //   } catch {
 | 
	
		
			
				|  |  | -    //     //
 | 
	
		
			
				|  |  | -    //   }
 | 
	
		
			
				|  |  | -    // };
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      onMounted(() => {
 | 
	
		
			
				|  |  |        getRegisterGoods();
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // if (browser().weixin) {
 | 
	
		
			
				|  |  | -    //   //授权
 | 
	
		
			
				|  |  | -    //   const code = getUrlCode();
 | 
	
		
			
				|  |  | -    //   if (!code) {
 | 
	
		
			
				|  |  | -    //     const newUrl =
 | 
	
		
			
				|  |  | -    //       window.location.origin +
 | 
	
		
			
				|  |  | -    //       window.location.pathname +
 | 
	
		
			
				|  |  | -    //       '#' +
 | 
	
		
			
				|  |  | -    //       route.path +
 | 
	
		
			
				|  |  | -    //       '?' +
 | 
	
		
			
				|  |  | -    //       qs.stringify({
 | 
	
		
			
				|  |  | -    //         ...route.query
 | 
	
		
			
				|  |  | -    //       });
 | 
	
		
			
				|  |  | -    //     getAppIdAndCode(newUrl);
 | 
	
		
			
				|  |  | -    //     return '';
 | 
	
		
			
				|  |  | -    //   } else {
 | 
	
		
			
				|  |  | -    //     forms.code = code;
 | 
	
		
			
				|  |  | -    //   }
 | 
	
		
			
				|  |  | -    // }
 | 
	
		
			
				|  |  |      return () => (
 | 
	
		
			
				|  |  |        <div class={styles['student-register']}>
 | 
	
		
			
				|  |  |          <div class={styles.studentSection} style={{ marginTop: '18px' }}>
 | 
	
	
		
			
				|  | @@ -306,7 +256,9 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                            {moneyFormat(item.currentPrice)}
 | 
	
		
			
				|  |  |                          </span>
 | 
	
		
			
				|  |  |                        </div>
 | 
	
		
			
				|  |  | -                      <del>¥{moneyFormat(item.originalPrice)}</del>
 | 
	
		
			
				|  |  | +                      {item.currentPrice < item.originalPrice && (
 | 
	
		
			
				|  |  | +                        <del>¥{moneyFormat(item.originalPrice)}</del>
 | 
	
		
			
				|  |  | +                      )}
 | 
	
		
			
				|  |  |                      </div>
 | 
	
		
			
				|  |  |                    )
 | 
	
		
			
				|  |  |                  }}
 | 
	
	
		
			
				|  | @@ -351,59 +303,63 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                    </div>
 | 
	
		
			
				|  |  |                  </div>
 | 
	
		
			
				|  |  |                ) : (
 | 
	
		
			
				|  |  | -                studentRegisterStore.getGoods.map((goods: any) => (
 | 
	
		
			
				|  |  | -                  <CellGroup class={styles.goodsSection}>
 | 
	
		
			
				|  |  | -                    <Cell border={false} class={styles.goodsCell}>
 | 
	
		
			
				|  |  | -                      {{
 | 
	
		
			
				|  |  | -                        icon: () => (
 | 
	
		
			
				|  |  | -                          <Image class={styles.img} src={goods.pic} />
 | 
	
		
			
				|  |  | -                        ),
 | 
	
		
			
				|  |  | -                        title: () => (
 | 
	
		
			
				|  |  | -                          <div class={styles.section}>
 | 
	
		
			
				|  |  | -                            <div class={styles.sectionContent}>
 | 
	
		
			
				|  |  | -                              <h2>
 | 
	
		
			
				|  |  | -                                {goods.name}
 | 
	
		
			
				|  |  | -                                <Tag class={styles.brandName}>
 | 
	
		
			
				|  |  | -                                  {goods.brandName}
 | 
	
		
			
				|  |  | -                                </Tag>
 | 
	
		
			
				|  |  | -                              </h2>
 | 
	
		
			
				|  |  | -                              <p class={[styles.model]}>
 | 
	
		
			
				|  |  | -                                规格:{goods.spDataJson}
 | 
	
		
			
				|  |  | -                              </p>
 | 
	
		
			
				|  |  | -                              <p class={[styles.model]}>{goods.productSn}</p>
 | 
	
		
			
				|  |  | +                studentRegisterStore.getGoods.map(
 | 
	
		
			
				|  |  | +                  (goods: any, index: number) => (
 | 
	
		
			
				|  |  | +                    <CellGroup class={styles.goodsSection}>
 | 
	
		
			
				|  |  | +                      <Cell border={false} class={styles.goodsCell}>
 | 
	
		
			
				|  |  | +                        {{
 | 
	
		
			
				|  |  | +                          icon: () => (
 | 
	
		
			
				|  |  | +                            <Image class={styles.img} src={goods.pic} />
 | 
	
		
			
				|  |  | +                          ),
 | 
	
		
			
				|  |  | +                          title: () => (
 | 
	
		
			
				|  |  | +                            <div class={styles.section}>
 | 
	
		
			
				|  |  | +                              <div class={styles.sectionContent}>
 | 
	
		
			
				|  |  | +                                <h2>
 | 
	
		
			
				|  |  | +                                  {goods.name}
 | 
	
		
			
				|  |  | +                                  <Tag class={styles.brandName}>
 | 
	
		
			
				|  |  | +                                    {goods.brandName}
 | 
	
		
			
				|  |  | +                                  </Tag>
 | 
	
		
			
				|  |  | +                                </h2>
 | 
	
		
			
				|  |  | +                                <p class={[styles.model]}>
 | 
	
		
			
				|  |  | +                                  规格:{goods.spDataJson}
 | 
	
		
			
				|  |  | +                                </p>
 | 
	
		
			
				|  |  | +                                <p class={[styles.model]}>{goods.productSn}</p>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                              <Stepper
 | 
	
		
			
				|  |  | -                                min={1}
 | 
	
		
			
				|  |  | -                                max={99}
 | 
	
		
			
				|  |  | -                                v-model={goods.quantity}
 | 
	
		
			
				|  |  | -                              />
 | 
	
		
			
				|  |  | -                            </div>
 | 
	
		
			
				|  |  | +                                <Stepper
 | 
	
		
			
				|  |  | +                                  min={1}
 | 
	
		
			
				|  |  | +                                  max={99}
 | 
	
		
			
				|  |  | +                                  v-model={goods.quantity}
 | 
	
		
			
				|  |  | +                                />
 | 
	
		
			
				|  |  | +                              </div>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                            <i
 | 
	
		
			
				|  |  | -                              class={styles.delete}
 | 
	
		
			
				|  |  | -                              onClick={() => onGoodsRemove(goods)}></i>
 | 
	
		
			
				|  |  | -                          </div>
 | 
	
		
			
				|  |  | -                        )
 | 
	
		
			
				|  |  | -                      }}
 | 
	
		
			
				|  |  | -                    </Cell>
 | 
	
		
			
				|  |  | -                    <Cell border={false} class={styles.priceCell}>
 | 
	
		
			
				|  |  | -                      {{
 | 
	
		
			
				|  |  | -                        title: () => (
 | 
	
		
			
				|  |  | -                          <div class={styles.sPriceGroup}>
 | 
	
		
			
				|  |  | -                            <div class={styles.tg}>
 | 
	
		
			
				|  |  | -                              团购价:
 | 
	
		
			
				|  |  | -                              <span>
 | 
	
		
			
				|  |  | -                                <i>¥ </i>
 | 
	
		
			
				|  |  | -                                {moneyFormat(goods.price)}
 | 
	
		
			
				|  |  | -                              </span>
 | 
	
		
			
				|  |  | +                              <i
 | 
	
		
			
				|  |  | +                                class={styles.delete}
 | 
	
		
			
				|  |  | +                                onClick={() => onGoodsRemove(goods)}></i>
 | 
	
		
			
				|  |  | +                            </div>
 | 
	
		
			
				|  |  | +                          )
 | 
	
		
			
				|  |  | +                        }}
 | 
	
		
			
				|  |  | +                      </Cell>
 | 
	
		
			
				|  |  | +                      <Cell border={false} class={styles.priceCell}>
 | 
	
		
			
				|  |  | +                        {{
 | 
	
		
			
				|  |  | +                          title: () => (
 | 
	
		
			
				|  |  | +                            <div class={styles.sPriceGroup}>
 | 
	
		
			
				|  |  | +                              <div class={styles.tg}>
 | 
	
		
			
				|  |  | +                                团购价:
 | 
	
		
			
				|  |  | +                                <span>
 | 
	
		
			
				|  |  | +                                  <i>¥ </i>
 | 
	
		
			
				|  |  | +                                  {moneyFormat(goods.price)}
 | 
	
		
			
				|  |  | +                                </span>
 | 
	
		
			
				|  |  | +                              </div>
 | 
	
		
			
				|  |  | +                              {goods.price < goods.originalPrice && (
 | 
	
		
			
				|  |  | +                                <del>¥{moneyFormat(goods.originalPrice)}</del>
 | 
	
		
			
				|  |  | +                              )}
 | 
	
		
			
				|  |  |                              </div>
 | 
	
		
			
				|  |  | -                            <del>¥{moneyFormat(goods.originalPrice)}</del>
 | 
	
		
			
				|  |  | -                          </div>
 | 
	
		
			
				|  |  | -                        )
 | 
	
		
			
				|  |  | -                      }}
 | 
	
		
			
				|  |  | -                    </Cell>
 | 
	
		
			
				|  |  | -                  </CellGroup>
 | 
	
		
			
				|  |  | -                ))
 | 
	
		
			
				|  |  | +                          )
 | 
	
		
			
				|  |  | +                        }}
 | 
	
		
			
				|  |  | +                      </Cell>
 | 
	
		
			
				|  |  | +                    </CellGroup>
 | 
	
		
			
				|  |  | +                  )
 | 
	
		
			
				|  |  | +                )
 | 
	
		
			
				|  |  |                )}
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |              {studentRegisterStore.getGoods &&
 | 
	
	
		
			
				|  | @@ -480,38 +436,8 @@ export default defineComponent({
 | 
	
		
			
				|  |  |            />
 | 
	
		
			
				|  |  |          </Popup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        <MDialog
 | 
	
		
			
				|  |  | -          title="提示"
 | 
	
		
			
				|  |  | -          v-model:show={forms.dialogStatus}
 | 
	
		
			
				|  |  | -          message={forms.dialogMessage}
 | 
	
		
			
				|  |  | -          confirmButtonText="继续支付"
 | 
	
		
			
				|  |  | -          cancelButtonText="取消订单"
 | 
	
		
			
				|  |  | -          showCancelButton
 | 
	
		
			
				|  |  | -          onConfirm={() => {
 | 
	
		
			
				|  |  | -            const paymentConfig = forms.dialogConfig.paymentConfig;
 | 
	
		
			
				|  |  | -            router.push({
 | 
	
		
			
				|  |  | -              path: '/order-detail',
 | 
	
		
			
				|  |  | -              query: {
 | 
	
		
			
				|  |  | -                pm: 1, // h5乐团报名
 | 
	
		
			
				|  |  | -                config: JSON.stringify(paymentConfig.paymentConfig),
 | 
	
		
			
				|  |  | -                orderNo: paymentConfig.orderNo
 | 
	
		
			
				|  |  | -              }
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -          }}
 | 
	
		
			
				|  |  | -          onCancel={async () => {
 | 
	
		
			
				|  |  | -            try {
 | 
	
		
			
				|  |  | -              await request.post(
 | 
	
		
			
				|  |  | -                '/edu-app/userPaymentOrder/cancelPayment/' +
 | 
	
		
			
				|  |  | -                  forms.dialogConfig.orderNo
 | 
	
		
			
				|  |  | -              );
 | 
	
		
			
				|  |  | -            } catch {
 | 
	
		
			
				|  |  | -              //
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -          }}
 | 
	
		
			
				|  |  | -        />
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          {/* 是否在微信中打开 */}
 | 
	
		
			
				|  |  | -        <OWxTip />
 | 
	
		
			
				|  |  | +        {/* <OWxTip /> */}
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |    }
 |