Quellcode durchsuchen

feat:“增加优惠码单个手动添加功能”

soobin vor 1 Jahr
Ursprung
Commit
2ccad807df

+ 1 - 0
package.json

@@ -52,6 +52,7 @@
     "eslint-plugin-vue": "^7.0.0-0",
     "less": "^3.12.2",
     "less-loader": "^7.0.2",
+    "postcss": "^8.4.38",
     "postcss-pxtorem": "^5.1.1",
     "vue-loader-v16": "^16.0.0-beta.5.4"
   },

+ 11 - 0
postcss.config.js

@@ -0,0 +1,11 @@
+module.exports = {
+    plugins: {
+    //   'autoprefixer': {
+    //     overrideBrowserslist: ['Android >= 4.0', 'iOS >= 7']
+    //   },
+      'postcss-pxtorem': {
+        rootValue: 36,//结果为:设计稿元素尺寸/16,比如元素宽320px,最终页面会换算成 20rem
+        propList: ['*']
+      }
+    }
+  }

+ 10 - 3
src/assets/language/en.json

@@ -300,7 +300,7 @@
     "to": " to ",
     "attention": "(Note: the number of bits is incorrect, updating may cause machine anomalies)",
     "submitUpdates": "Submit Updates",
-    "nameLength":"The name of the machine should not exceed 15 words",
+    "nameLength":"The name of the machine should not exceed 25 words",
     "modificationSucceeded": "Modification succeeded",
     "existsFailed": "The machine name already exists",
     "editFailed": "Modification failure",
