Commit f442394625f21deffd3feb3feff67a53950a3d81

Authored by WXD-SEASON\season
2 parents 21555f9b 31fea55a

Merge branch 'dev_oa_lou2' into dev

packageE/pages/cart/cart2/cart2.js
@@ -147,7 +147,8 @@ Page({ @@ -147,7 +147,8 @@ Page({
147 appoint_pick_keyid: '', 147 appoint_pick_keyid: '',
148 is_pre_cut:0, //是否可以使用预存 0是不可以1的可以 148 is_pre_cut:0, //是否可以使用预存 0是不可以1的可以
149 149
150 - coll_prom:{} //搭配活动存储 150 + coll_prom:{}, //搭配活动存储
  151 + yh_is_xz_yh:{},//优惠促销优惠券使用开关
151 152
152 }, 153 },
153 onLoad: function (t) { 154 onLoad: function (t) {
@@ -757,12 +758,28 @@ Page({ @@ -757,12 +758,28 @@ Page({
757 item1.is_post_temp=res.data.data.is_post_temp; 758 item1.is_post_temp=res.data.data.is_post_temp;
758 } 759 }
759 }) 760 })
760 - }  
761 - 761 + }
  762 +
762 //要把优惠活动加入,prom_goods_map中,赠品不要运算,代发商品不算优惠 763 //要把优惠活动加入,prom_goods_map中,赠品不要运算,代发商品不算优惠
763 if (item1.prom_type == 3 && item1.is_gift != 1 && !item1.whsle_id) { 764 if (item1.prom_type == 3 && item1.is_gift != 1 && !item1.whsle_id) {
764 - // th.check_is_youhui(item1.goods_id, item1.pick_id);  
765 - await th.add_prom_goods_map(item1); 765 + // th.check_is_youhui(item1.goods_id, item1.pick_id);
  766 + //增加优惠活动次数限制
  767 + let limit_num= await th.getprom(item1) //活动限制次数
  768 +
  769 + if(!limit_num){
  770 + await th.add_prom_goods_map(item1);
  771 + // item1.prom_id=''
  772 + // item1.prom_type=''
  773 + }else{
  774 + let user_pre_buynum = await th.getUserBuyPromNum_pre(item1.prom_id) //用户已经参与次数
  775 + if(user_pre_buynum<limit_num){
  776 + await th.add_prom_goods_map(item1);
  777 + }else{
  778 + // await th.add_prom_goods_map(item1);
  779 + item1.prom_id=''
  780 + item1.prom_type=''
  781 + }
  782 + }
766 } 783 }
767 784
768 //-- 如果组合购的总数量不足的处理 -- 785 //-- 如果组合购的总数量不足的处理 --
@@ -5593,50 +5610,96 @@ Page({ @@ -5593,50 +5610,96 @@ Page({
5593 return !check; 5610 return !check;
5594 }, 5611 },
5595 //立即购买获取优惠活动的内容 5612 //立即购买获取优惠活动的内容
5596 - buy_now_prom_goods: function (prom_id, arr, func) { 5613 + buy_now_prom_goods: async function (prom_id, arr, func) {
5597 var th = this; 5614 var th = this;
5598 var price = arr.shop_price * arr.goods_num; 5615 var price = arr.shop_price * arr.goods_num;
5599 var prom = null; 5616 var prom = null;
5600 var gg = to.get_b_now(); 5617 var gg = to.get_b_now();
5601 - getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + prom_id, {}).then(res => { 5618 + getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + prom_id, {}).then( async res => {
5602 5619
5603 if (res.data.code == 0) { 5620 if (res.data.code == 0) {
5604 prom = res.data.data; 5621 prom = res.data.data;
5605 - let min_value = 0  
5606 - if (prom && prom.is_xz_yh) {  
5607 - let arr = prom.promGoodsList || []  
5608 - arr.map(item => {  
5609 - if (min_value) {  
5610 - min_value = item.condition  
5611 - } else {  
5612 - if (min_value < item.condition) {  
5613 - min_value = item.condition 5622 + if(prom && prom.limit_num*1){
  5623 + let user_pre_buynum=await th.getUserBuyPromNum_pre(prom.id)
  5624 + if (user_pre_buynum>=prom.limit_num) {
  5625 + arr.prom_price=null;
  5626 + arr.prom_id="";
  5627 + arr.prom_type="";
  5628 + if(prom.is_xz_yh){
  5629 + arr.is_xz_yh=prom.is_xz_yh
  5630 + }
  5631 + func(arr);
  5632 + }else{
  5633 + let min_value = 0
  5634 + if (prom && prom.is_xz_yh) {
  5635 + let arr = prom.promGoodsList || []
  5636 + arr.map(item => {
  5637 + if (min_value) {
  5638 + min_value = item.condition
  5639 + } else {
  5640 + if (min_value < item.condition) {
  5641 + min_value = item.condition
  5642 + }
  5643 + }
  5644 + })
  5645 + if (arr.length > 0) {
  5646 + if (arr[0].prom_type == 0) {
  5647 + if (price < min_value) {
  5648 + prom.is_xz_yh = 0
  5649 + }
  5650 + } else {
  5651 + if (arr.goods_num < min_value) {
  5652 + prom.is_xz_yh = 0
  5653 + }
  5654 + }
5614 } 5655 }
5615 } 5656 }
5616 - })  
5617 - if (arr.length > 0) {  
5618 - if (arr[0].prom_type == 0) {  
5619 - if (price < min_value) {  
5620 - prom.is_xz_yh = 0 5657 + return getApp().request.promiseGet("/api/weshop/goods/getDiscount", {
  5658 + data: {
  5659 + price: parseFloat(price).toFixed(2),
  5660 + prom_id: prom_id,
  5661 + goods_num: arr.goods_num,
  5662 + user_id: getApp().globalData.user_id,
  5663 + is_bz: prom.is_bz
5621 } 5664 }
5622 - } else {  
5623 - if (arr.goods_num < min_value) {  
5624 - prom.is_xz_yh = 0 5665 + })
  5666 + }
  5667 + }else{
  5668 + let min_value = 0
  5669 + if (prom && prom.is_xz_yh) {
  5670 + let arr = prom.promGoodsList || []
  5671 + arr.map(item => {
  5672 + if (min_value) {
  5673 + min_value = item.condition
  5674 + } else {
  5675 + if (min_value < item.condition) {
  5676 + min_value = item.condition
  5677 + }
  5678 + }
  5679 + })
  5680 + if (arr.length > 0) {
  5681 + if (arr[0].prom_type == 0) {
  5682 + if (price < min_value) {
  5683 + prom.is_xz_yh = 0
  5684 + }
  5685 + } else {
  5686 + if (arr.goods_num < min_value) {
  5687 + prom.is_xz_yh = 0
  5688 + }
5625 } 5689 }
5626 } 5690 }
5627 } 5691 }
  5692 + //-------------------
  5693 + return getApp().request.promiseGet("/api/weshop/goods/getDiscount", {
  5694 + data: {
  5695 + price: parseFloat(price).toFixed(2),
  5696 + prom_id: prom_id,
  5697 + goods_num: arr.goods_num,
  5698 + user_id: getApp().globalData.user_id,
  5699 + is_bz: prom.is_bz
  5700 + }
  5701 + })
5628 } 5702 }
5629 -  
5630 - //-------------------  
5631 - return getApp().request.promiseGet("/api/weshop/goods/getDiscount", {  
5632 - data: {  
5633 - price: parseFloat(price).toFixed(2),  
5634 - prom_id: prom_id,  
5635 - goods_num: arr.goods_num,  
5636 - user_id: getApp().globalData.user_id,  
5637 - is_bz: prom.is_bz  
5638 - }  
5639 - })  
5640 } else { 5703 } else {
5641 func(arr); 5704 func(arr);
5642 } 5705 }
@@ -5708,6 +5771,38 @@ Page({ @@ -5708,6 +5771,38 @@ Page({
5708 func(arr); 5771 func(arr);
5709 }) 5772 })
5710 }, 5773 },
  5774 + //优惠促销用户参与次数
  5775 + async getUserBuyPromNum_pre(prom_id){
  5776 + var userInfo = getApp().globalData.userInfo;
  5777 + var url = `/api/weshop/ordergoods/getUserBuyPromNum?store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`;
  5778 + let res = await getApp().request.promiseGet(url, {
  5779 + data:{}
  5780 + });
  5781 + let user_pre_buynum=0
  5782 + if(res.data.code==0 && res.data.data){
  5783 + user_pre_buynum=res.data.data.userbuynum
  5784 + }
  5785 + return user_pre_buynum
  5786 + },
  5787 + //获取优惠活动
  5788 + async getprom(item){
  5789 +
  5790 + let prom_id=item.prom_id
  5791 + let pickup_id=item.pick_id
  5792 + let limit_num=0
  5793 + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + oo.stoid + "/" + prom_id, {}).then(res => {
  5794 + if (res.data.code == 0) {
  5795 + let prom = res.data.data;
  5796 + limit_num =prom.limit_num
  5797 + let yh_is_xz_yh=this.data.yh_is_xz_yh
  5798 + yh_is_xz_yh[pickup_id]=prom.is_xz_yh
  5799 + this.setData({
  5800 + ['yh_is_xz_yh']:yh_is_xz_yh
  5801 + })
  5802 + }
  5803 + })
  5804 + return limit_num
  5805 + },
5711 //--检查订单优惠-- 5806 //--检查订单优惠--
5712 check_is_order_prom: function (condition, func, pick) { 5807 check_is_order_prom: function (condition, func, pick) {
5713 var th = this; 5808 var th = this;
@@ -5730,7 +5825,7 @@ Page({ @@ -5730,7 +5825,7 @@ Page({
5730 var pickid = item.pick_id; 5825 var pickid = item.pick_id;
5731 var map = th.data.prom_goods_map; 5826 var map = th.data.prom_goods_map;
5732 var obj = map[pickid]; 5827 var obj = map[pickid];
5733 - 5828 +
5734 if (map[pickid]) { 5829 if (map[pickid]) {
5735 if (map[pickid][item.prom_id]) { 5830 if (map[pickid][item.prom_id]) {
5736 5831
@@ -5749,6 +5844,7 @@ Page({ @@ -5749,6 +5844,7 @@ Page({
5749 5844
5750 } else { 5845 } else {
5751 var prom = null; 5846 var prom = null;
  5847 +
5752 await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + item.prom_id, {}).then(res => { 5848 await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + item.prom_id, {}).then(res => {
5753 if (res.data.code == 0) { 5849 if (res.data.code == 0) {
5754 prom = res.data.data; 5850 prom = res.data.data;
@@ -5793,6 +5889,7 @@ Page({ @@ -5793,6 +5889,7 @@ Page({
5793 } else { 5889 } else {
5794 var ob = {}; 5890 var ob = {};
5795 var prom = null; 5891 var prom = null;
  5892 +
5796 await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + item.prom_id, {}).then(res => { 5893 await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + item.prom_id, {}).then(res => {
5797 if (res.data.code == 0) { 5894 if (res.data.code == 0) {
5798 prom = res.data.data; 5895 prom = res.data.data;
packageE/pages/cart/cart2/cart2.wxml
@@ -241,7 +241,7 @@ @@ -241,7 +241,7 @@
241 </view> 241 </view>
242 242
243 <!-----使用优惠券------> 243 <!-----使用优惠券------>
244 - <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null && item.can_num>0}}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> 244 + <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{!(yh_is_xz_yh[item.pickup_id]) && ((item.quan_list && item.quan_list.length>0 ) || get_by_quan_list_cart[item.pickup_id]!=null && item.can_num>0)}}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}">
245 <view class="work-frame flex-space-between"> 245 <view class="work-frame flex-space-between">
246 <view class="work">优惠券<text class="quan_num_show fs20">{{item.can_num}}张可用</text></view> 246 <view class="work">优惠券<text class="quan_num_show fs20">{{item.can_num}}张可用</text></view>
247 <view class="xc-right-frame"> 247 <view class="xc-right-frame">
pages/cart/cart/cart.js
@@ -3841,12 +3841,19 @@ Page({ @@ -3841,12 +3841,19 @@ Page({
3841 if (th.data.promgoods_map[p_item[0]]) { 3841 if (th.data.promgoods_map[p_item[0]]) {
3842 prom = th.data.promgoods_map[p_item[0]]; 3842 prom = th.data.promgoods_map[p_item[0]];
3843 } else { 3843 } else {
  3844 +
3844 await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + p_item[0], {}).then(res => { 3845 await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + p_item[0], {}).then(res => {
3845 if (res.data.code == 0) { 3846 if (res.data.code == 0) {
3846 prom = res.data.data; 3847 prom = res.data.data;
3847 } 3848 }
3848 }) 3849 })
3849 } 3850 }
  3851 + let limit_num=0
  3852 + let user_pre_buynum=0
  3853 + if (prom && prom.limit_num) {
  3854 + limit_num=prom.limit_num;
  3855 + user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id)
  3856 + }
3850 //如果活动已经结束 3857 //如果活动已经结束
3851 if (!prom || prom.is_end || prom.end_time < ut.gettimestamp()) { 3858 if (!prom || prom.is_end || prom.end_time < ut.gettimestamp()) {
3852 for (var ii in list.goods) { 3859 for (var ii in list.goods) {
@@ -3860,7 +3867,7 @@ Page({ @@ -3860,7 +3867,7 @@ Page({
3860 } 3867 }
3861 continue; 3868 continue;
3862 } 3869 }
3863 - 3870 +
3864 if (!th.data.promgoods_map[p_item[0]]) th.data.promgoods_map[p_item[0]] = prom; 3871 if (!th.data.promgoods_map[p_item[0]]) th.data.promgoods_map[p_item[0]] = prom;
3865 //---读取打折的详情--- 3872 //---读取打折的详情---
3866 var ob = p_item[1]; 3873 var ob = p_item[1];
@@ -3884,36 +3891,37 @@ Page({ @@ -3884,36 +3891,37 @@ Page({
3884 if (!promgoods_list) continue; 3891 if (!promgoods_list) continue;
3885 th.data.promgoods_list[p_item[0]] = promgoods_list; 3892 th.data.promgoods_list[p_item[0]] = promgoods_list;
3886 } 3893 }
3887 -  
3888 - for (var i in promgoods_list) {  
3889 - var item = promgoods_list[i];  
3890 - if (item.prom_type == 0) {  
3891 - if (ob.price < item.condition) {  
3892 - var elem = {  
3893 - prom_id: prom.id,  
3894 - diff_type: item.prom_type,  
3895 - diff: (item.condition - ob.price).toFixed(2),  
3896 - content: JSON.parse(item.preferential_type) 3894 +
  3895 + if (!limit_num || user_pre_buynum<limit_num) {
  3896 + for (var i in promgoods_list) {
  3897 + var item = promgoods_list[i];
  3898 + if (item.prom_type == 0) {
  3899 + if (ob.price < item.condition) {
  3900 + var elem = {
  3901 + prom_id: prom.id,
  3902 + diff_type: item.prom_type,
  3903 + diff: (item.condition - ob.price).toFixed(2),
  3904 + content: JSON.parse(item.preferential_type)
  3905 + }
  3906 + make_up_arr.push(elem);
  3907 + break;
3897 } 3908 }
3898 - make_up_arr.push(elem);  
3899 - break;  
3900 - }  
3901 - } else {  
3902 - if (ob.num < item.condition) {  
3903 - var elem = {  
3904 - prom_id: prom.id,  
3905 - diff_type: item.prom_type,  
3906 - diff: (item.condition - ob.num).toFixed(2),  
3907 - content: JSON.parse(item.preferential_type) 3909 + } else {
  3910 + if (ob.num < item.condition) {
  3911 + var elem = {
  3912 + prom_id: prom.id,
  3913 + diff_type: item.prom_type,
  3914 + diff: (item.condition - ob.num).toFixed(2),
  3915 + content: JSON.parse(item.preferential_type)
  3916 + }
  3917 + make_up_arr.push(elem);
  3918 + break;
3908 } 3919 }
3909 - make_up_arr.push(elem);  
3910 - break;  
3911 } 3920 }
3912 } 3921 }
3913 } 3922 }
3914 3923
3915 3924
3916 -  
3917 //-- 只有在单赠品的时候,才要进行计算 -- 3925 //-- 只有在单赠品的时候,才要进行计算 --
3918 await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { 3926 await getApp().request.promiseGet("/api/weshop/goods/getDiscount", {
3919 data: { 3927 data: {
@@ -4063,7 +4071,19 @@ Page({ @@ -4063,7 +4071,19 @@ Page({
4063 } 4071 }
4064 4072
4065 }, 4073 },
4066 - 4074 + //优惠促销用户参与次数
  4075 + async getUserBuyPromNum_pre(prom_id){
  4076 + var userInfo = getApp().globalData.userInfo;
  4077 + var url = `/api/weshop/ordergoods/getUserBuyPromNum?store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`;
  4078 + let res = await getApp().request.promiseGet(url, {
  4079 + data:{}
  4080 + });
  4081 + let user_pre_buynum=0
  4082 + if(res.data.code==0 && res.data.data){
  4083 + user_pre_buynum=res.data.data.userbuynum
  4084 + }
  4085 + return user_pre_buynum
  4086 + },
4067 async all_check_prom_activity() { 4087 async all_check_prom_activity() {
4068 this.data.duo_zp_num_arr = {}; 4088 this.data.duo_zp_num_arr = {};
4069 for (var i in this.data.requestData) { 4089 for (var i in this.data.requestData) {
@@ -4150,6 +4170,12 @@ Page({ @@ -4150,6 +4170,12 @@ Page({
4150 } 4170 }
4151 }) 4171 })
4152 } 4172 }
  4173 + let limit_num=0
  4174 + let user_pre_buynum=0
  4175 + if (prom && prom.limit_num) {
  4176 + limit_num=prom.limit_num;
  4177 + user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id)
  4178 + }
4153 //如果活动已经结束 4179 //如果活动已经结束
4154 if (!prom || prom.is_end || prom.end_time < ut.gettimestamp()) { 4180 if (!prom || prom.is_end || prom.end_time < ut.gettimestamp()) {
4155 for (var ii in list.goods) { 4181 for (var ii in list.goods) {
@@ -4163,7 +4189,7 @@ Page({ @@ -4163,7 +4189,7 @@ Page({
4163 } 4189 }
4164 continue; 4190 continue;
4165 } 4191 }
4166 - 4192 +
4167 if (!th.data.promgoods_map[p_item[0]]) th.data.promgoods_map[p_item[0]] = prom; 4193 if (!th.data.promgoods_map[p_item[0]]) th.data.promgoods_map[p_item[0]] = prom;
4168 //---读取打折的详情--- 4194 //---读取打折的详情---
4169 var ob = p_item[1]; 4195 var ob = p_item[1];
@@ -4187,30 +4213,31 @@ Page({ @@ -4187,30 +4213,31 @@ Page({
4187 if (!promgoods_list) continue; 4213 if (!promgoods_list) continue;
4188 th.data.promgoods_list[p_item[0]] = promgoods_list; 4214 th.data.promgoods_list[p_item[0]] = promgoods_list;
4189 } 4215 }
4190 -  
4191 - for (var i in promgoods_list) {  
4192 - var item = promgoods_list[i];  
4193 - if (item.prom_type == 0) {  
4194 - if (ob.price < item.condition) {  
4195 - var elem = {  
4196 - prom_id: prom.id,  
4197 - diff_type: item.prom_type,  
4198 - diff: (item.condition - ob.price).toFixed(2),  
4199 - content: JSON.parse(item.preferential_type) 4216 + if (!limit_num || user_pre_buynum<limit_num) {
  4217 + for (var i in promgoods_list) {
  4218 + var item = promgoods_list[i];
  4219 + if (item.prom_type == 0) {
  4220 + if (ob.price < item.condition) {
  4221 + var elem = {
  4222 + prom_id: prom.id,
  4223 + diff_type: item.prom_type,
  4224 + diff: (item.condition - ob.price).toFixed(2),
  4225 + content: JSON.parse(item.preferential_type)
  4226 + }
  4227 + make_up_arr.push(elem);
  4228 + break;
4200 } 4229 }
4201 - make_up_arr.push(elem);  
4202 - break;  
4203 - }  
4204 - } else {  
4205 - if (ob.num < item.condition) {  
4206 - var elem = {  
4207 - prom_id: prom.id,  
4208 - diff_type: item.prom_type,  
4209 - diff: (item.condition - ob.num).toFixed(2),  
4210 - content: JSON.parse(item.preferential_type) 4230 + } else {
  4231 + if (ob.num < item.condition) {
  4232 + var elem = {
  4233 + prom_id: prom.id,
  4234 + diff_type: item.prom_type,
  4235 + diff: (item.condition - ob.num).toFixed(2),
  4236 + content: JSON.parse(item.preferential_type)
  4237 + }
  4238 + make_up_arr.push(elem);
  4239 + break;
4211 } 4240 }
4212 - make_up_arr.push(elem);  
4213 - break;  
4214 } 4241 }
4215 } 4242 }
4216 } 4243 }
pages/goods/goodsInfo/goodsInfo.js
@@ -267,6 +267,7 @@ Page({ @@ -267,6 +267,7 @@ Page({
267 base_nor_prom_type:0, 267 base_nor_prom_type:0,
268 base_nor_prom_id:0, 268 base_nor_prom_id:0,
269 base_nor_goods_id:0, 269 base_nor_goods_id:0,
  270 + user_pre_buynum:0, //用户优惠促销参与次数
270 }, 271 },
271 272
272 //------初始化加载---------- 273 //------初始化加载----------
@@ -1540,7 +1541,21 @@ Page({ @@ -1540,7 +1541,21 @@ Page({
1540 }) 1541 })
1541 // return userbuynum 1542 // return userbuynum
1542 }, 1543 },
1543 - 1544 + //优惠促销用户参与次数
  1545 + async getUserBuyPromNum_pre(prom_id){
  1546 + var userInfo = getApp().globalData.userInfo;
  1547 + var url = `/api/weshop/ordergoods/getUserBuyPromNum?store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`;
  1548 + let res = await getApp().request.promiseGet(url, {
  1549 + data:{}
  1550 + });
  1551 + let user_pre_buynum=0
  1552 + if(res.data.code==0 && res.data.data){
  1553 + user_pre_buynum=res.data.data.userbuynum
  1554 + }
  1555 + this.setData({
  1556 + user_pre_buynum
  1557 + })
  1558 + },
1544 //-- 加入购物的函数 -- 1559 //-- 加入购物的函数 --
1545 add_cart_func: function (t) { 1560 add_cart_func: function (t) {
1546 var i = getApp().request; 1561 var i = getApp().request;
@@ -7461,7 +7476,7 @@ Page({ @@ -7461,7 +7476,7 @@ Page({
7461 getApp().pre_img(this.data.sele_g.original_img); 7476 getApp().pre_img(this.data.sele_g.original_img);
7462 }, 7477 },
7463 7478
7464 - is_show_more_buy: function () { 7479 + is_show_more_buy: async function () {
7465 var prom_goods = this.data.prom_goods; 7480 var prom_goods = this.data.prom_goods;
7466 var per_price = this.data.sele_g.shop_price 7481 var per_price = this.data.sele_g.shop_price
7467 if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) { 7482 if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) {
@@ -7485,7 +7500,10 @@ Page({ @@ -7485,7 +7500,10 @@ Page({
7485 } 7500 }
7486 } 7501 }
7487 } 7502 }
7488 - 7503 + //获取用户参与优惠促销的次数
  7504 + if(con && con.prom_id){
  7505 + await this.getUserBuyPromNum_pre(con.prom_id);
  7506 + }
7489 this.setData({ 7507 this.setData({
7490 hui_condition: con 7508 hui_condition: con
7491 }); 7509 });
pages/goods/goodsInfo/goodsInfo.wxml
@@ -507,7 +507,7 @@ @@ -507,7 +507,7 @@
507 <view class="fs28 f1" wx:for="{{prom_goods}}"> 507 <view class="fs28 f1" wx:for="{{prom_goods}}">
508 <view> 508 <view>
509 <text class="prom_condition"> 509 <text class="prom_condition">
510 - <text class="fill-box">消费满{{item.condition}}{{item.prom_type==1 ? '件':'元'}}</text>享优惠 510 + <text class="fill-box">消费满{{item.condition}}{{item.prom_type==1 ? '件':'元'}}</text>享优惠(每人{{item.limit_num ? '限参与'+item.limit_num+'次' : '参与不限次' }})
511 </text> 511 </text>
512 </view> 512 </view>
513 513
@@ -1346,7 +1346,7 @@ @@ -1346,7 +1346,7 @@
1346 </view> 1346 </view>
1347 </view> 1347 </view>
1348 <!-- 提示再买多少优惠 --> 1348 <!-- 提示再买多少优惠 -->
1349 - <view style="margin-top: 35rpx;color:#333;font-size:28rpx;" wx:if="{{hui_condition && openSpecModal_ind==2}}"> 1349 + <view style="margin-top: 35rpx;color:#333;font-size:28rpx;" wx:if="{{hui_condition && openSpecModal_ind==2 && (!hui_condition.limit_num || user_pre_buynum<hui_condition.limit_num)}}">
1350 再买{{hui_condition.need}} 1350 再买{{hui_condition.need}}
1351 <text wx:if="{{hui_condition.money}}">,免{{hui_condition.money}}元</text> 1351 <text wx:if="{{hui_condition.money}}">,免{{hui_condition.money}}元</text>
1352 <text wx:if="{{hui_condition.sale}}">,打{{hui_condition.sale}}折</text> 1352 <text wx:if="{{hui_condition.sale}}">,打{{hui_condition.sale}}折</text>
pages/goods/goodsList/goodsList.js
@@ -41,6 +41,7 @@ Page({ @@ -41,6 +41,7 @@ Page({
41 fil_nation_state:0, 41 fil_nation_state:0,
42 fil_brand_state:0, 42 fil_brand_state:0,
43 fil_price_state:0, 43 fil_price_state:0,
  44 + limit_num:0,
44 }, 45 },
45 46
46 onLoad: function(t) { 47 onLoad: function(t) {
@@ -125,6 +126,9 @@ Page({ @@ -125,6 +126,9 @@ Page({
125 th.set_prom_list(arr); 126 th.set_prom_list(arr);
126 } 127 }
127 }) 128 })
  129 + if (t.prom_id) {
  130 + this.getprom(t.prom_id)
  131 + }
128 } 132 }
129 133
130 //--- 阶梯优惠活动的凑单 --- 134 //--- 阶梯优惠活动的凑单 ---
@@ -236,7 +240,18 @@ Page({ @@ -236,7 +240,18 @@ Page({
236 onShow:function () { 240 onShow:function () {
237 getApp().check_can_share(); 241 getApp().check_can_share();
238 }, 242 },
239 - 243 + //获取优惠活动
  244 + async getprom(prom_id){
  245 + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + oo.stoid + "/" + prom_id, {}).then(res => {
  246 + if (res.data.code == 0) {
  247 + let prom = res.data.data;
  248 + let limit_num =prom.limit_num
  249 + this.setData({
  250 + limit_num
  251 + })
  252 + }
  253 + })
  254 + },
240 //设置优惠券的 255 //设置优惠券的
241 set_prom_list:async function(arr){ 256 set_prom_list:async function(arr){
242 var th=this; 257 var th=this;
pages/goods/goodsList/goodsList.wxml
1 <wxs module="g_filter" src="../search/g_filter.wxs"></wxs> 1 <wxs module="g_filter" src="../search/g_filter.wxs"></wxs>
2 <view class="container" wx:if="{{show_all}}"> 2 <view class="container" wx:if="{{show_all}}">
3 <view> 3 <view>
  4 +
4 <block wx:for="{{prom_goods_list}}"> 5 <block wx:for="{{prom_goods_list}}">
5 <view class="fs30 ellipsis-1" style="padding: 20rpx 30rpx"> 6 <view class="fs30 ellipsis-1" style="padding: 20rpx 30rpx">
  7 + <text style="color: red;" wx:if="{{index==0 && limit_num>0}}">每人限参与{{limit_num}}次;</text>
6 满{{item.condition}}<text space="{{true}}" wx:if="{{item.prom_type==0}}">元 </text> <text space="{{true}}" wx:else>件 </text> 8 满{{item.condition}}<text space="{{true}}" wx:if="{{item.prom_type==0}}">元 </text> <text space="{{true}}" wx:else>件 </text>
7 <text space="{{true}}" wx:if="{{item.content.is_money && item.content.is_money!='0'}}">减{{item.content.money}}元 </text> 9 <text space="{{true}}" wx:if="{{item.content.is_money && item.content.is_money!='0'}}">减{{item.content.money}}元 </text>
8 <text space="{{true}}" wx:if="{{item.content.is_sale && item.content.is_sale!='0'}}">打{{item.content.sale}}折 </text> 10 <text space="{{true}}" wx:if="{{item.content.is_sale && item.content.is_sale!='0'}}">打{{item.content.sale}}折 </text>