Browse Source

Merge branch 'iteration-20231220'

lex 1 year ago
parent
commit
05e3b7907c

+ 2 - 2
src/components/m-dialog/index.module.less

@@ -3,7 +3,7 @@
     display: inline-block;
     width: 4px;
     height: 14px;
-    background: #259CFE;
+    background: var(--primary-color);
     border-radius: 2px;
     margin-right: 6px;
   }
@@ -45,7 +45,7 @@
     }
 
     .van-dialog__confirm {
-      color: #259CFE;
+      color: var(--primary-color);
     }
   }
 }

+ 6 - 1
src/components/m-dialog/index.tsx

@@ -44,6 +44,10 @@ export default defineComponent({
     allowHtml: {
       type: Boolean,
       default: false
+    },
+    primaryColor: {
+      type: String,
+      default: '#259CFE'
     }
   },
   emits: ['cancel', 'confirm', 'update:show'],
@@ -63,7 +67,8 @@ export default defineComponent({
       <Dialog
         class={styles.oDialog}
         style={{
-          marginTop: props.dialogMarginTop
+          marginTop: props.dialogMarginTop,
+          '--primary-color': props.primaryColor
         }}
         v-model:show={state.show}
         message={props.message}

+ 30 - 7
src/views/student-register/index.tsx

@@ -51,6 +51,7 @@ export default defineComponent({
       submitLoading: false,
       dialogStatus: false,
       dialogMessage: '',
+      dialogConfirmStatus: false,
       countDownTime: 60 * 1000,
       dialogConfig: {} as any,
       showMore: true,
@@ -191,15 +192,24 @@ export default defineComponent({
           '/edu-app/userPaymentOrder/registerStatus/' + forms.schoolId
         );
         const vipList = studentRegisterStore.getVip;
-        const goodsList = studentRegisterStore.getGoods;
 
         if (schoolInfo.data.hasBuyCourse && vipList.length > 0) {
-          setTimeout(() => {
-            showToast('您已购买乐器AI学练工具,请勿重复购买');
-          }, 100);
+          // setTimeout(() => {
+          //   showToast('您已购买乐器AI学练工具,请勿重复购买');
+          // }, 100);
+          forms.dialogConfirmStatus = true;
           return;
         }
+        await paymentContinue();
+      } finally {
+        forms.submitLoading = false;
+      }
+    };
 
+    const paymentContinue = async () => {
+      try {
+        const vipList = studentRegisterStore.getVip;
+        const goodsList = studentRegisterStore.getGoods;
         const params: any[] = [];
         vipList.forEach((vip: any) => {
           params.push({
@@ -264,9 +274,7 @@ export default defineComponent({
             }
           });
         }
-      } finally {
-        forms.submitLoading = false;
-      }
+      } catch {}
     };
 
     onMounted(async () => {
@@ -580,11 +588,26 @@ export default defineComponent({
           />
         </Popup>
 
+        {/* 已经购买过样品 */}
+        <MDialog
+          title="提示"
+          v-model:show={forms.dialogConfirmStatus}
+          message={'已购买会员,是否确认购买?'}
+          primaryColor="#FF8057"
+          allowHtml={true}
+          confirmButtonText="确定"
+          showCancelButton
+          onConfirm={async () => {
+            await paymentContinue();
+          }}
+        />
+
         <MDialog
           title="提示"
           v-model:show={forms.dialogStatus}
           message={forms.dialogMessage}
           allowHtml={true}
+          primaryColor="#FF8057"
           confirmButtonText="继续支付"
           onConfirm={() => {
             const paymentConfig = forms.dialogConfig.paymentConfig;