@@ -598,6 +598,12 @@
     "checkedAll": "PickAll"
   },
   "discountCode": {
+    "addMode": "Generation mode",
+    "randomAdd": "Batch random generation",
+    "oneceAdd": "Single manual addition",
+    "codeNum": "Promotion code",
+    "codeNumPlaceholder": "Please enter a 6-digit promo code",
+    "existsCode": "Promo code already exists!",
     "discountCodeNoLabel": "Discount code No",
     "discountCodeNoPlaceholder": "Please enter the discount code number",
     "creationTime": "Creation time",
@@ -620,7 +626,8 @@
     "selectAll": "All",
     "confirmDel": "Confirm deletion",
     "deletionSucceeded": "Deletion succeeded",
-    "discount": "discount",
+    "discount": "Discount",
+    "sameAs": "Same as ",
     "deduction": "deduction",
     "termOfValidity": "Valid until",
     "affiliatedMerchants": "Business Owner",
@@ -635,7 +642,7 @@
     "Months": "Months",
     "noMoreThanMonths": "(no more than 3 months)",
     "days": " days",
-    "type": "type",
+    "type": "Type",
     "deductionRoll": "Deduction roll",
     "discount2": "Discount",
     "deductionPriceLabdel": "Deduction price",

+ 10 - 3
src/assets/language/ja.json

@@ -297,7 +297,7 @@
         "to": "に",
         "attention": "(注意:桁数が正しくない場合、更新によりマシンに異常が発生する可能性があります)",
         "submitUpdates": "更新を提出",
-        "nameLength":"装置名は15文字以内です",
+        "nameLength":"装置名は25文字以内です",
         "modificationSucceeded": "変更に成功",
         "existsFailed": "デバイス名はすでに存在します",
         "editFailed": "変更に失敗",
@@ -599,6 +599,12 @@
         "checkedAll": "全て選択"
     },
     "discountCode": {
+        "addMode": "生成方法です",
+        "randomAdd": "大量ランダム生成です",
+        "oneceAdd": "手動で追加します",
+        "codeNum": "プレミアムコードです",
+        "codeNumPlaceholder": "6桁のプレミアムコードの入力をお願いします。",
+        "existsCode": "特典コードはすでに存在します!",
         "discountCodeNoLabel": "ディスカウントコード番号",
         "discountCodeNoPlaceholder": "ディスカウントコードを入力",
         "creationTime": "作成時間",
@@ -622,6 +628,7 @@
         "confirmDel": "削除を確認",
         "deletionSucceeded": "削除完了",
         "discount": "割引",
+        "sameAs": "",
         "deduction": "控除",
         "termOfValidity": "有効期限",
         "affiliatedMerchants": "提携加盟店",
@@ -638,8 +645,8 @@
         "days": "日",
         "type": "タイプ",
         "deductionRoll": "控除ロール",
-        "discount2": "割引",
-        "deductionPriceLabel": "控除価格",
+        "discount2": "割引",     
+        "deductionPriceLabdel": "控除価格",
         "deductionPricePlaceholder": "控除価格を入力してください",
         "enterNumber": "数字を入力",
         "paymentMethod": "支払い方法",

+ 8 - 1
src/assets/language/zh.json

@@ -296,7 +296,7 @@
     "isUpdate": "是否更新",
     "to": "为",
     "attention": "(注意:位数不正确,更新可能会造成机器异常)",
-    "nameLength":"设备名称不超过15个字",
+    "nameLength":"设备名称不超过25个字",
     "submitUpdates": "提交更新",
     "modificationSucceeded": "修改成功",
     "existsFailed": "设备名称已存在",
@@ -599,6 +599,12 @@
     "checkedAll": "全选"
   },
   "discountCode": {
+    "addMode": "生成方式",
+    "randomAdd": "批量随机生成",
+    "oneceAdd": "单个手动添加",
+    "codeNum": "优惠码",
+    "codeNumPlaceholder": "请输入6位数的优惠码",
+    "existsCode": "优惠码已存在!",
     "discountCodeNoLabel": "优惠码编号",
     "discountCodeNoPlaceholder": "请输入优惠码编号",
     "creationTime": "创建时间",
@@ -622,6 +628,7 @@
     "confirmDel": "确认删除",
     "deletionSucceeded": "删除成功",
     "discount": "折扣",
+    "sameAs": "相当于",
     "deduction": "抵扣",
     "termOfValidity": "有效期",
     "affiliatedMerchants": "所属商家",

+ 16 - 11
src/styles/device/index.less

@@ -282,8 +282,9 @@
 
               .word3 {
                 width: 50%;
-                padding: 0 0;
+                // padding: 0 0;
                 margin-right: 10px;
+                line-height: 0.5rem;
               }
 
               .editIcon {
@@ -296,10 +297,14 @@
               }
 
               .clickable-link {
-                text-decoration: underline;
+                // text-decoration: underline;
                 cursor: pointer;
                 font-size: 0.375rem;
-                width: 75%;
+                width: 80%;
+                // display: flex;
+                // flex-wrap: wrap;
+                // padding-right: 1rem;
+                // margin-right: 1rem;
                 line-height: 0.5rem;;
               }
 
@@ -360,17 +365,17 @@
             }           
 
             .layer5 {
-              width: 100%;
-
+              // width: 100%;
+              padding: 10px 10px;
               .word5 {
                 // width: 33.33%;
-                overflow-wrap: break-word;
+                // overflow-wrap: break-word;
                 color: rgba(64, 77, 116, 1);
                 font-size: 0.375rem;
-                text-align: left;
-                line-height: 0.375rem;
-                display: block;
-                padding: 10px 10px;
+                // text-align: left;
+                // line-height: 0.8rem;
+                // display: block;
+                
               }
 
               // .word6 {
@@ -608,7 +613,7 @@
           .sugarTxt {
             color: rgba(64, 77, 116, 1);
             font-size: 0.375rem;
-            line-height: 0.375rem;
+            // line-height: 0.8rem;
             padding: 10px 10px;
           }
 

+ 9 - 0
src/styles/discountCode/index.less

@@ -189,6 +189,15 @@
         background-color: #4d6add;
         border-color: #4d6add;
     }
