ltx529596 4 роки тому
батько
коміт
3718904551
3 змінених файлів з 209 додано та 27 видалено
  1. 0 3
      src/pages/index/index.vue
  2. 1 1
      src/pages/shop/shop.vue
  3. 208 23
      src/pages/shop/shopdetail.vue

+ 0 - 3
src/pages/index/index.vue

@@ -396,7 +396,6 @@ export default {
       // 允许从相机和相册扫码
       uni.scanCode({
         success: function (res) {
-          console.log(res);
           if (res.result.indexOf('XDY_') !== 0 ) {
             _self.$mHelper.toast('您扫描的不是兑换码!');
             return
@@ -478,7 +477,6 @@ export default {
           shopId: this.shopID,
         })
         .then(async (res) => {
-          console.log(res);
           if (res.code === 200 && res.data) {
             // 销售总额
             this.dataDo(res.data.xsze, this.sellSun);
@@ -531,7 +529,6 @@ export default {
         }
       });
 
-      console.log((todaynum - yesnum));
       itemEle.percent = (((todaynum - yesnum) / yesnum) * 100).toFixed(2);
       if (yesnum === todaynum) {
         itemEle.percent = 0;

+ 1 - 1
src/pages/shop/shop.vue

@@ -278,6 +278,7 @@ export default {
     this.getShopMessage();
   },
   onLoad() {
+
     this.getShopList();
     this.getShopMessage();
   },
@@ -386,7 +387,6 @@ export default {
         delete this.params.upDown;
       }
       await this.$http.get('/goods/list', this.params).then((res) => {
-        console.log(res);
         if (res.data.list.length > 0) {
           this.shoplist = res.data.list;
           if (res.data.nextPage === 0) {

+ 208 - 23
src/pages/shop/shopdetail.vue

@@ -14,6 +14,7 @@
                 @change="changeStore"
                 :value="storeIndex"
                 :range="storeList"
+                :disabled="storeDisable"
                 range-key="name"
               >
                 <view class="uni-input title">{{
@@ -37,6 +38,7 @@
                 @change="changeType"
                 :value="typeIndex"
                 :range="typeList"
+                :disabled="typeDisabled"
                 range-key="name"
                 class="selectlist"
               >
@@ -93,7 +95,7 @@
         </view>
       </view>
       <!-- 西线推荐 -->
-      <view class="xiline detail-list noborder">
+      <view class="xiline detail-list">
         <view class="menu">
           <view class="uni-list-cell">
             <view class="uni-list-cell-db">
@@ -101,6 +103,7 @@
                 @change="changeClassify"
                 :value="lineIndex"
                 :range="lineList"
+                :disabled="lineDidsable"
                 range-key="name"
                 class="selectlist"
               >
@@ -117,14 +120,14 @@
         </view>
       </view>
       <!-- 账号限制 -->
-      <view class="idastrict detail-list noborder">
+      <view class="idastrict detail-list">
         <view class="menu">
           <view class="title astricttitle">账号限制</view>
           <switch :checked="showoperat" @change="Change" />
         </view>
       </view>
       <!-- 账号限制 -->
-      <view class="detail-list noborder operat" v-if="showoperat">
+      <view class="detail-list operat" v-if="showoperat">
         <view class="menu">
           <view class="title">同一账号在</view>
           <view class="sub" @tap="subtractUser">-</view>
@@ -136,11 +139,88 @@
           ><view class="add" @tap="addDate">+</view><text class="unit">张</text>
         </view>
       </view>
+      <!-- 卖价 -->
+      <view class="price-warp" v-if="typeProperty === '0'">
+        <view class="name">卖价:</view>
+        <input
+          class="price"
+          type="text"
+          v-model="price"
+          placeholder="请输入卖价"
+        />
+      </view>
+      <!-- 打折价 -->
+      <view class="price-warp" v-if="typeProperty === '0'">
+        <view class="name">划线价:</view>
+        <input
+          class="price"
+          type="text"
+          v-model="rateprice"
+          placeholder="请输入划线价"
+        />
+      </view>
+      <!-- 销售属性 -->
+      <view class="property" v-if="typeProperty === 1">
+        <view class="property-warp">
+          <view class="title">销售属性</view>
+
+          <view class="date">
+            <view class="namebar">过期日期:</view>
+            <view class="num">2020-07</view>
+          </view>
+
+          <view class="pattern">
+            <view class="uni-list">
+              <radio-group @change="radioChange">
+                <label
+                  class="uni-list-cell uni-list-cell-pd pattern-item"
+                  v-for="(item, index) in items"
+                  :key="item.value"
+                >
+                  <view class="checkth">
+                    <radio :value="item.value" :checked="index === current" />
+                  </view>
+                  <view class="txt">
+                    <text class="txt1"> {{ item.name }}</text>
+                    <text> {{ item.know }}</text>
+                  </view>
+                </label>
+              </radio-group>
+            </view>
+          </view>
+        </view>
+      </view>
+      <!-- 商品库存 -->
+      <view class="property" v-if="typeProperty === 1">
+        <view class="property-warp">
+          <view class="title">商品库存</view>
+          <view class="pattern">
+            <view class="uni-list">
+              <radio-group @change="radioChange">
+                <label
+                  class="uni-list-cell uni-list-cell-pd pattern-item"
+                  v-for="(item, index) in items"
+                  :key="item.value"
+                >
+                  <view class="checkth">
+                    <radio :value="item.value" :checked="index === current" />
+                  </view>
+                  <view class="txt">
+                    <text class="txt1"> {{ item.name }}</text>
+                    <text> {{ item.know }}</text>
+                  </view>
+                </label>
+              </radio-group>
+            </view>
+          </view>
+        </view>
+      </view>
       <!-- 商品图标 -->
       <view class="shopicon">商品图标</view>
       <view class="iconcontent">
         <image class="shopLogo" :src="iconurl" v-if="iconurl"></image>
         <text class="icon" @tap="uploadImg">点击上传</text>
+        <text class="per">{{ progress }}%</text>
       </view>
       <view class="shopicon">商品图册</view>
       <view class="uploading">
@@ -202,13 +282,17 @@ export default {
 
       placeholder: '请输入内容...',
       mastKnow: '',
-      storeList: [{ name: '所属店铺', id: '' }],
+
+      storeList: [{ name: '所属店铺', id: '', type: '' }],
       storeIndex: 0,
       storeId: '',
+      storeDisable: true,
+      typeProperty: 1, // 判断所属店铺是否是自营店铺  1分销  0自营
 
       typeList: [{ name: '商品类型(请先选择所属店铺)', id: '' }],
       typeIndex: 0,
       typeId: '',
+      typeDisabled: true,
 
       shopList: [{ name: '商品名称(请先选择商品类型)', id: '' }],
       shopIndex: 0,
@@ -220,31 +304,50 @@ export default {
       lineList: [{ name: '分类(请先选择所属商品)', id: '' }],
       lineIndex: 0,
       lineId: '',
+      lineDidsable: true,
 
       // 图标上传
+      progress: 0,
       iconurl: '',
       pickList: [],
       Icon: '',
       Imglist: [],
 
+      price: 0.0,
+      rateprice: 0.0,
+
       // -------------- 编辑分界线 ------------------------------------
 
       SHOPID: 0,
       shopData: {},
+
+      items: [
+        {
+          value: 'USA',
+          name: '有效期模式',
+          know: '无需用户指定使用日,在过期时间前均可使用。'
+        },
+        {
+          value: 'CHN',
+          name: '使用旧模式',
+          know: '用户购买时需选择游玩日,并在游玩日当天使用。',
+          checked: 'true',
+        },
+      ],
+
+      current: 0,
     };
   },
   onUnload() {
     uni.removeStorageSync('Id');
   },
   onLoad() {
-    // 初始化阿里云
     myCloud = uniCloud.init({
       provider: 'aliyun',
       spaceId: 'db8671a1-69bd-470d-ad59-ba927c88f4a4',
       clientSecret: '8nOzV70edtpCd0El6qce3g==',
     });
 
-
     this.getShopList();
 
     // ---------------------------------------------------
@@ -254,6 +357,15 @@ export default {
     }
   },
   methods: {
+    // 单选
+    radioChange: function (evt) {
+      for (let i = 0; i < this.items.length; i++) {
+        if (this.items[i].value === evt.target.value) {
+          this.current = i;
+          break;
+        }
+      }
+    },
     // 获取单个商品信息
     async getShopBuyId() {
       if (!this.SHOPID) return;
@@ -261,10 +373,9 @@ export default {
         .get('/goods/getById/' + this.SHOPID)
         .then(async (res) => {
           if (res.code === 200 && res.msg === 'OK') {
-            console.log(res);
             this.shopData = res.data;
 
-            this.getShopList()
+            this.getShopList();
 
             // 限制购票回显
             if (this.shopData.saleRule === '1') {
@@ -280,7 +391,7 @@ export default {
             if (this.shopData.icon) {
               this.iconurl = this.shopData.icon;
             } else {
-              this.iconurl = ''
+              this.iconurl = '';
             }
           }
         });
@@ -315,6 +426,7 @@ export default {
     changeStore(e) {
       this.storeIndex = e.detail.value;
       this.storeId = this.storeList[this.storeIndex].id;
+      this.typeProperty = this.storeList[this.storeIndex].type;
       // 未选择商铺不能进行商铺类型选择
       if (this.storeId != '') {
         this.getType();
@@ -341,19 +453,25 @@ export default {
     },
     // 所属店铺
     async getShopList() {
-      this.storeList = [{ name: '所属店铺', id: '' }];
+      this.storeList = [{ name: '所属店铺', id: '', type: '' }];
       await this.$http
         .get('/shop/getList', {
           mid: this.scenicId,
         })
         .then(async (res) => {
           if (res.data) {
+            console.log(res);
             let arr = [];
             res.data.forEach((element) => {
-              arr.push({ name: element.name, id: element.id });
+              arr.push({
+                name: element.name,
+                id: element.id,
+                type: element.shopFrom,
+              });
             });
             this.storeList = this.storeList.concat(arr);
-             // 所属店铺回显
+            this.storeDisable = false;
+            // 所属店铺回显
             if (this.shopData.shopId) {
               this.storeList.forEach((item, index) => {
                 if (this.shopData.shopId === item.id) {
@@ -381,6 +499,7 @@ export default {
             arr.push({ name: element.name, id: element.id });
           });
           this.typeList = this.typeList.concat(arr);
+          this.typeDisabled = false;
 
           // 商品类型回显
           if (this.shopData.typeId) {
@@ -423,6 +542,7 @@ export default {
             arr.push({ name: element.name, id: element.id });
           });
           this.lineList = this.lineList.concat(arr);
+          this.lineDidsable = false;
 
           // 可选择商品名称回显
           if (this.shopData.name) {
@@ -487,19 +607,18 @@ export default {
           myCloud.uploadFile({
             url: 'http://192.168.100.135:83/merch/common/upload/oss',
             filePath: _self.iconurl, // 要上传的文件对象
-            cloudPath: _self.iconurl,
+            cloudPath: _self.iconurl, // 要上传的文件对象
             name: 'file',
-            onUploadProgress: function (progressEvent) {
-              // 上传进度回调
-              let percentCompleted = Math.round(
-                (progressEvent.loaded * 100) / progressEvent.total
-              );
-            },
             success: (res) => {
               if (res.fileID) {
                 _self.Icon = res.fileID;
               }
             },
+            onUploadProgress: function (progressEvent) {
+              _self.progress = Math.round(
+                (progressEvent.loaded * 100) / progressEvent.total
+              );
+            },
           });
         },
       });
@@ -589,8 +708,6 @@ export default {
         return;
       }
 
-      console.log(this.shopData.del);
-      console.log(this.shopData.upDown);
       this.$http
         .post('/goods/add', {
           id: this.shopData.id || '',
@@ -603,8 +720,8 @@ export default {
           saleRuleJson: JSON.stringify(astrictDate),
           describ: this.mastKnow,
           icon: this.Icon || '',
-          del: this.shopData.del  || '',
-          upDown: this.shopData.upDown || ''
+          del: this.shopData.del || '',
+          upDown: this.shopData.upDown || '',
         })
         .then((res) => {
           if (res.code === 200 && res.msg === 'OK') {
@@ -751,6 +868,10 @@ export default {
         height: 56upx;
         border-radius: 50%;
       }
+      .per {
+        margin-left: 50upx;
+        color: #a3a8a8;
+      }
     }
     .uploading {
       padding: 25upx 33upx;
@@ -811,6 +932,70 @@ export default {
       margin-top: 27upx;
       letter-spacing: 2upx;
     }
+    .price-warp {
+      padding: 0 33upx;
+      background-color: #ffffff;
+      border-bottom: 1px solid #e7e7e7;
+      box-sizing: border-box;
+      display: flex;
+      align-items: center;
+      height: 93upx;
+      .name {
+        font-size: 32upx;
+        color: #a3a8a8;
+      }
+      .price {
+        flex: 1;
+      }
+    }
+    .property {
+      .property-warp {
+        .title {
+          padding: 20upx 33upx;
+          font-size: 34rpx;
+          color: #232828;
+          font-weight: 700;
+        }
+        .date {
+          padding: 0 33upx;
+          display: flex;
+          align-items: center;
+          border-bottom: 1px solid #e7e7e7;
+          background-color: #fff;
+          height: 93upx;
+          .namebar {
+            font-size: 30upx;
+            line-height: 93upx;
+            color: #a3a8a8;
+          }
+          .num {
+            flex: 1;
+            height: 100%;
+            line-height: 93upx;
+          }
+        }
+      }
+    }
+    .pattern {
+      .pattern-item {
+        display: flex;
+        border-bottom: 1px solid #e7e7e7;
+       
+        .checkth {
+          width: 100upx;
+        }
+        .txt {
+          flex: 1;
+          display: flex;
+          justify-content: center;
+          flex-direction: column;
+          color: #a3a8a8;
+          .txt1 {
+            color: #232828;
+          }
+        }
+      }
+    }
   }
 }
 </style>