Browse Source

TB上bug更改

ltx529596 4 years ago
parent
commit
502d4fdefd

+ 43 - 28
src/pages/index/index.vue

@@ -80,8 +80,8 @@
 								</view>
 								<view class="ratio">
 									<view class="detail">
-										<image src="../../static/images/down.png" class="icon" v-if="sellSun.num < 0">
-										<image src="../../static/images/up.png" class="icon" v-if="sellSun.num>0"> {{ sellSun.percent }}% <text class="compare">{{ sellSun.status ? '无增长' :'同比上月' }}</text>
+										<image src="../../static/images/down.png" class="icon" v-if="sellSun.yesnum >= sellSun.todaynum">
+										<image src="../../static/images/up.png" class="icon" v-if="sellSun.yesnum < sellSun.todaynum"> {{ sellSun.percent }}% <text class="compare">{{ sellSun.status ? '无增长' :'同比上月' }}</text>
 									</view>
 								</view>
 							</view>
@@ -95,12 +95,12 @@
 									订单总量
 								</view>
 								<view class="num">
-									{{orderSun.num}}
+									{{orderSun.num *100}}
 								</view>
 								<view class="ratio">
 									<view class="detail">
-										<image src="../../static/images/down.png" class="icon" v-if="orderSun.num < 0">
-										<image src="../../static/images/up.png" class="icon" v-if="orderSun.num>0"> {{ orderSun.percent }}% <text class="compare">{{ orderSun.status ? '无增长' :'同比上月' }}</text>
+										<image src="../../static/images/down.png" class="icon" v-if="orderSun.yesnum >=orderSun.todaynum">
+										<image src="../../static/images/up.png" class="icon" v-if="orderSun.yesnum < orderSun.todaynum"> {{ orderSun.percent }}% <text class="compare">{{ orderSun.status ? '无增长' :'同比上月' }}</text>
 									</view>
 								</view>
 							</view>
@@ -118,8 +118,8 @@
 								</view>
 								<view class="ratio">
 									<view class="detail">
-										<image src="../../static/images/down.png" class="icon" v-if="todaysellSun.num < 0">
-										<image src="../../static/images/up.png" class="icon" v-if="todaysellSun.num>0"> {{ todaysellSun.percent }}% <text class="compare">{{ todaysellSun.status ? '无增长' :'同比上月' }}</text>
+										<image src="../../static/images/down.png" class="icon" v-if="todaysellSun.yesnum >= todaysellSun.todaynum">
+										<image src="../../static/images/up.png" class="icon" v-if="todaysellSun.yesnum < todaysellSun.todaynum"> {{ todaysellSun.percent }}% <text class="compare">{{ todaysellSun.status ? '无增长' :'同比上月' }}</text>
 									</view>
 								</view>
 							</view>
@@ -133,12 +133,12 @@
 									今日订单量
 								</view>
 								<view class="num">
-									{{todayorderSun.num}}
+									{{todayorderSun.num*100}}
 								</view>
 								<view class="ratio">
 									<view class="detail">
-                    <image src="../../static/images/down.png" class="icon" v-if="todayorderSun.num < 0">
-										<image src="../../static/images/up.png" class="icon" v-if="todayorderSun.num>0"> {{ todayorderSun.percent }}% <text class="compare">{{ todayorderSun.status ? '无增长' :'同比上月' }}</text>
+                    <image src="../../static/images/down.png" class="icon" v-if="todayorderSun.yesnum >=todayorderSun.todaynum">
+										<image src="../../static/images/up.png" class="icon" v-if="todayorderSun.yesnum < todayorderSun.todaynum"> {{ todayorderSun.percent }}% <text class="compare">{{ todayorderSun.status ? '无增长' :'同比上月' }}</text>
 									</view>
 								</view>
 							</view>
@@ -287,6 +287,7 @@ let canvaLineA = null;
 let canvaPie = null;
 let shopSellLine = null;
 let shopMoneyLine = null;