+
+    .van-radio--horizontal {
+        width: 100%;
+        height: 0.8rem;
+    }
+
+    .van-field__label {
+        width: 2.5rem;
+    }
 }
 
 .codeSearch {

+ 13 - 3
src/views/announcement/index.vue

@@ -3,6 +3,14 @@
   <div class="showGoodsIdx">
     <s-header :name="$t('announcement.header')" :noback="false"></s-header>
     <van-cell-group inset>
+      <van-field name="radio" label="公司平台">
+        <template #input>
+          <van-radio-group v-model="companyType" direction="horizontal">
+            <van-radio name="0">申泽</van-radio>
+            <van-radio name="1">七云</van-radio>
+          </van-radio-group>
+        </template>
+      </van-field>
       <van-field v-model="title" label="标题" placeholder="请输入标题" />
     </van-cell-group>
     <div style="width: 100%">
@@ -40,7 +48,8 @@ export default {
     const sumbitNotice = async () => {
       let addParams = {
         "title": title.value,
-        "note": content.value
+        "note": content.value,
+        "companyType": companyType.value
       };
       console.log("addParams", addParams)
       const { data } = await addNotice(addParams)
@@ -54,13 +63,14 @@ export default {
         showFailToast(`${t('announcement.failed')} ${data.message}`);
       }
     }
-
+    const companyType = ref('0');
     // 引入语言
     return {
       inputContent,
       title,
       content,
-      sumbitNotice
+      sumbitNotice,
+      companyType
     };
   },
 };

+ 1 - 1
src/views/device/deviceSet.vue

@@ -458,7 +458,7 @@ export default {
         };
       })[0];
       console.log(params);
-      if (params.name.length > 15) {
+      if (params.name.length > 25) {
         showToast(t("device.nameLength"));
         return;
       }

+ 12 - 10
src/views/device/index.vue

@@ -71,12 +71,12 @@
                     </div>
                   </div>
                   <!-- <div class="l-flex-RC"> -->
-                    <!-- <div v-if="item.hasTodayAlarm" class="l-flex-between o-pl-5">
+                  <!-- <div v-if="item.hasTodayAlarm" class="l-flex-between o-pl-5">
                       <div class="box4 flex-col"></div>
                       <span class="o-pl-2" style="color: #fe5d55">{{ $t("device.alarmClock") }}</span>
                     </div> -->
-                    <div v-if="item.hasTodayAlarm" :class="{ 'flash-icon': showAlert }" class="box4 o-mr-5"></div>
-                    <div v-if="!item.hasTodayAlarm" class="layer2 o-mr-5" :class="{
+                  <div v-if="item.hasTodayAlarm" :class="{ 'flash-icon': showAlert }" class="box4 o-mr-5"></div>
+                  <div v-if="!item.hasTodayAlarm" class="layer2 o-mr-5" :class="{
         deviceOn: item.eqeStatus === 1,
         layerLeft: item.hasTodayAlarm,
       }"></div>
@@ -87,11 +87,11 @@
         item.adminUserName
       }}</span>
                 <!-- 机器编码 -->
