浏览代码

bug处理,优化

ltx529596 4 年之前
父节点
当前提交
20abccafc1
共有 5 个文件被更改,包括 67 次插入31 次删除
  1. 2 3
      src/config/index.config.js
  2. 55 28
      src/pages/index/index.vue
  3. 1 0
      src/pages/order/order.vue
  4. 8 0
      src/pages/order/orderdetail.vue
  5. 1 0
      src/pages/shop/shop.vue

+ 2 - 3
src/config/index.config.js

@@ -2,8 +2,8 @@ const CONFIG = {
     //开发环境配置
     development: {
         assetsPath: '/static', // 静态资源路径
-        // baseUrl: 'http://tyou.xiudo.cn/merch',  // 后台接口请求地址
-        baseUrl: 'http://192.168.100.135:83/merch',  // 后台接口请求地址
+        baseUrl: 'http://tyou.xiudo.cn/merch',  // 后台接口请求地址
+        // baseUrl: 'http://192.168.100.135:83/merch',  // 后台接口请求地址
         hostUrl: 'http://localhost:8080',        // H5地址(前端运行地址)
         websocketUrl: '',        // websocket服务端地址
         weixinAppId: '' // 微信公众号appid
@@ -11,7 +11,6 @@ const CONFIG = {
     //生产环境配置
     production: {
         assetsPath: '/static', // 静态资源路径
-        // baseUrl: 'http://tyou.xiudo.cn/merch',  // 后台接口请求地址
         baseUrl: 'https://tyou.xiudo.cn/merch',  // 后台接口请求地址
         hostUrl: 'https://tyou.xiudo.cn',        // H5地址(前端运行地址)
         websocketUrl: '',        // websocket服务端地址

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

@@ -40,7 +40,7 @@
      
       <!-- 输入框 -->
       <view class="input-code" :animation="animationData">
-        <input type="text" v-model="ordernum" maxlength="-1" placeholder-style="color:#b8bbbb;font-size:28upx;" class="code" placeholder="请输入验证码核验">
+        <input type="text" v-model="ordernum" maxlength="-1" placeholder-style="color:#b8bbbb;font-size:28upx;" class="code" placeholder="请输入兑换码或者订单号">
         <view class="search" @tap="searchOrder">搜索</view>
       </view>
 			<view class="index-content">
@@ -353,7 +353,7 @@ export default {
       shopsellimg: '',
       shopmoneyimg: '',
       futureimg: '',
-      shopimg: ''
+      shopimg: '',
     };
   },
   // 此处定义传入的数据
@@ -364,9 +364,7 @@ export default {
     },
   },
   // 监听也面滚动
-  onPageScroll (e) {
-    
-  },
+  onPageScroll(e) {},
   // 页面生命周期 监听页面加载
   onLoad() {
     _self = this;
@@ -390,6 +388,11 @@ export default {
       // 允许从相机和相册扫码
       uni.scanCode({
         success: function (res) {
+          console.log(res);
+          if (res.result.indexOf('XDY_') !== 0 ) {
+            _self.$mHelper.toast('您扫描的不是兑换码!');
+            return
+          }
           _self.ordernum = res.result;
           _self.searchOrder();
         },
@@ -397,9 +400,10 @@ export default {
     },
     // 搜索框根据订单号查询订单
     searchOrder() {
-      this.loading = true
-      if (this.ordernum === '') {
-        this.$mHelper.toast('请输入正确的订单号进行查询,不能为空!');
+      this.loading = true;
+      if (this.ordernum.length === 0) {
+        this.$mHelper.toast('请输入正确的兑换码或者订单号进行兑换,不能为空!');
+        this.loading = false;
         return;
       }
       this.$http
@@ -410,18 +414,18 @@ export default {
             uni.setStorageSync('orderDetail', res.data);
             this.$mRouter.push({ route: '/pages/index/conversion' });
             this.orderMessage = res.data;
-            this.loading = false
+            this.loading = false;
           }
         })
         .catch((error) => {
           this.ordernum = '';
-          this.loading = false
+          this.loading = false;
         });
     },
 
     // 选择商铺
     bindPickerChange(e) {
-      this.loading = true
+      this.loading = true;
       this.shopID = null;
       this.index = e.detail.value;
       this.shopID = this.shopArray[this.index].id;
@@ -431,7 +435,7 @@ export default {
       this.shopSellData();
       this.shopSellTrend();
       this.shopSellMoneyTrend();
-      this.loading = false
+      this.loading = false;
     },
 
     // 跳转设置页
@@ -470,11 +474,11 @@ export default {
             // 销售总额
             this.dataDo(res.data.xsze, this.sellSun);
             // 今日销售总额
-            this.dataDo(res.data.jrxxe, this.todaysellSun);
+            this.dataDODO(res.data.jrxxe, this.todaysellSun);
             // 订单总量
             this.dataDo(res.data.ddzl, this.orderSun);
             // 今日订单总量
-            this.dataDo(res.data.jrdds, this.todayorderSun);
+            this.dataDODO(res.data.jrdds, this.todayorderSun);
           }
         });
     },
@@ -495,16 +499,36 @@ export default {
       if (yesnum === 0) {
         itemEle.percent = 100;
       } else {
-        itemEle.percent = ((todaynum - yesnum) / yesnum).toFixed(2);
+        itemEle.percent = (((todaynum - yesnum) / yesnum) * 100).toFixed(2);
       }
-
       if (yesnum === todaynum) {
         itemEle.percent = 0;
         itemEle.status = true;
       } else {
         itemEle.status = false;
       }
+      return itemEle;
+    },
+
+    dataDODO(data, itemEle) {
+      let todaynum = 0;
+      let yesnum = 0;
+      data.forEach((element) => {
+        if (element.time === 'jr') {
+          itemEle.num = (element.num / 100).toFixed(2);
+          todaynum = element.num;
+        } else if (element.time === 'zr') {
+          yesnum = element.num;
+        }
+      });
 
+      itemEle.percent = (((todaynum - yesnum) / yesnum) * 100).toFixed(2);
+      if (yesnum === todaynum) {
+        itemEle.percent = 0;
+        itemEle.status = true;
+      } else {
+        itemEle.status = false;
+      }
       return itemEle;
     },
 
@@ -531,7 +555,7 @@ export default {
 
     // 商品销售数量走势
     async shopSellTrend() {
-      this.loadingMore1 = true
+      this.loadingMore1 = true;
       if (this.shopID === 0) {
         this.shopI = '';
       }
@@ -633,7 +657,7 @@ export default {
             fileType: 'png',
             canvasId: id,
             success: function (res) {
-              _self.loadingMore1 = false
+              _self.loadingMore1 = false;
               _self.shopsellimg = res.tempFilePath;
             },
             fail: function (res) {},
@@ -652,7 +676,7 @@ export default {
 
     // 商品销售金额走势
     async shopSellMoneyTrend() {
-      this.loadingMore2 = true
+      this.loadingMore2 = true;
       if (this.shopID === 0) {
         this.shopI = '';
       }
@@ -753,7 +777,7 @@ export default {
             fileType: 'png',
             canvasId: id,
             success: function (res) {
-              _self.loadingMore2 = false
+              _self.loadingMore2 = false;
               _self.shopmoneyimg = res.tempFilePath;
             },
             fail: function (res) {},
@@ -772,7 +796,7 @@ export default {
 
     // 未来七天
     async futureDayData() {
-      this.loadingMore3 = true
+      this.loadingMore3 = true;
       if (this.shopID === 0) {
         this.shopID = '';
       }
@@ -859,7 +883,7 @@ export default {
             fileType: 'png',
             canvasId: canvasId,
             success: function (res) {
-              _self.loadingMore3 = false
+              _self.loadingMore3 = false;
               _self.futureimg = res.tempFilePath;
             },
             fail: function (res) {},
@@ -878,7 +902,7 @@ export default {
 
     // 商品销售占比
     async shopSellData() {
-      this.loadingMore4 = true
+      this.loadingMore4 = true;
       await this.$http
         .get('/homePage/getData1', {
           date: this.today,
@@ -942,7 +966,7 @@ export default {
             fileType: 'png',
             canvasId: canvasId,
             success: function (res) {
-              _self.loadingMore4 = false
+              _self.loadingMore4 = false;
               _self.shopimg = res.tempFilePath;
             },
             fail: function (res) {},
@@ -1149,12 +1173,13 @@ canvas {
         flex-wrap: wrap;
 
         .item {
+          position: relative;
           width: 320rpx;
           border-radius: 10rpx;
           color: #ffffff;
-          display: flex;
-          justify-content: space-between;
-          align-items: center;
+          // display: flex;
+          // justify-content: space-between;
+          // align-items: center;
           padding: 25rpx;
           box-sizing: border-box;
           margin-bottom: 32rpx;
@@ -1185,7 +1210,6 @@ canvas {
 
               .detail {
                 display: flex;
-                justify-content: center;
                 align-items: center;
 
                 .icon {
@@ -1203,6 +1227,9 @@ canvas {
           }
 
           .right {
+            position: absolute;
+            right: 32upx;
+            top: 29upx;
             width: 90rpx;
             height: 90rpx;
             border-radius: 50%;

+ 1 - 0
src/pages/order/order.vue

@@ -331,6 +331,7 @@ export default {
             this.more = 'noMore';
           }
         });
+         uni.stopPullDownRefresh();
     },
     // 上拉加载
     async loadMoreList() {

+ 8 - 0
src/pages/order/orderdetail.vue

@@ -30,6 +30,7 @@
 				<view class="realitypirc">实付金额:<text class="money">{{orderMessage.ordersPrice | doMoney}}</text></view>
 			</view>
 		</view>
+		<rf-loading v-if="loading"></rf-loading>
 	</view>
 </template>
 
@@ -41,6 +42,7 @@
 		},
 		data() {
 			return {
+				loading: true,
 				title: '订单详情',
 				orderMessage: {},
 				ordernum: ''
@@ -61,9 +63,15 @@
 			
 			// 详情
 			async getOrderDetail () {
+				this.loading = true
 				await this.$http.get('/orders/getOrdersByNo/'+this.ordernum).then(async (res)=>{
 					console.log(res);
 					if (res.code === 200) {
+						if (res.data.palyTime.indexOf('00:00:00')) {
+							res.data.palyTime.slice(0,10)
+							res.data.palyTime = res.data.palyTime.slice(0,10);
+						}
+						this.loading = false
 						this.orderMessage = res.data
 					}
 				}).catch(error=>{

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

@@ -339,6 +339,7 @@ export default {
           this.getTicketShopList();
         }
       });
+      uni.stopPullDownRefresh()  // 关闭下拉刷新
     },
     // 待审核tab切换
     changeTabByStatus(type, status) {