+let getDataBuyTime = null;
 export default {
   name: 'Header',
   components: {
@@ -339,21 +340,29 @@ export default {
         num: 0,
         percent: 0,
         status: null,
+        yesnum: 0,
+        todaynum: 0,
       },
       todaysellSun: {
         num: 0,
         percent: 0,
         status: null,
+        yesnum: 0,
+        todaynum: 0,
       },
       orderSun: {
         num: 0,
         percent: 0,
         status: null,
+        yesnum: 0,
+        todaynum: 0,
       },
       todayorderSun: {
         num: 0,
         percent: 0,
         status: null,
+        yesnum: 0,
+        todaynum: 0,
       },
 
       // 待处理事物
@@ -378,7 +387,7 @@ export default {
       value: null,
     },
   },
-  onShow () {
+  onShow() {
     _self = this;
     this.cWidth = uni.upx2px(690); // upx2px 转换为px
     this.cHeight = uni.upx2px(300);
@@ -387,19 +396,19 @@ export default {
 
     this.getShopList();
     this.loading = false;
-  },
-  // 页面生命周期 监听页面加载
-  // onLoad() {
-  //   _self = this;
-  //   this.cWidth = uni.upx2px(690); // upx2px 转换为px
-  //   this.cHeight = uni.upx2px(300);
-  //   this.bWidth = uni.upx2px(690);
-  //   this.bHeight = uni.upx2px(300);
-
-  //   this.getShopList();
-  //   this.loading = false;
-  // },
 
+    getDataBuyTime = setInterval(() => {
+      this.loading = false;
+      this.getShopList();
+      this.$mHelper.toast(`自动更新数据${moment().format('h:mm:ss')}`);
+    }, 1000 * 60 * 5);
+  },
+  onLoad() {
+   
+  },
+  onHide() {
+    clearInterval(getDataBuyTime);
+  },
   methods: {
     // 监听遮罩层行为
     isSureConver(e) {
@@ -411,9 +420,9 @@ export default {
       // 允许从相机和相册扫码
       uni.scanCode({
         success: function (res) {
-          if (res.result.indexOf('XDY_') !== 0 ) {
+          if (res.result.indexOf('XDY_') !== 0) {
             _self.$mHelper.toast('您扫描的不是兑换码!');
-            return
+            return;
           }
           _self.ordernum = res.result;
           _self.searchOrder();
@@ -492,6 +501,7 @@ export default {
           shopId: this.shopID,
         })
         .then(async (res) => {
+          console.log(res);
           if (res.code === 200 && res.data) {
             // 销售总额
             this.dataDo(res.data.xsze, this.sellSun);
@@ -514,8 +524,10 @@ export default {
           itemEle.num = (element.num / 100).toFixed(2);
         } else if (element.time === 'dy') {
           todaynum = element.num;
+          itemEle.todaynum = element.num;
         } else if (element.time === 'sy') {
           yesnum = element.num;
+          itemEle.yesnum = element.num;
         }
       });
       if (yesnum === 0) {
@@ -531,7 +543,6 @@ export default {
       }
       return itemEle;
     },
-
     dataDODO(data, itemEle) {
       let todaynum = 0;
       let yesnum = 0;
@@ -539,12 +550,16 @@ export default {
         if (element.time === 'jr') {
           itemEle.num = (element.num / 100).toFixed(2);
           todaynum = element.num;
+          itemEle.todaynum = element.num;
         } else if (element.time === 'zr') {
           yesnum = element.num;
+          itemEle.yesnum = element.num;
         }
       });
 
-      itemEle.percent = (((todaynum - yesnum) / yesnum) * 100).toFixed(2);
+      let per = (((todaynum - yesnum) / yesnum) * 100).toFixed(2);
+
+      itemEle.percent = per.split('-')[1];
       if (yesnum === todaynum) {
         itemEle.percent = 0;
         itemEle.status = true;
@@ -553,7 +568,7 @@ export default {
       }
 
       if (yesnum === 0) {
-        itemEle.percent = 100
+        itemEle.percent = 100;
       }
       return itemEle;
     },

+ 1 - 0
src/pages/index/setting/editnotice.vue

@@ -205,6 +205,7 @@ export default {
 
     // 图标上传
     upload() {
+      this.noticeMessage.icon = ''
       let _self = this;
       uni.chooseImage({
         count: 1,

+ 29 - 44
src/pages/index/setting/notice.vue

@@ -21,31 +21,23 @@
           </view>
         </view>
         <view class="notice-btns">
-          <view class="up btn">置顶</view>
+          <!-- <view class="up btn">置顶</view> -->
           <view class="edit btn" @tap="topage(item.id)">编辑</view>
           <view class="delete btn" @tap="deleteNotice(item.id)">删除</view>
         </view>
       </view>
     </view>
     <uni-load-more :status="more"> </uni-load-more>
-    <mask
-      :txt="masktxt"
-      :iconShow="iconShow"
-      v-if="isShowMask"
-      @isSureConver="isSureConver"
-    ></mask>
   </view>
 </template>
 
 <script>
 import Header from '../../components/header';
-import mask from '../../components/mask';
 
 export default {
   name: 'notice',
   components: {
     Header,
-    mask,
   },
   data() {
     //这里存放数据
@@ -53,10 +45,6 @@ export default {
       title: '公告管理',
       more: 'loading',
 
-      isShowMask: false,
-      iconShow: false,
-      masktxt: '',
-
       params: {
         mid: 53,
         pageNo: 1,
@@ -64,25 +52,23 @@ export default {
         type: '2',
       },
       noticeList: [],
-      newId: ''
     };
   },
   // 下拉刷新
   onPullDownRefresh() {
+    this.more = 'loading'
     this.params.pageNo = 1;
     this.getNoticeList();
   },
   // 上拉加载
   onReachBottom() {
     if (this.more != 'noMore') {
+      this.params.pageNo ++
       this.getNoticeListMoare();
     }
+    console.log(this.more);
   },
-  onShow () {
-    this.getShopMessage();
-    this.getNoticeList();
-  },
-  onLoad() {
+  onShow() {
     this.getShopMessage();
     this.getNoticeList();
   },
@@ -90,7 +76,7 @@ export default {
   methods: {
     // 编辑
     topage(id) {
-      this.$mRouter.push({route: '/pages/index/setting/editnotice?id='+id});
+      this.$mRouter.push({ route: '/pages/index/setting/editnotice?id=' + id });
     },
     // 商家信息
     async getShopMessage() {
@@ -102,24 +88,27 @@ export default {
     },
     // 公告列表
     async getNoticeList() {
+      console.log(this.more);
       await this.$http.post('/news/list', this.params).then(async (res) => {
         if (res.data.list.length > 0) {
+          console.log(res);
           this.noticeList = res.data.list;
           if (res.data.nextPage === 0) {
             this.more = 'noMore';
           }
         } else {
-          this.mor = 'noMore';
+          this.more = 'noMore';
         }
         uni.stopPullDownRefresh();
       });
     },
     // 加载更多
     async getNoticeListMoare() {
-      this.params.pageNo++;
       let arr = [];
       await this.$http.post('/news/list', this.params).then(async (res) => {
         if (res.data.list.length > 0) {
+          console.log('more');
+          console.log(res);
           arr = res.data.list;
           this.noticeList = this.noticeList.concat(arr);
           if (res.data.nextPage === 0) {
@@ -131,31 +120,27 @@ export default {
         }
       });
     },
-    // 新增列表
-    add() {
-      console.log(1);
-    },
     // 删除
     deleteNotice(id) {
-      this.newId = id
-      this.isShowMask = true;
-      this.masktxt = '是否删除该公告?';
-    },
-    // 监听遮罩层
-    isSureConver(e) {
-      if (e) {
-        this.$http.delete('/news/del/' + this.newId).then(async (res) => {
-          if (res.code === 200 && res.msg === 'OK') {
-            this.$mHelper.toast('删除成功');
-            this.params.pageNo = 1
-            this.getNoticeList()
+      let _self = this;
+      uni.showModal({
+        content: '是否删除该条公告?',
+        success: (confirmRes) => {
+          if (confirmRes.confirm) {
+            _self.more = 'loading'
+            _self.$http.delete('/news/del/' + id).then(async (res) => {
+              if (res.code === 200 && res.msg === 'OK') {
+                _self.$mHelper.toast('删除成功');
+                _self.params.pageNo = 1;
+                _self.getNoticeList();
+              }
+            });
+          } else {
+            _self.$mHelper.toast('取消删除');
           }
-        });
-      } else {
-        this.$mHelper.toast('取消删除');
-      }
-      this.isShowMask = false
-    },
+        },
+      });
+    }
   },
 };
 </script>

+ 5 - 4
src/pages/order/order.vue

@@ -219,7 +219,7 @@ export default {
         ordersNo: '',
         buyPhone: '',
         shopId: '',
-        overTimeArray: [],
+        overTimeArray: [moment().format('YYYY-MM-DD'),moment().format('YYYY-MM-DD')],
       },
     };
   },
@@ -228,9 +228,10 @@ export default {
   onPullDownRefresh() {
     this.startdate = '';
     this.enddate = '';
-    this.sunday = 0;
+    this.sunday = 1;
     this.dateArr = [];
     this.params.pageNum = 1;
+    this.params.overTimeArray = [moment().format('YYYY-MM-DD'),moment().format('YYYY-MM-DD')];
     this.orderbynumber = '';
     this.getOrderList();
   },
@@ -255,14 +256,14 @@ export default {
     },
     // 确认时间后
     confirm(e) {
+      console.log(e);
       this.more = 'loading';
-      // this.loading = true;
 
       this.startdate = e.range.before;
       this.enddate = e.range.after;
       this.sunday = e.range.data.length;
 
-      this.params.overTimeArray.push(this.startdate, this.enddate);
+      this.params.overTimeArray = [this.startdate, this.enddate];
 
       this.getOrderList();
     },

+ 20 - 36
src/pages/shop/classify.vue

@@ -30,22 +30,15 @@
         </view>
       </view>
     </view>
-    <mask
-      :txt="masktxt"
-      :iconShow="iconShow"
-      v-if="isShowMask"
-      @isSureConver="isSureConver"
-    ></mask>
     <rf-loading v-if="loading"></rf-loading>
   </view>
 </template>
 
 <script>
 import Header from '../components/header';
-import mask from '../components/mask';
 export default {
   name: 'classify',
-  components: { Header, mask },
+  components: { Header },
   data() {
     //这里存放数据
     return {
@@ -53,22 +46,13 @@ export default {
       title: '管理自定义分类',
       storeId: uni.getStorageSync('shopid'),
       lineList: [],
-      gradeList: [],
-
-      masktxt: '',
-      iconShow: false,
-      isShowMask: false,
-
-      classId: ''
+      gradeList: []
     };
   },
 
   onShow() {
     this.getCustomList();
   },
-  onLoad() {
-    this.getCustomList();
-  },
   //方法集合
   methods: {
     compile(data) {
@@ -92,24 +76,24 @@ export default {
 
     // 删除
     delet(id) {
-      this.classId = id
-      this.isShowMask = true;
-      this.masktxt = '是否删除该分类?';
-    },
-    isSureConver(e) {
-      if (e) {
-        this.$http
-          .post('/goods/delCustomGroup?customGroupId='+this.classId)
-          .then((res) => {
-            if (res.code === 200 && res.msg === 'OK') {
-              this.$mHelper.toast('删除成功')
-              this.getCustomList()
-            }
-          });
-      } else {
-        this.$mHelper.toast('已取消删除')
-      }
-      this.isShowMask = false;
+      let _self = this;
+      uni.showModal({
+        content: '是否删除该分类?',
+        success: (confirmRes) => {
+          if (confirmRes.confirm) {
+            _self.$http
+              .post('/goods/delCustomGroup?customGroupId=' + id)
+              .then((res) => {
+                if (res.code === 200 && res.msg === 'OK') {
+                  _self.$mHelper.toast('删除成功');
+                  _self.getCustomList();
+                }
+              });
+          } else {
+            _self.$mHelper.toast('已取消删除');
+          }
+        },
+      });
     },
   },
 };

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

@@ -266,10 +266,6 @@ export default {
     this.getShopList();
     this.getShopMessage();
   },
-  onLoad() {
-    this.getShopList();
-    this.getShopMessage();
-  },
   //方法集合
   methods: {
     // 跳转详情
@@ -360,7 +356,10 @@ export default {
     sticktop(id) {
       this.$http.PUT('/goods/changeSort?id=' + id + '&sort=-1').then((res) => {
         if (res.code === 200) {
-          this.getTicketShopList();
+          setTimeout(() => {
+            this.$mHelper.toast('已将该商品置顶发布')
+            this.getTicketShopList();
+          }, 1000);
         }
       });
     },
@@ -376,6 +375,7 @@ 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) {

+ 30 - 29
src/pages/shop/shopdetail.vue

@@ -409,7 +409,7 @@ export default {
       SHOPID: 0,
       shopData: {},
 
-      expirationDate: '商品过期日期',
+      expirationDate: '请选择过期日期',
       // 销售属性
       patterList: [
         {
@@ -471,13 +471,7 @@ export default {
   onUnload() {
     uni.removeStorageSync('Id');
   },
-  onLoad() {
-    myCloud = uniCloud.init({
-      provider: 'aliyun',
-      spaceId: 'db8671a1-69bd-470d-ad59-ba927c88f4a4',
-      clientSecret: '8nOzV70edtpCd0El6qce3g==',
-    });
-
+  onShow() {
     this.getShopList();
 
     // ---------------------------------------------------
@@ -486,6 +480,13 @@ export default {
       this.getShopBuyId();
     }
   },
+  onLoad() {
+    myCloud = uniCloud.init({
+      provider: 'aliyun',
+      spaceId: 'db8671a1-69bd-470d-ad59-ba927c88f4a4',
+      clientSecret: '8nOzV70edtpCd0El6qce3g==',
+    });
+  },
   methods: {
     // 打开日历
     openTime() {
@@ -514,10 +515,10 @@ export default {
       }
 
       if (e.detail.value === '1') {
-        this.sunInventory = 0
+        this.sunInventory = 0;
       }
       if (e.detail.value === '2') {
-        this.dateInventory = 0
+        this.dateInventory = 0;
       }
       this.astrictDate.data.goodsStockFlag = e.detail.value;
     },
@@ -562,8 +563,8 @@ export default {
             setTimeout(() => {
               // 判断返回的是否是自营商品
               this.typeProperty = this.shopData.saleRule;
-              this.price = this.shopData.salePrice;
-              this.rateprice = this.shopData.price;
+              this.price = this.shopData.salePrice / 100;
+              this.rateprice = this.shopData.price / 100;
 
               if (this.shopData.expiredTime) {
                 this.expirationDate = this.shopData.expiredTime.slice(0, 10)
@@ -787,6 +788,7 @@ export default {
                 this.shopIndex = index;
               } else {
                 this.shopIndex = 0;
+                this.shopList[0].name = this.shopData.name
               }
             });
             this.shopId = this.shopList[this.shopIndex].id;
@@ -948,34 +950,33 @@ export default {
           return;
         }
         if (!this.expirationDate) {
-          this.$mHelper.toast('请选择商品过期日期')
-          return
+          this.$mHelper.toast('请选择商品过期日期');
+          return;
         }
-      
-       console.log(this.shopNumIndex);
+
+        console.log(this.shopNumIndex);
         if (this.shopIndex === 0) {
-         this.inventory = ''
+          this.inventory = '';
         }
         if (this.shopNumIndex === 1) {
-          this.inventory = this.dateInventory 
+          this.inventory = this.dateInventory;
           if (!this.inventory) {
-            this.$mHelper.toast('请输入日库存数量!')
-            return
+            this.$mHelper.toast('请输入日库存数量!');
+            return;
           }
-        } 
-         if (this.shopNumIndex === 2) {
-          this.inventory = this.sunInventory 
+        }
+        if (this.shopNumIndex === 2) {
+          this.inventory = this.sunInventory;
           if (!this.inventory) {
-            this.$mHelper.toast('请输入总库存数量!')
-            return
+            this.$mHelper.toast('请输入总库存数量!');
+            return;
           }
         }
-       
+
         if (!this.astrictDate.data.bookRule) {
           this.$mHelper.toast('请输入预订数量!');
           return;
         }
-       
       }
       this.loading = true;
       this.$http
@@ -993,8 +994,8 @@ export default {
           saleRuleJson: JSON.stringify(this.astrictDate),
           //  自营
           name: name,
-          salePrice: this.price*100 || '',
-          price: this.rateprice*100  || '',
+          salePrice: this.price * 100 || '',
+          price: this.rateprice * 100 || '',
           expiredTime:
             this.expirationDate === '商品过期日期' ? '' : this.expirationDate,
           inventory: this.inventory,