Bläddra i källkod

更新打包优化

lex 1 år sedan
förälder
incheckning
ca55a96760

+ 1 - 1
src/store/modules/student-register-store.ts

@@ -60,7 +60,7 @@ export const useStudentRegisterStore = defineStore('student-register-store', {
      */
     deleteGoods(goodsId: string | number): void {
       const index = this.selectGoods.findIndex(
-        (goods: any) => goods.goodsId === goodsId
+        (goods: any) => goods.productSkuId === goodsId
       );
       this.selectGoods.splice(index, 1);
     },

+ 67 - 141
src/views/student-register/index.tsx

@@ -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>
     );
   }

+ 1 - 22
src/views/student-register/register-modal/index.tsx

@@ -47,27 +47,6 @@ export default defineComponent({
         { text: '八年级', value: 8 },
         { text: '九年级', value: 9 }
       ];
-      // THREE_YEAR_SYSTEM: '三年制',
-      // FORE_YEAR_SYSTEM: '四年制',
-      // FIVE_YEAR_SYSTEM: '五年制',
-      // SIX_YEAR_SYSTEM: '六年制',
-      // NINE_YEAR_SYSTEM: '九年制'
-
-      // if (props.schoolType === 'PRIMARY') {
-      //   if (props.gradeYear === 'FIVE_YEAR_SYSTEM') {
-      //     tempList.push([...five]);
-      //   } else if (props.gradeYear === 'SIX_YEAR_SYSTEM') {
-      //     tempList.push([...five, ...one]);
-      //   }
-      // } else if (props.schoolType === 'JUNIOR') {
-      //   if (props.gradeYear === 'THREE_YEAR_SYSTEM') {
-      //     tempList.push([...three]);
-      //   } else if (props.gradeYear === 'FORE_YEAR_SYSTEM') {
-      //     tempList.push([...one, ...three]);
-      //   }
-      // } else if (props.schoolType === 'PRIMARY_JUNIOR') {
-      //   tempList.push([...five, ...one, ...three]);
-      // }
       if (props.gradeYear === 'FIVE_YEAR_SYSTEM') {
         tempList.push([...five]);
       } else if (props.gradeYear === 'SIX_YEAR_SYSTEM') {
@@ -167,7 +146,7 @@ export default defineComponent({
       } else if (!studentInfo.extra.currentGradeNum) {
         showToast('请选择所在年级');
         return true;
-      } else if (!studentInfo.password) {
+      } else if (!studentInfo.extra.currentClass) {
         showToast('请选择所在班级');
         return true;
       }

+ 1 - 2
src/views/student-register/shop-mall/components/tab-list/index.module.less

@@ -14,5 +14,4 @@
   flex-wrap: wrap;
   justify-content: space-between;
   margin: 0 14px;
-  height: 100%;
-}
+}

+ 3 - 3
src/views/student-register/shop-mall/components/tab-list/index.tsx

@@ -20,12 +20,12 @@ export default defineComponent({
     },
     // 商品类型ID
     productAttributeCategoryId: {
-      type: Number,
+      type: [Number, String],
       default: 0
     },
     // 品牌 ID
     brandId: {
-      type: Number,
+      type: [Number, String],
       default: 0
     },
     sort: {
@@ -122,7 +122,6 @@ export default defineComponent({
       });
     },
     onBuyClick(item: any) {
-      console.log(item, 'item');
       this.selectGoodsItem = item;
       this.addGoodsShow = true;
     }
@@ -136,6 +135,7 @@ export default defineComponent({
           finishedText={''}
           immediateCheck={false}
           class={[styles.goodsList, 'mb12']}
+          style={{ height: !this.list.length ? '100%' : 'auto' }}
           onLoad={this.getList}>
           {(this.list.length &&
             this.list.map((item: any) => (

+ 65 - 52
src/views/student-register/shop-mall/modal/goods-filter-list/index.tsx

@@ -90,58 +90,71 @@ export default defineComponent({
         )}
         <div class={styles.filterWrap}>
           <div class={styles.titlePopup}>筛选</div>
-          {Object.keys(this.params).map((key: string) => (
-            <Cell
-              border={false}
-              v-slots={{
-                title: () => (
-                  <div>
-                    {key === 'productAttributeCategoryList'
-                      ? '商品类型'
-                      : '品牌'}
-                  </div>
-                ),
-                label: () => (
-                  <RadioGroup
-                    class={styles['radio-group']}
-                    modelValue={this.params[key]}
-                    onUpdate:modelValue={val => (this.params[key] = val)}>
-                    {key === 'productAttrbuteCategoryList'
-                      ? this.productAttributeCategoryList.map(
-                          (item: any, index: number) => {
-                            const isActive = index === this.params[key];
-                            const type = isActive ? 'primary' : 'default';
-                            return (
-                              <Radio
-                                class={styles.radio}
-                                name={index}
-                                onClick={() => {}}>
-                                <Tag size="large" type={type}>
-                                  {item.name}
-                                </Tag>
-                              </Radio>
-                            );
-                          }
-                        )
-                      : this.brandList.map((item: any, index: number) => {
-                          const isActive = index === this.params[key];
-                          const type = isActive ? 'primary' : 'default';
-                          return (
-                            <Radio
-                              class={styles.radio}
-                              name={index}
-                              onClick={() => {}}>
-                              <Tag size="large" type={type}>
-                                {item.name}
-                              </Tag>
-                            </Radio>
-                          );
-                        })}
-                  </RadioGroup>
-                )
-              }}
-            />
-          ))}
+          <Cell
+            border={false}
+            title={'商品类型'}
+            v-slots={{
+              label: () => (
+                <RadioGroup
+                  class={styles['radio-group']}
+                  modelValue={this.params.productAttributeCategoryList}
+                  onUpdate:modelValue={val =>
+                    (this.params.productAttributeCategoryList = val)
+                  }>
+                  {this.productAttributeCategoryList.map(
+                    (item: any, index: number) => (
+                      <Radio
+                        key={item.id}
+                        class={styles.radio}
+                        name={index}
+                        onClick={() => {}}>
+                        <Tag
+                          size="large"
+                          type={
+                            index === this.params.productAttributeCategoryList
+                              ? 'primary'
+                              : 'default'
+                          }>
+                          {item.name}
+                        </Tag>
+                      </Radio>
+                    )
+                  )}
+                </RadioGroup>
+              )
+            }}
+          />
+          <Cell
+            border={false}
+            title={'品牌'}
+            v-slots={{
+              label: () => (
+                <RadioGroup
+                  class={styles['radio-group']}
+                  modelValue={this.params.brandList}
+                  onUpdate:modelValue={val => (this.params.brandList = val)}>
+                  {this.brandList.map((item: any, index: number) => (
+                    <Radio
+                      key={item.id}
+                      class={styles.radio}
+                      name={index}
+                      onClick={() => {}}>
+                      <Tag
+                        size="large"
+                        type={
+                          index === this.params.brandList
+                            ? 'primary'
+                            : 'default'
+                        }>
+                        {item.name}
+                      </Tag>
+                    </Radio>
+                  ))}
+                </RadioGroup>
+              )
+            }}
+          />
+
           <Divider style={{ margin: '0' }} />
           <div class={styles.filterAction}>
             <Button