-                <span class="txt1 o-mt-10 kBordBott">{{ $t("device.machineUniqueCode") }}:{{
+                <span class="txt1 o-mt-10">{{ $t("device.machineUniqueCode") }}:{{
         item.clientId
       }}</span>
                 <!-- 锁机状态 -->
-                <span v-if="user.type < 1" class="txt1 o-mt-10 kBordBott">{{ $t("device.lockCondition") }}:{{
+                <span v-if="user.type < 1" class="txt1 o-mt-10">{{ $t("device.lockCondition") }}:{{
         item.isBlocked ? $t("device.lockState") : $t("device.unLockState")
       }}</span>
                 <img v-if="item.checkType" class="pic1" referrerpolicy="no-referrer" src="../../assets/home/line.png" />
@@ -194,7 +194,7 @@
                   </div> -->
 
                   <!-- 定位: -->
-                  <span v-if="item.latitude" class="contentWord kBordBott l-flex-RC">
+                  <span v-if="item.latitude" class="contentWord kBordBott l-flex-LC justify-space-between">
                     <span>{{ $t("device.position") }}:</span>
                     <a class="clickable-link" @click="viewPosiClk(item)">{{ item.fullName }}</a>
                   </span>
@@ -268,7 +268,7 @@
                   <span v-if="item.machineType != '2'" class="contentWord kBordBott">{{ $t("device.volume") }}:{{
         item.volume }}</span>
                   <!-- 报警内容 -->
-                  <div class="contentWord kBordBott l-flex-RC">
+                  <div class="contentWord kBordBott l-flex-LC justify-space-between">
                     <span>{{ $t("device.alarmContent") }}:</span>
                     <!-- <div class="l-flex-RC"> -->
                     <span class="word3">{{
@@ -277,9 +277,9 @@
           : $t("device.alarmContentNoData")
       }}
                     </span>
-                    <van-button v-if="item.alarmList && item.alarmList[0] && item.alarmList[0].alarmContent"
+                    <van-button v-if="item.alarmList && item.alarmList[0] && item.alarmList[0].alarmContent" style="flex-shrink: 0; margin: 0;"
                       type="primary" color="#07c160" :text="$t('device.eliminateAlarm')"
-                      @click="clearAlarm(item.alarmList[0])"></van-button>
+                      @click="clearAlarm(item.alarmList[0], item)"></van-button>
                     <!-- </div> -->
                   </div>
                   <div class="editDeviceBtnCon l-flex-center o-mt-10">
@@ -515,7 +515,8 @@ export default {
       oprRef.value.showOper(e);
     };
     // 消除报警
-    const clearAlarm = async (e) => {
+    const clearAlarm = async (e, e1) => {
+      console.log(e1);
       const params = {
         id: e.id,
         name: e.name,
@@ -534,6 +535,7 @@ export default {
         showSuccessToast(t("device.successfullyEliminatedTheAlarm"));
         setTimeout(() => {
           e.alarmContent = "";
+          e1.hasTodayAlarm = false;
         }, 1000);
         console.log("e", e);
       } else {

+ 2 - 2
src/views/discountCode/index.vue

@@ -64,7 +64,7 @@
                 </span>
                 {{ item.discount }}
               </div>
-              <div class="itemRow">
+              <div class="itemRow" v-if="item.isUse == '0'">
                 <span class="itemTitle">
                   {{ $t('discountCode.creationTime') }}:&nbsp;
                 </span>
@@ -82,7 +82,7 @@
                 </span>
                 {{ showDateTime(item.useDate) }}
               </div>
-              <div class="itemRow">
+              <div class="itemRow" v-if="item.isUse == '0'">
                 <span class="itemTitle">
                   {{ $t('discountCode.termOfValidity') }}:&nbsp;
                 </span>{{ showDate(item.lastUseDate) }}

+ 54 - 26
src/views/discountCode/payCode.vue

@@ -3,20 +3,31 @@
   <div class="discountCodePage flex-col">
     <s-header :name="$t('discountCode.applDiscCode')" :noback="false"></s-header>
     <div class="discountCodeBox flex-col">
+      <van-field name="radio" :label="$t('discountCode.addMode')">
+        <template #input>
+          <van-radio-group v-model="addMode" direction="horizontal">
+            <van-radio name="1">{{ $t('discountCode.randomAdd') }}</van-radio>
+            <van-radio name="2">{{ $t('discountCode.oneceAdd') }}</van-radio>
+          </van-radio-group>
+        </template>
+      </van-field>
       <van-form @submit="onSubmit">
         <van-field v-model="number" name="number" :label="$t('discountCode.numberOfDiscountCodesLabel')"
-          :placeholder="$t('discountCode.numberOfDiscountCodesPlaceholder')">
+          :placeholder="$t('discountCode.numberOfDiscountCodesPlaceholder')" v-if="addMode == '1'">
           <template #button>
             <span>{{ $t('discountCode.aSingleGenerationCannotExceed') }}</span>
           </template>
         </van-field>
+        <van-field v-if='addMode === "2"' v-model="codeNum" type="number" :label="$t('discountCode.codeNum')"
+          maxlength="6" :placeholder="$t('discountCode.codeNumPlaceholder')">
+        </van-field>
         <van-field v-model="month" name="number" :label="$t('discountCode.termOfValidity')"
           :placeholder="$t('discountCode.pleaseEnterTheValidityPeriod')">
           <template #button>
             <span>{{ $t('discountCode.Months') }}<span>{{ $t('discountCode.noMoreThanMonths') }}</span></span>
           </template>
         </van-field>
-        <van-field readonly v-model="validDays" :label="$t('discountCode.validDays')" placeholder="" />
+        <!-- <van-field readonly v-model="validDays" :label="$t('discountCode.validDays')" placeholder="" /> -->
         <div class="van-cell van-field">
           <div class="van-cell__title van-field__label"><span>{{ $t('discountCode.type') }}</span></div>
           <div class="van-cell__value van-field__value radioBox">
@@ -26,13 +37,13 @@
             </van-radio-group>
           </div>
         </div>
-        <van-field v-if='type === "1"' v-model="discount" name="number" :label="$t('discountCode.deductionPriceLabdel')"
-          :placeholder="$t('discountCode.deductionPricePlaceholder')">
+        <van-field v-if='type === "1"' v-model="discount" type="number" name="number"
+          :label="$t('discountCode.deductionPriceLabdel')" :placeholder="$t('discountCode.deductionPricePlaceholder')">
         </van-field>
-        <van-field v-if='type === "0"' v-model="discount" name="number" :label="$t('discountCode.discount')"
-          :placeholder="$t('discountCode.enterNumber')">
-          <template #button>
-            <span>0-10</span>
+        <van-field v-if='type === "0"' v-model="discount" type="number" name="number"
+          :label="$t('discountCode.discount') + '(0-10)'" :placeholder="$t('discountCode.enterNumber')">
+          <template #button v-if="user.ifForeign === '1' && discount != ''">
+            <span>{{ $t('discountCode.sameAs') + (10 - discount) * 10 }}% off</span>
           </template>
         </van-field>
         <div class="van-cell van-field" v-if='type === "0" && discount === "0" && promoCodeOpen != "0"'>
@@ -46,7 +57,7 @@
         </div>
         <van-row justify="space-around" style="padding: 1em;">
           <van-button span="5" round type="primary" style="height: 2em; padding: 0 2em;" native-type="submit">{{
-            $t('discountCode.apply') }}</van-button>
+      $t('discountCode.apply') }}</van-button>
         </van-row>
       </van-form>
     </div>
@@ -64,7 +75,11 @@
 import sHeader from "@/components/SimpleHeader";
 import { onMounted, reactive, toRefs, ref, watch } from "vue";
 import { getLoginUser, Format_calcuDecial, styleUrl } from "@/common/js/utils";
-import { showFailToast, showSuccessToast } from "vant";
+import {
+  showFailToast,
+  showSuccessToast,
+  showToast
+} from "vant";
 import { addCode } from "@/service/discountCode";
 import { useRouter } from "vue-router";
 import { useI18n } from "vue-i18n";
@@ -77,6 +92,8 @@ export default {
     const { t } = useI18n();
     const router = useRouter();
     let payParams = reactive({
+      addMode: '1', // 生成方式
+      codeNum: '', // 优惠码
       number: '', // 优惠码个数
       month: '', // 有效期
       type: '1', // 优惠卷类型
@@ -86,7 +103,7 @@ export default {
     const payCodeType = ref(false);
     const ewmObj = ref(null);
     const promoCodeOpen = ref(''); // 0折优惠码开通状态
-
+    const user = getLoginUser();
 
     // 初始化页面
     onMounted(async () => {
@@ -98,30 +115,36 @@ export default {
       payParams.type = '1';
       payParams.discount = '';
       payParams.frpCode = 'WEIXIN_NATIVE';
-      const user = getLoginUser();
-      if (user) { 
+      if (user) {
         payParams.adminId = user.id;
         promoCodeOpen.value = user.promoCodeOpen;
         // console.log("promoCodeOpen",promoCodeOpen.value);
       }
     });
 
-    // 提交搜索表单触发搜索
+    // 申请优惠码
     const onSubmit = async () => {
-      if (payParams.number === '') { showFailToast(t('discountCode.numberOfDiscountCodesPlaceholder')); return; }
-      if (payParams.month === '') { showFailToast(t('discountCode.pleaseEnterTheValidityPeriod')); return; }
-      if (payParams.type === '1' && payParams.discount === '') { showFailToast(t('discountCode.deductionPricePlaceholder')); return; }
-      if (payParams.type === '0' && payParams.discount === '') { showFailToast(t('discountCode.pleaseEnterDiscount')); return; }
-      if (parseInt(payParams.number) > 200) { showFailToast(t('discountCode.theNumberOfDiscountCodesCannotExceed')); return; }
-      if (parseInt(payParams.month) > 3) { showFailToast(t('discountCode.theValidityPeriodCannotExceedMonths')); return; }
-      if (payParams.type === '0' && parseInt(payParams.discount) > 10) { showFailToast(t('discountCode.discountCannotBeGreaterThan')); return; }
+      if (payParams.addMode === '1') {
+        payParams.codeNum = '';
+        if (payParams.number === '') { showToast(t('discountCode.numberOfDiscountCodesPlaceholder')); return; }
+      } else {
+        payParams.number = "1";
+        if (payParams.codeNum.length != 6) { showToast(t('discountCode.codeNumPlaceholder')); return; }
+      }
+      if (payParams.month === '') { showToast(t('discountCode.pleaseEnterTheValidityPeriod')); return; }
+      if (payParams.type === '1' && payParams.discount === '') { showToast(t('discountCode.deductionPricePlaceholder')); return; }
+      if (payParams.type === '0' && payParams.discount === '') { showToast(t('discountCode.pleaseEnterDiscount')); return; }
+      if (parseInt(payParams.number) > 200) { showToast(t('discountCode.theNumberOfDiscountCodesCannotExceed')); return; }
+      if (parseInt(payParams.month) > 3) { showToast(t('discountCode.theValidityPeriodCannotExceedMonths')); return; }
+      if (payParams.type === '0' && parseInt(payParams.discount) > 10) { showToast(t('discountCode.discountCannotBeGreaterThan')); return; }
+      console.log("payParams", payParams);
       const { data } = await addCode(Object.assign({}, payParams));
       if (payParams.type === '0' && payParams.discount === '0' && promoCodeOpen.value != '0') {
-        // console.log("data", data);
+        console.log("data", data);
         ewmObj.value = data.data;
         payCodeType.value = true;
       } else {
-        // console.log("data", data);
+        console.log("data", data);
         if (data.code === '00000') {
           showSuccessToast(t('discountCode.successfulProductionOfDiscountCode'));
           // router.push({ path: '/discountCode' });
@@ -129,7 +152,11 @@ export default {
             router.go(-1);
           }, 1500);
         } else {
-          showFailToast(data.message);
+          if (data.code === 'A0002') {
+            showFailToast(t('discountCode.existsCode'));
+          } else {
+            showFailToast(data.message);
+          }
         }
       }
     }
@@ -138,7 +165,7 @@ export default {
       router.go(-1);
     }
     // 有效天数
-    const validDays = ref('0'+ t('discountCode.days'));
+    const validDays = ref('0' + t('discountCode.days'));
     // 监听有效期,计算有效天数
     watch(() => payParams.month, (newVal) => {
       validDays.value = Format_calcuDecial(newVal, 30) + t('discountCode.days');
@@ -150,7 +177,8 @@ export default {
       onSubmit,
       payCodeClose,
       validDays,
-      promoCodeOpen
+      promoCodeOpen,
+      user,
     };
   },
 };

+ 1 - 1
src/views/orderCenter/index.vue

@@ -203,7 +203,7 @@
             </div>
             <div class="orderDetailBox flex-row justify-between l-flex-center"
               v-if="(refundObject.status != 0 && refundObject.status != 2) && orderType == '3'">
-              <span class="title o-mr-40">是否开发票</span>
+              <span class="title">是否开发票</span>
               <van-radio-group v-model="isInvoice" direction="horizontal">
                 <van-radio :name="1">是</van-radio>
                 <van-radio :name="0">否</van-radio>

+ 22 - 2
src/views/settlement/index.vue

@@ -509,8 +509,16 @@ export default {
         value: "03010000",
       },
       {
-        text: '中国邮政储蓄银行',
-        value: "04030000",
+        text: '中信银行',
+        value: "03020000",
+      },
+      {
+        text: '中国光大银行',
+        value: "03030000",
+      },
+      {
+        text: '华夏银行',
+        value: "03040000",
       },
       {
         text: '中国民生银行',
@@ -525,6 +533,18 @@ export default {
         value: "03080000",
       },
       {
+        text: '兴业银行',
+        value: "03090000",
+      },
+      {
+        text: '中国邮政储蓄银行',
+        value: "04030000",
+      },
+      {
+        text: '农村商业银行',
+        value: "03140000",
+      },
+      {
         text: '其他,请咨询售后人员',
         value: "",
       },