Эх сурвалжийг харах

Merge branch 'liuxiangxin' into branch_qxy_dev

# Conflicts:
#	pages/score/orders_detail.vue
钱新宇 2 долоо хоног өмнө
parent
commit
6301f6e02b

+ 30 - 0
pages/index/index.vue

@@ -176,8 +176,12 @@ export default {
       this.isReqing = false;
       // 成功结果
       if (re.code == "success") {
+		// 如果是最后一页
         if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+		// 赋值
         this.productList = re.data.data;
+		// 获取下一页
+		this.getMore(re);
       }
     });
   },
@@ -196,8 +200,12 @@ export default {
       this.isReqing = false;
       // 成功结果
       if (re.code == "success") {
+		// 如果是最后一页
         if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+		// 赋值
         this.productList = re.data.data;
+		// 获取下一页
+		this.getMore(re);
       }
     });
     uni.stopPullDownRefresh();
@@ -227,6 +235,28 @@ export default {
     });
   },
   methods: {
+	// 请求加载下一页
+	getMore(callback){
+		// 首页不足10个,并且下一页存在大于当前页
+		if( this.productList.length < 10 && callback.data.last_page > this.requestParam.page ){
+			// 最后一页不再请求
+			if (this.isLast) return;
+			// 增加一页
+			this.requestParam.page = this.requestParam.page + 1;
+			// 请求列表
+			this.$http.request("api/product/get_list", this.requestParam).then((re) => {
+			  // 成功结果
+			  if (re.code == "success") {
+			    // 最后一页
+			    if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+			    // 追加数据
+			    this.productList.push(...re.data.data);
+				// 获取下一页
+				this.getMore(re);
+			  }
+			});
+		}
+	},
     searchChange(e) {
       // 如果没有搜索词
       if (!this.requestParam.name) {

+ 11 - 2
pages/orders/lottery.vue

@@ -110,6 +110,7 @@ export default {
         id: 0,
       },
       checkedAddr: {},
+	  isReqing:false,
     };
   },
   onLoad(param) {
@@ -196,6 +197,8 @@ export default {
       });
     },
     onClick() {
+	  // 没有数据的话,或者请求中,不允许刷新
+	  if (this.isReqing) return;
       // 活动是否开始
       if (!this.lotteryInfo.id) {
         uni.showToast({
@@ -228,8 +231,8 @@ export default {
         });
         return;
       }
-      // 次数操作
-      this.lotteryInfo.join_num = this.lotteryInfo.join_num - 1;
+	  // 设置请求中
+	  this.isReqing = true;
       // 请求列表
       this.$http.request('/api/lottery_order/get_reward', { lottery_id: this.lotteryInfo.id }).then((re) => {
         // 设置非请求中
@@ -238,6 +241,8 @@ export default {
         if (re.code == 'success') {
           // 奖品列表更新
           this.prizeList = re.data.reward_list;
+		  // 次数操作
+		  this.lotteryInfo.join_num = this.lotteryInfo.join_num - 1;
           // 奖品的索引
           return this.$refs.dialer.run(re.data.reward_index);
         } else {
@@ -256,8 +261,12 @@ export default {
       this.$refs.lotteryRule.close();
     },
     showRecord() {
+      // 没有数据的话,或者请求中,不允许刷新
+	  if (this.isReqing) return;
       // 活动是否开始
       if (this.lotteryInfo.id) {
+	    // 设置请求中
+		this.isReqing = true;
         // 请求列表
         this.$http.request('/api/lottery_order_record/get_list', { lottery_id: this.lotteryInfo.id }).then((re) => {
           // 设置非请求中

+ 23 - 11
pages/product/index.vue

@@ -267,7 +267,7 @@
     <uni-popup ref="regiment" type="bottom" class="popup" background-color="#FFFFFF">
       <view class="popup_title">可参与的拼单</view>
       <view class="regiment_popup_list">
-        <view class="regiment_popup_item" v-for="(item, index) in productInfo.regiment_list" @click="checkedCoupon(index, false)" :key="index">
+        <view class="regiment_popup_item" v-for="(item, index) in productInfo.regiment_list" :key="index">
           <view class="username">
             <image class="user_image" :src="item.userpic"></image>
             <text class="username_text">{{ item.username }}</text>
@@ -509,15 +509,27 @@ export default {
       this.priceHandler();
       // 显示下单弹出层
       this.$refs.specPopup.open("bottom");
-      // 结果
-      this.$http.request("api/custom_coupon/get_checked", this.requestParam).then((re) => {
-        if (re.code == "success") {
-          // 赋值
-          this.couponList = re.data;
-          // 优惠券是否可用
-          this.checkCoupon();
-        }
-      });
+	  // 如果非团购的话,查询优惠券
+	  if( type == 3 || type == 4 ){
+		  // 选择优惠券重置
+		  this.couponList = [];
+		  // 已经选择的优惠券ID
+		  this.customCoupon = 0;
+		  // 计算扣减
+		  this.couponRebate();
+		  // 计算价格
+		  this.priceHandler();
+	  }else{
+		  // 结果
+		  this.$http.request("api/custom_coupon/get_checked", this.requestParam).then((re) => {
+		    if (re.code == "success") {
+		      // 赋值
+		      this.couponList = re.data;
+		      // 优惠券是否可用
+		      this.checkCoupon();
+		    }
+		  });
+	  }
       // 地址列表
       this.getAddrList();
       //只有一组sku时是否下架
@@ -672,7 +684,7 @@ export default {
             "api/orders/create_regiment",
             {
               product_list: productList,
-              custom_coupon_id: this.customCoupon,
+              // custom_coupon_id: this.customCoupon,
               addr_id: this.checkedAddr.id,
               btn_type: this.specBtnType,
               regiment_id: this.regiment_id,

+ 21 - 18
pages/score/orders_detail.vue

@@ -48,16 +48,16 @@
         <view>下单时间&nbsp;</view>
         <view>{{ order_datail?.insert_time }}</view>
       </view>
-	  <view class="price_content_item" v-if="order_datail?.track_number">
-	    <view>物流编号&nbsp;</view>
-	    <view style="display: flex; align-items: center">
-	      <view>{{order_datail?.track_number}}</view>
-	      <view class="copy_btn" @click="_copyorderCode(order_datail?.track_number)">&nbsp;复制</view>
-	    </view>
-	  </view>
+      <view class="price_content_item" v-if="order_datail?.track_number">
+        <view>物流编号&nbsp;</view>
+        <view style="display: flex; align-items: center">
+          <view>{{ order_datail?.track_number }}</view>
+          <view class="copy_btn" @click="_copyorderCode(order_datail?.track_number)">&nbsp;复制</view>
+        </view>
+      </view>
       <view class="price_content_item">
         <view>备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注&nbsp;&nbsp;</view>
-        <view style="text-align: right;">{{ order_datail?.remark }}</view>
+        <view class="remark" style="text-align: right">{{ order_datail?.remark }}</view>
       </view>
     </view>
   </view>
@@ -76,16 +76,16 @@ export default {
   methods: {
     _getOrderDetail(orderId) {
       this.$http
-        .request("api/score_orders/get_detail", { id: orderId })
+        .request('api/score_orders/get_detail', { id: orderId })
         .then((response) => {
-          if (response.code == "success") {
+          if (response.code == 'success') {
             this.order_datail = response.data; // 打印订单详情
           }
         })
         .catch((error) => {
           uni.showToast({
-            title: "获取订单详情失败",
-            icon: "error",
+            title: '获取订单详情失败',
+            icon: 'error',
             duration: 2000,
           });
         });
@@ -93,7 +93,7 @@ export default {
     _navToProduct(id) {
       if (id) {
         uni.navigateTo({
-          url: "/pages/score/product?id=" + id,
+          url: '/pages/score/product?id=' + id,
         });
       }
     },
@@ -106,24 +106,24 @@ export default {
           //复制成功的回调函数
           uni.showToast({
             //提示
-            title: "复制成功",
+            title: '复制成功',
           });
         },
       });
       // #endif
 
       // #ifdef H5
-      let textarea = document.createElement("textarea");
+      let textarea = document.createElement('textarea');
       textarea.value = info;
-      textarea.readOnly = "readOnly";
+      textarea.readOnly = 'readOnly';
       document.body.appendChild(textarea);
       textarea.select(); // 选中文本内容
       textarea.setSelectionRange(0, info.length);
       uni.showToast({
         //提示
-        title: "复制成功",
+        title: '复制成功',
       });
-      result = document.execCommand("copy");
+      result = document.execCommand('copy');
       textarea.remove();
       // #endif
     },
@@ -296,6 +296,9 @@ export default {
     .price {
       color: red;
     }
+    .remark {
+      word-break: break-all;
+    }
   }
   .copy_btn {
     border-radius: 20rpx;