yinxiangke недель назад: 3
Родитель
Сommit
8d455d6c73

+ 6 - 0
src/api/auth.js

@@ -45,3 +45,9 @@ export function resetPassword(data = {}) {
 export function getPasswordresetCode(data = {}) {
   return request.get('/auth/user/password/reset/request',data)
 }
+
+
+// 发送绑定验证码
+export function sendBindCode(data = {}) {
+  return request.get('/auth/user/bind/code',data)
+}

+ 4 - 1
src/locales/en.js

@@ -299,6 +299,7 @@ export default {
     tianjiabumen:'Add Department',
     bianjibumen:'Edit Department',
     qsrbmmc:'Please Enter The Department Name',
+    qxebm:'Please Select The Department',
     mbsl:'Allocate MiBi Quantity',
     fenpeimibi:'Assign MiBi',
     qsryfpdmbsl:'Please Enter The Employee\'s MiBi Quantity',
@@ -332,7 +333,7 @@ export default {
     openVip:'Become a member to enjoy exclusive privileges',
     zxqy:'Premium Benefits',
     wx:'Infinite',
-    activate:'Activate',
+    activate:'Activate ',
     gfmc:`Buyer's Name`,
     downloadInvoice:'Download invoice',
     rejectReason:'Reason for rejection',
@@ -375,6 +376,8 @@ export default {
     qsrxm:'Please enter the name',
     txxy:'Withdrawal Agreement',
     qydbtytxxy:'Please read and agree to the withdrawal agreement',
+    hyxy:'Membership Agreement',
+    qydbtyhyxy:'Please read and agree to the membership agreement',
   },
   orderConfirm:{
     personalPay:'Personal Payment',

+ 4 - 0
src/locales/zh-CN.js

@@ -302,6 +302,7 @@ export default {
     tianjiabumen:'添加部门',
     bianjibumen:'编辑部门',
     qsrbmmc:'请输入部门名称',
+    qxebm:'请选择部门',
     mbsl:'分配米币数量',
     fenpeimibi:'分配米币',
     kfpmb:'可分配米币',
@@ -378,6 +379,9 @@ export default {
     qsrxm:'请输入姓名',
     txxy:'提现协议',
     qydbtytxxy:'请阅读并同意《提现协议》',
+    hyxy:'会员协议',
+    qydbtyhyxy:'请阅读并同意《会员协议》',
+    
   },
   orderConfirm:{
     personalPay:'个人支付',

+ 143 - 30
src/pages/Member.vue

@@ -6,8 +6,8 @@
         <li v-for="(item, index) in 4" :key="index">小标题优惠文案</li>
       </ul> -->
     </div>
-    <ul class="member-list">
-      <li v-for="(item, index) in list" :key="index">
+    <div class="member-list">
+      <div v-for="(item, index) in list" :key="index" class="li">
         <div class="name">{{ item.typeName }}</div>
         <div class="desc">{{ item.description }}</div>
         <div class="flex-align-center price">
@@ -18,31 +18,55 @@
           </div>
           <!-- <div class="price-right">¥79.00/月</div> -->
         </div>
-        <div class="btn" :class="{btns:item.memberType == 2}" @click="confirmBuy({
-          callback: getList,
-          appStore,
-          router,
-          type: 'baoMiBalance',
-          price: item.price,
-          t,
-          productId: item.typeId,
-          orderType: 'member_recharge',
-          payMethod: 'BMI'
-        })">{{ $t('personalCenter.activate') }}{{ item.typeName }}</div>
+        <div class="btn" :class="{ btns: item.memberType == 2 }" @click="pay(item)">{{ $t('personalCenter.activate')
+        }}{{
+            item.typeName }}</div>
         <div class="line">
           <div class=""></div>
           <div class="">{{ $t('personalCenter.zxqy') }}</div>
           <div class=""></div>
         </div>
-        <div class="ul">
-          <div v-for="(em, ind) in privilegeRes[item.memberType]" :key="ind" class="li flex-center-between">
+        <div class="uls">
+          <div v-for="(em, ind) in privilegeRes[item.memberType]" :key="ind" class="lis flex-center-between">
             <div class="">{{ em.privilegeName }}</div>
             <div class="">{{ em.privilegeValue == -1 ? $t('personalCenter.wx') : `${em.privilegeValue}${em.unit ?
               em.unit : ''}` }}</div>
           </div>
         </div>
-      </li>
-    </ul>
+      </div>
+    </div>
+
+    <el-dialog v-model="dialogVisible" title="Tips" width="600" align-center>
+      <span>{{ $t('common.payNow') }} {{ itemData.price }} {{ $t('common.baomibi') }}?</span>
+      <template #footer>
+        <div class="flex-center-between">
+          <div class="">
+            <el-checkbox v-model="checked" label="Option 1" size="large">
+              <template #default>
+                <div class="">{{ $t('personalCenter.qydbty') }} <span @click="changeShow"
+                    style="color: #2D71FF;font-weight: bold;">《{{ $t('personalCenter.hyxy') }}》</span> </div>
+              </template>
+            </el-checkbox>
+          </div>
+          <div class="dialog-footer">
+            <el-button @click.stop.prevent="dialogVisible = false">{{ $t('common.cancel') }}</el-button>
+            <el-button class="gradient" type="primary" @click.stop.prevent="closeDialog">
+              {{
+                $t('common.confirm') }}
+            </el-button>
+          </div>
+        </div>
+      </template>
+    </el-dialog>
+    <el-dialog v-model="showWithdraw" :title="$t('personalCenter.hyxy')" width="50%" align-center>
+      <div class="" style="height: 500px;overflow-y: scroll;" v-html="agreementContent"></div>
+      <template #footer>
+        <div class="dialog-footer flex-center">
+          <el-button class="gradient" type="primary" @click="confirmAgreement">{{
+            $t('common.confirm') }}</el-button>
+        </div>
+      </template>
+    </el-dialog>
   </div>
 </template>
 <script setup lang="ts">
@@ -62,6 +86,15 @@ import { confirmBuy } from '@/utils/util.js'
 
 import { useI18n } from 'vue-i18n'
 
+import { getAgreementType } from '@/api/common.js'
+
+import { createOrder } from '@/api/order.js'
+
+import DGTMessage from '@/utils/message'
+
+
+import { ElMessage, ElMessageBox } from 'element-plus'
+
 const { t } = useI18n()
 
 const appStore = useAppStore()
@@ -71,6 +104,88 @@ const router = useRouter()
 const list = ref([]);
 const privilegeRes = ref({ 1: [], 2: [] })
 
+const dialogVisible = ref(false);
+const itemData = ref({});
+const checked = ref(false);
+const showWithdraw = ref(false);
+const agreementContent = ref('');
+
+const confirmAgreement = async () => {
+  checked.value = true;
+  showWithdraw.value = false;
+}
+
+const changeShow = async () => {
+  let res = await getAgreementType({
+    agreementType: 'membership_agreement'
+  });
+  if (res.code === 200) {
+    agreementContent.value = res.data.content || '';
+    showWithdraw.value = true;
+  }
+}
+
+const closeDialog = async () => {
+
+  if (!checked.value) {
+    return DGTMessage.warning(t('personalCenter.qydbtyhyxy'));
+  }
+  dialogVisible.value = false;
+  if (appStore.userInfo.baoMiBalance < itemData.value.price) {
+    ElMessageBox.confirm(t('common.balanceNotEnough'), t('common.tip'), {
+      confirmButtonText: t('common.confirm'),
+      cancelButtonText: t('common.cancel'),
+      type: 'warning'
+    }).then(() => {
+      // 确认购买
+      router.push({
+        path: `/order-confirm`,
+      })
+    }).catch(() => {
+      // 取消购买
+    });
+    return
+  }
+  const res = await createOrder({
+    payMethod:'BMI',
+    orderType:'member_recharge',
+    orderAmt: itemData.value.price,
+    productId: itemData.value.typeId,
+    orderNum: 1
+  })
+  if (res.code === 200) {
+    DGTMessage.success(t('common.paySuccess'))
+    appStore.USERINFO();
+    router.push({ path: '/personal-center/wallet' });
+  }
+}
+
+const pay = async (item) => {
+  console.log('item', item)
+  itemData.value = item;
+  dialogVisible.value = true;
+  // let res = await confirmBuy({
+  //   memberType: item.memberType,
+  //   price: item.price
+  // });
+  // if (res) {
+  //   appStore.getUserInfo();
+  //   router.push({ path: '/personal-center' });
+  // }
+
+  // confirmBuy({
+  //         callback: getList,
+  //         appStore,
+  //         router,
+  //         type: 'baoMiBalance',
+  //         price: item.price,
+  //         t,
+  //         productId: item.typeId,
+  //         orderType: 'member_recharge',
+  //         payMethod: 'BMI'
+  //       })
+}
+
 const getprivilegeRes = async (memberType) => {
   let privilegeRes = await privilege(memberType);
   return privilegeRes.data;
@@ -97,12 +212,6 @@ onMounted(() => {
 
 </script>
 <style lang="scss">
-ul,
-li {
-  margin: 0;
-  padding: 0;
-}
-
 .member {
   max-width: 1246px;
   margin: 0 auto;
@@ -128,7 +237,7 @@ li {
 
     margin-top: 24px;
 
-    li {
+    .li {
       font-size: 18px;
       margin-right: 66px;
 
@@ -144,7 +253,7 @@ li {
   gap: 48px;
   flex-wrap: wrap;
 
-  li {
+  .li {
     width: 383px;
     padding: 24px 32px;
     background: #FFFFFF;
@@ -195,6 +304,7 @@ li {
       background: linear-gradient(270deg, #FBE8CF 0%, #F8C79D 52.05%, #FADCB9 100%);
       border-radius: 10px;
     }
+
     .btns {
       color: #FAD8B4;
       background: #3B3843;
@@ -204,6 +314,7 @@ li {
       // width: 164px;
       display: flex;
       align-items: center;
+
       // background: url('/src/assets/imgs/line@2x.png') no-repeat;
       // background-size: 164px 3px;
       // background-position: center center;
@@ -220,24 +331,26 @@ li {
         &:last-child {
           width: 46px;
           height: 3px;
-         
-         
+
+
         }
+
         &:first-child {
-           background: linear-gradient(270deg, #8B3D22 0%, rgba(139, 61, 34, 0) 100%);
+          background: linear-gradient(270deg, #8B3D22 0%, rgba(139, 61, 34, 0) 100%);
         }
+
         &:last-child {
           background: linear-gradient(90deg, #8B3D22 0%, rgba(139, 61, 34, 0) 100%);
         }
       }
     }
 
-    .ul {
+    .uls {
       width: 100%;
       color: #8B3D22;
       font-size: 14px;
 
-      .li {
+      .lis {
         margin-top: 16px;
       }
     }

+ 2 - 2
src/pages/Personal/BusinessManagement.vue

@@ -77,7 +77,7 @@
             <el-col :span="24">
               <el-form-item :label="$t('personalCenter.bumen')" prop="deptId">
                 <el-tree-select v-model="formInline.deptId" :data="dataSource" :props="defaultProps"
-                  :placeholder="$t('common.qingxuanze')" />
+                  :placeholder="$t('personalCenter.qxebm')" />
               </el-form-item>
             </el-col>
           </el-row>
@@ -150,7 +150,7 @@
         <el-row :gutter="0" v-else>
           <el-col :span="24">
             <el-form-item :label="$t('personalCenter.bumen')" prop="deptName">
-              <el-input v-model="formInline.deptName" :placeholder="$t('common.placeholderInput')" />
+              <el-input v-model="formInline.deptName" :placeholder="$t('personalCenter.qsrbmmc')" />
             </el-form-item>
           </el-col>
         </el-row>

+ 7 - 10
src/pages/Personal/Collection.vue

@@ -4,8 +4,8 @@
       <div class="line_vertical"></div>
       <div class="">{{ $t('personalCenter.myCollection') }}</div>
     </div>
-    <ul class="collection-list">
-      <li @click="toDetail(item)" class="flex-center-between" v-for="(item, index) in list" :key="index">
+    <div class="collection-list">
+      <div @click.prevent="toDetail(item)" class="flex-center-between li" v-for="(item, index) in list" :key="index">
         <img class="image" :src="item.coverImageUrl" alt="">
         <div class="collection-list-main">
           <div class="collection-list-main-left">
@@ -15,13 +15,13 @@
             </div>
             <div class="">{{ item.courseIntro }}</div>
           </div>
-          <div @click.stop="cancelCollect(item, index)" class="btn flex-center active">
+          <div @click.stop.prevent="cancelCollect(item, index)" class="btn flex-center active">
             <img src="/src/assets/imgs/my/star@2x.png" alt="">
             <div class="">{{ $t('common.cancelCollect') }}</div>
           </div>
         </div>
-      </li>
-    </ul>
+      </div>
+    </div>
     <template v-if="list.length">
       <Pagination :total="form.total" :page-size="form.pageSize" :current-page="form.pageNum"
         @page-change="handlePageChange" />
@@ -89,10 +89,7 @@ onMounted(() => {
 })
 </script>
 <style scoped lang="scss">
-  ul,li {
-    margin: 0;
-    padding: 0;
-  }
+
 .collection {
   padding-bottom: 20px;
 
@@ -104,7 +101,7 @@ onMounted(() => {
   }
 
   .collection-list {
-    li {
+    .li {
       padding: 16px;
       margin-bottom: 16px;
       background: #F5F7FA;

+ 41 - 2
src/pages/Personal/Wallet.vue

@@ -129,7 +129,7 @@
         <el-form-item prop="checked">
           <el-checkbox v-model="walletForm.checked">
             <template #default>
-              <div class="">{{ $t('personalCenter.qydbty') }} <span style="color: #2D71FF;font-weight: bold;">《{{  $t('personalCenter.zhxy') }}》</span> </div>
+              <div class="">{{ $t('personalCenter.qydbty') }} <span @click.stop.prevent="changeShow('currency_conversion_protoco')" style="color: #2D71FF;font-weight: bold;">《{{  $t('personalCenter.zhxy') }}》</span> </div>
             </template>
           </el-checkbox>
         </el-form-item>
@@ -181,7 +181,7 @@
         <el-form-item prop="checked1">
           <el-checkbox v-model="ruleForm.checked1">
             <template #default>
-              <div class="">{{ $t('personalCenter.qydbty') }} <span style="color: #2D71FF;font-weight: bold;">《{{  $t('personalCenter.txxy') }}》</span> </div>
+              <div class="">{{ $t('personalCenter.qydbty') }} <span @click.stop.prevent="changeShow('withdrawal_agreement')" style="color: #2D71FF;font-weight: bold;">《{{  $t('personalCenter.txxy') }}》</span> </div>
             </template>
           </el-checkbox>
         </el-form-item>
@@ -194,6 +194,18 @@
         </div>
       </template>
     </el-dialog>
+
+    <el-dialog v-model="showWithdraw" :title="agreementTitle" width="50%">
+      <div class="" style="height: 500px;overflow-y: scroll;" v-html="agreementContent"></div>
+      <template #footer> 
+        <div class="dialog-footer flex-center">
+           <el-button class="gradient" type="primary" @click="confirmAgreement">{{
+            $t('common.confirm') }}</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
+
   </div>
 </template>
 <script lang="ts" setup>
@@ -209,6 +221,8 @@ import { payConfigDearch, calRate } from '@/api/order'
 
 import { recordList, applyWithdraw, withdrawList } from '@/api/my'
 
+import { getAgreementType } from '@/api/common.js'
+
 import { createOrder } from '@/api/order.js'
 
 import { useAppStore } from '@/pinia/appStore'
@@ -271,6 +285,31 @@ const ruleForm = ref({
 
 const ruleFormRefs = ref()
 
+const showWithdraw = ref(false);
+const agreementContent = ref('');
+const agreementTitle = ref('');
+
+const confirmAgreement = () => {
+  if (['转换协议','Conversion Agreement'].includes(agreementTitle.value)) {
+    console.log('111')
+   walletForm.value.checked = true;
+  } else {
+    ruleForm.value.checked1 = true;
+  }
+  showWithdraw.value = false;
+  
+}
+// 获取协议
+const changeShow = async (type) => {
+
+  agreementTitle.value = t(type == 'withdrawal_agreement' ? 'personalCenter.txxy' : 'personalCenter.zhxy');
+  let res = await getAgreementType({ agreementType: type });
+  if (res.code === 200) {
+    showWithdraw.value = true;
+    agreementContent.value = res.data.content || '';
+  }
+}
+
 const validatePass = (rule: any, value: any, callback: any) => {
   if (!value) {
     callback(new Error(t('common.placeholderInput')))

+ 5 - 11
src/pages/PersonalCenter.vue

@@ -435,7 +435,7 @@ import type { InputInstance } from 'element-plus'
 
 import { useRoute, useRouter } from 'vue-router'
 
-import { getUserInfo, updateUserInfo, getSmsCode, getEmailCode } from '@/api/auth.js'
+import { getUserInfo, updateUserInfo, getSmsCode, getEmailCode,sendBindCode } from '@/api/auth.js'
 
 import { checkIn, queryCollectCount, issue, issueList, faqList, getfaq, createAiAccount } from '@/api/my.js'
 
@@ -698,16 +698,10 @@ const sendSmsCode = async () => {
     return
   }
 
-  let res = null;
-  if (PHONE_REGEX.test(account) && appStore?.userInfo?.email) {
-    res = await getSmsCode({
-      phone: account
-    })
-  } else if (EMAIL_REGEX.test(account) && appStore?.userInfo?.userPhone) {
-    res = await getEmailCode({
-      email: account
-    })
-  }
+  let res = await sendBindCode({
+    account: account,
+    type: appStore?.userInfo?.userPhone ? 'email' : 'phone'
+  });
 
   if (res.code !== 200) {
     return