瀏覽代碼

自营商品添加账号限制规则,判断价格正确性

ltx529596 4 年之前
父節點
當前提交
1f081aadae
共有 1 個文件被更改,包括 9 次插入7 次删除
  1. 9 7
      src/pages/shop/shopdetail.vue

+ 9 - 7
src/pages/shop/shopdetail.vue

@@ -121,7 +121,8 @@
         </view>
       </view>
       <!-- 账号限制 -->
-      <view class="warp" v-if="typeProperty === '1'">
+      <!-- <view class="warp" v-if="typeProperty === '1'"> -->
+      <view class="warp">
         <view class="idastrict detail-list">
           <view class="menu">
             <view class="title astricttitle">账号限制</view>
@@ -973,7 +974,7 @@ export default {
         this.$mHelper.toast('请选择所属商铺!');
         return;
       }
-      if (!this.typeId) {
+      if (!this.typeId) {                                                               
         this.$mHelper.toast('请选择商品类型!');
         return;
       }
@@ -982,17 +983,18 @@ export default {
         return;
       }
       if (this.typeProperty === 0) {
+
         if (!this.lineId) {
           this.$mHelper.toast('请选择商品分类!');
           return;
         }
-
-        if (!this.price) {
-          this.$mHelper.toast('请输入商品卖价!');
+        const pat = new RegExp(/(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0){1}$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/)
+        if (!this.price || !pat.test(this.price)) {
+          this.$mHelper.toast('请输入正确的商品卖价!');
           return;
         }
-        if (!this.rateprice) {
-          this.$mHelper.toast('请输入商品划线价!');
+        if (!this.rateprice || !pat.test(this.rateprice)) {
+          this.$mHelper.toast('请输入正确的商品划线价!');
           return;
         }
         if (this.expirationDate === '请选择商品过期日期') {