Commit 304c92f2b64e1cb033e93ea146e7186824359fc8

Authored by pengye
1 parent 38e962a7

短信赠送的券、消费金使用(券列表、免费券付款页)

@@ -11,14 +11,28 @@ Component({ @@ -11,14 +11,28 @@ Component({
11 this.getuser(); 11 this.getuser();
12 this.getautomenu(); 12 this.getautomenu();
13 this.getorder(); 13 this.getorder();
14 - this.getlist() 14 + this.getCheckUserHavePhone()
15 }, 15 },
16 methods:{ 16 methods:{
17 - //获取用户未使用优惠券列表数量  
18 - getlist() {  
19 - App.Activity.GetNewRechargeListByOpenid({ 17 + // 检测用户是否绑定手机号
  18 + getCheckUserHavePhone() {
  19 + App.Wechat.CheckUserHavePhone({
20 openid: getApp().openid, 20 openid: getApp().openid,
21 - }).then((res) => { 21 + }).then((json) => {
  22 + if (json.ret == 200) {
  23 + let data = json.data;
  24 + let phone = (data && data.phone) ? data.phone : '';
  25 + this.getlist(phone)
  26 + }
  27 + })
  28 + },
  29 + //获取用户未使用优惠券列表数量
  30 + getlist(phone) {
  31 + let params = {
  32 + openid: getApp().openid,
  33 + }
  34 + if(phone) params.phone = phone
  35 + App.Activity.GetNewRechargeListByOpenid({...params}).then((res) => {
22 if (res.ret == 200) { 36 if (res.ret == 200) {
23 let list = res.data; 37 let list = res.data;
24 list = list.filter(item => { 38 list = list.filter(item => {
@@ -53,10 +53,19 @@ Component({ @@ -53,10 +53,19 @@ Component({
53 const query = this.createSelectorQuery() 53 const query = this.createSelectorQuery()
54 query.select('.number-item').boundingClientRect() 54 query.select('.number-item').boundingClientRect()
55 query.exec((res) => { 55 query.exec((res) => {
56 - this.setData({  
57 - itemHeight: res[0].height  
58 - })  
59 - this.startScrollAni() 56 + // 页面里没有数字项(.number-item)时 res[0] 为 null,做保护避免报错
  57 + if (res && res[0] && res[0].height) {
  58 + this.setData({
  59 + itemHeight: res[0].height
  60 + })
  61 + this.startScrollAni()
  62 + } else {
  63 + // 重置状态,等待下一次 value 变化时再计算高度
  64 + this.setData({
  65 + itemHeight: 0,
  66 + aniArr: []
  67 + })
  68 + }
60 }) 69 })
61 }, 70 },
62 /** 开始滚动动画 */ 71 /** 开始滚动动画 */
@@ -73,14 +73,19 @@ Page({ @@ -73,14 +73,19 @@ Page({
73 this.setData({ 73 this.setData({
74 purePhoneNumber: data.phone, 74 purePhoneNumber: data.phone,
75 }) 75 })
76 - this.getUserInfo() 76 + this.getUserInfo(data.phone)
77 this.getUserRechargeInfo(data.phone) 77 this.getUserRechargeInfo(data.phone)
  78 + this.getCoupon()
78 } else { 79 } else {
79 this.getUserInfo() 80 this.getUserInfo()
80 this.setData({ 81 this.setData({
81 purePhoneNumber: '', 82 purePhoneNumber: '',
82 }) 83 })
  84 + this.getCoupon()
83 } 85 }
  86 + } else {
  87 + // 查询手机号失败时,先拉取 openid 维度的券兜底
  88 + this.getCoupon()
84 } 89 }
85 }) 90 })
86 }, 91 },
@@ -192,11 +197,13 @@ Page({ @@ -192,11 +197,13 @@ Page({
192 }) 197 })
193 }, 198 },
194 // 获取用户在商家&所有消费金 199 // 获取用户在商家&所有消费金
195 - getUserInfo() {  
196 - App.Activity.GetConsumeBySeller({ 200 + getUserInfo(phone) {
  201 + let params = {
197 openid: getApp().openid, 202 openid: getApp().openid,
198 sellerid: this.sid, 203 sellerid: this.sid,
199 - }).then((json) => { 204 + }
  205 + if(phone) params.phone = phone;
  206 + App.Activity.GetConsumeBySeller({...params}).then((json) => {
200 if (json.ret == 200) { 207 if (json.ret == 200) {
201 let data = json.data; 208 let data = json.data;
202 if (data && data.length > 0) { 209 if (data && data.length > 0) {
@@ -477,8 +484,10 @@ Page({ @@ -477,8 +484,10 @@ Page({
477 if (!id) { 484 if (!id) {
478 let price = this.data.actualPrice * 1 * this.data.multiple 485 let price = this.data.actualPrice * 1 * this.data.multiple
479 if (!price) return false 486 if (!price) return false
480 - let str = this.data.finalList.map(item => item.activity_id).join(',');  
481 - console.log('核销所勾选的券传参', str); 487 + // isinitial为1的券用activity_id传参,isinitial为0的券用phone_activity_id传参
  488 + let activityIdStr = this.data.finalList.filter(item => item.isinitial == '1').map(item => item.activity_id).join(',');
  489 + let phoneActivityIdStr = this.data.finalList.filter(item => item.isinitial == '0').map(item => item.phone_activity_id).join(',');
  490 + console.log('充值所勾选的券传参', activityIdStr, phoneActivityIdStr);
482 let params = { 491 let params = {
483 type: '2', 492 type: '2',
484 types: '4', // 1邀请函 2提前点餐 3商家端app分享 4支付页充值 5我的页面余额充值 493 types: '4', // 1邀请函 2提前点餐 3商家端app分享 4支付页充值 5我的页面余额充值
@@ -493,8 +502,11 @@ Page({ @@ -493,8 +502,11 @@ Page({
493 if (this.data.consumeDiscount * 1 > 0 && this.data.consumeSwitch) { 502 if (this.data.consumeDiscount * 1 > 0 && this.data.consumeSwitch) {
494 params.consume = this.data.consumeDiscount; 503 params.consume = this.data.consumeDiscount;
495 } 504 }
496 - if (str) {  
497 - params.activity_id = str; 505 + if (activityIdStr) {
  506 + params.activity_id = activityIdStr;
  507 + }
  508 + if (phoneActivityIdStr) {
  509 + params.phone_activity_id = phoneActivityIdStr;
498 } 510 }
499 if (this.data.givePrice) { 511 if (this.data.givePrice) {
500 params.givePrice = this.data.givePrice; //当餐免费送的余额 512 params.givePrice = this.data.givePrice; //当餐免费送的余额
@@ -533,7 +545,7 @@ Page({ @@ -533,7 +545,7 @@ Page({
533 this.setData({ 545 this.setData({
534 purePhoneNumber: res.data.phone_info.purePhoneNumber, 546 purePhoneNumber: res.data.phone_info.purePhoneNumber,
535 }) 547 })
536 - this.getUserInfo() 548 + this.getUserInfo(res.data.phone_info.purePhoneNumber)
537 this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber) 549 this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber)
538 this.getUserRechargeInfo(res.data.phone_info.purePhoneNumber) 550 this.getUserRechargeInfo(res.data.phone_info.purePhoneNumber)
539 } else { 551 } else {
@@ -675,108 +687,143 @@ Page({ @@ -675,108 +687,143 @@ Page({
675 }, 687 },
676 // 获取所有优惠券列表 688 // 获取所有优惠券列表
677 getCoupon() { 689 getCoupon() {
  690 + let phone = this.data.purePhoneNumber
  691 + // 1、先通过 openid 获取已领取的券,标记 isinitial:1
678 App.Activity.ActivityListByOpenid({ 692 App.Activity.ActivityListByOpenid({
679 sellerid: this.sid 693 sellerid: this.sid
680 }).then(res => { 694 }).then(res => {
  695 + let openidCouponList = []
681 if (res.ret == 200 && res.data && res.data.length > 0) { 696 if (res.ret == 200 && res.data && res.data.length > 0) {
682 - let list = res.data  
683 - list.forEach(detail => {  
684 - detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';  
685 - detail.arule = detail.arule ? util.determine(detail.arule) : '';  
686 - detail.expiration_date = detail.expiration_date ? util.determine(detail.expiration_date) : '';  
687 - detail.aexpiration = detail.aexpiration ? util.determine(detail.aexpiration) : '';  
688 - if (detail.arule) {  
689 - detail.accumulationShow = detail.arule.is_accumulation  
690 - }  
691 - if (detail.exp_date && detail.exp_date.week_data) {  
692 - let mor = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')  
693 - let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')  
694 - let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '3').rArr.join('、')  
695 - if (mor) mor = '早餐:' + mor  
696 - if (noon) noon = '午餐:' + noon  
697 - if (nig) nig = '晚餐:' + nig  
698 - detail.morText = mor;  
699 - detail.noonText = noon;  
700 - detail.nigText = nig;  
701 - }  
702 - detail.checked = false;  
703 - detail.showCpupon = '0';  
704 - // 获取使用券的有效期  
705 - detail.cdate = detail.cdate * 1;  
706 - detail.useStime = '';  
707 - detail.useEtime = '';  
708 - let condition = detail.aexpiration  
709 - if (condition.valid_forever === '0' && condition.stime && condition.etime) {  
710 - detail.useStime = condition.stime;  
711 - detail.useEtime = condition.etime;  
712 - }  
713 - if (condition.valid_forever === '1') {  
714 - detail.foreverText = '永久有效';  
715 - }  
716 - if (condition.valid_forever === '0' && condition.today) {  
717 - let obj = this.setTimeRange(detail.cdate, 0, parseInt(condition.today) - 1);  
718 - detail.useStime = obj.useStime;  
719 - detail.useEtime = obj.useEtime;  
720 - }  
721 - if (condition.valid_forever === '0' && condition.tomorrow) {  
722 - let obj = this.setTimeRange(detail.cdate, 1, condition.tomorrow * 1);  
723 - detail.useStime = obj.useStime;  
724 - detail.useEtime = obj.useEtime;  
725 - }  
726 - if (condition.valid_forever === '0' && condition.sday && condition.eday) {  
727 - let obj = this.setTimeRange(detail.cdate, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1);  
728 - detail.useStime = obj.useStime;  
729 - detail.useEtime = obj.useEtime;  
730 - }  
731 - if((detail.useStime>0 && detail.useEtime>0) || condition.valid_forever === '1') {  
732 - detail.endDateStr = condition.valid_forever == '1' ? '永久有效' : (util.unixtoTime(detail.useStime, 'YYYY-MM-DD') + '至' + util.unixtoTime(detail.useEtime, 'YYYY-MM-DD'));  
733 - }  
734 - })  
735 - list = list.filter(item => {  
736 - return (this.data.dataStr < (item.useEtime * 1) || item.aexpiration.valid_forever == '1');  
737 - })  
738 - list.sort((a, b) => {  
739 - if (a.aexpiration.valid_forever == '1' && b.aexpiration.valid_forever != '1') return 1;  
740 - if (a.aexpiration.valid_forever != '1' && b.aexpiration.valid_forever == '1') return -1;  
741 - return (a.useEtime * 1) - (b.useEtime * 1)  
742 - })  
743 - let couponArr = list  
744 - // 相同aid的券合并成一张,用加减号选择张数  
745 - let couponGroup = {}  
746 - let couponList = []  
747 - couponArr.forEach(item => {  
748 - let key = item.aid ? item.aid : item.activity_id  
749 - if (couponGroup[key]) {  
750 - couponGroup[key].num = (couponGroup[key].num * 1) + 1  
751 - couponGroup[key].activityIds.push(item.activity_id)  
752 - } else {  
753 - item.num = 1  
754 - item.checkedNum = 0  
755 - item.activityIds = [item.activity_id]  
756 - couponGroup[key] = item  
757 - couponList.push(item)  
758 - }  
759 - })  
760 - couponArr = couponList  
761 - // 单次使用数量限制,0表示不限制,默认0;合并完成后统一计算  
762 - couponArr.forEach(item => {  
763 - let useLimit = item.single_use_limit ? (item.single_use_limit * 1) : 0  
764 - item.maxNum = (useLimit > 0 && useLimit < item.num) ? useLimit : item.num  
765 - })  
766 - console.log('couponArr----',couponArr);  
767 -  
768 - this.setData({  
769 - couponArr 697 + openidCouponList = res.data
  698 + openidCouponList.forEach(item => {
  699 + item.isinitial = '1'
770 }) 700 })
771 } 701 }
  702 + // 未授权手机号时,直接用 openid 获取的券
  703 + if (!phone) {
  704 + this.filterCouponList(openidCouponList)
  705 + return
  706 + }
  707 + // 2、再通过授权手机号获取的券,标记 isinitial:0
  708 + App.Activity.GetActivityListByPhone({
  709 + sellerid: this.sid,
  710 + phone
  711 + }).then(res2 => {
  712 + let phoneCouponList = []
  713 + if (res2 && res2.ret == 200 && res2.data && res2.data.length > 0) {
  714 + phoneCouponList = res2.data
  715 + phoneCouponList.forEach(item => {
  716 + item.isinitial = '0'
  717 + })
  718 + }
  719 + // 3、两个数组 concat 合并成所有券后,统一筛选可用的券
  720 + this.filterCouponList(openidCouponList.concat(phoneCouponList))
  721 + })
  722 + })
  723 + },
  724 + // 所有券合并后,统一筛选可用的券
  725 + filterCouponList(list) {
  726 + if (list.length == 0) {
  727 + return
  728 + }
  729 + list.forEach(detail => {
  730 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  731 + detail.arule = detail.arule ? util.determine(detail.arule) : '';
  732 + detail.expiration_date = detail.expiration_date ? util.determine(detail.expiration_date) : '';
  733 + detail.aexpiration = detail.aexpiration ? util.determine(detail.aexpiration) : '';
  734 + if (detail.arule) {
  735 + detail.accumulationShow = detail.arule.is_accumulation
  736 + }
  737 + if (detail.exp_date && detail.exp_date.week_data) {
  738 + let mor = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
  739 + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
  740 + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '3').rArr.join('、')
  741 + if (mor) mor = '早餐:' + mor
  742 + if (noon) noon = '午餐:' + noon
  743 + if (nig) nig = '晚餐:' + nig
  744 + detail.morText = mor;
  745 + detail.noonText = noon;
  746 + detail.nigText = nig;
  747 + }
  748 + detail.checked = false;
  749 + detail.showCpupon = '0';
  750 + // 获取使用券的有效期
  751 + detail.cdate = detail.cdate * 1;
  752 + detail.useStime = '';
  753 + detail.useEtime = '';
  754 + let condition = detail.aexpiration
  755 + if (condition.valid_forever === '0' && condition.stime && condition.etime) {
  756 + detail.useStime = condition.stime;
  757 + detail.useEtime = condition.etime;
  758 + }
  759 + if (condition.valid_forever === '1') {
  760 + detail.foreverText = '永久有效';
  761 + }
  762 + if (condition.valid_forever === '0' && condition.today) {
  763 + let obj = this.setTimeRange(detail.cdate, 0, parseInt(condition.today) - 1);
  764 + detail.useStime = obj.useStime;
  765 + detail.useEtime = obj.useEtime;
  766 + }
  767 + if (condition.valid_forever === '0' && condition.tomorrow) {
  768 + let obj = this.setTimeRange(detail.cdate, 1, condition.tomorrow * 1);
  769 + detail.useStime = obj.useStime;
  770 + detail.useEtime = obj.useEtime;
  771 + }
  772 + if (condition.valid_forever === '0' && condition.sday && condition.eday) {
  773 + let obj = this.setTimeRange(detail.cdate, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1);
  774 + detail.useStime = obj.useStime;
  775 + detail.useEtime = obj.useEtime;
  776 + }
  777 + if((detail.useStime>0 && detail.useEtime>0) || condition.valid_forever === '1') {
  778 + detail.endDateStr = condition.valid_forever == '1' ? '永久有效' : (util.unixtoTime(detail.useStime, 'YYYY-MM-DD') + '至' + util.unixtoTime(detail.useEtime, 'YYYY-MM-DD'));
  779 + }
  780 + })
  781 + list = list.filter(item => {
  782 + return (this.data.dataStr < (item.useEtime * 1) || item.aexpiration.valid_forever == '1');
  783 + })
  784 + list.sort((a, b) => {
  785 + if (a.aexpiration.valid_forever == '1' && b.aexpiration.valid_forever != '1') return 1;
  786 + if (a.aexpiration.valid_forever != '1' && b.aexpiration.valid_forever == '1') return -1;
  787 + return (a.useEtime * 1) - (b.useEtime * 1)
  788 + })
  789 + let couponArr = list
  790 + // 同来源(openid/phone)且相同aid的券合并成一张,用加减号选择张数;不同来源分开
  791 + let couponGroup = {}
  792 + let couponList = []
  793 + couponArr.forEach(item => {
  794 + // openid券与phone券分开合并:同来源且同aid的券合并成一张,用加减号选择张数
  795 + let key = (item.isinitial == '0' ? 'p_' : 'o_') + (item.aid ? item.aid : (item.activity_id || item.phone_activity_id))
  796 + let id = item.activity_id || item.phone_activity_id
  797 + if (couponGroup[key]) {
  798 + couponGroup[key].num = (couponGroup[key].num * 1) + 1
  799 + couponGroup[key].activityIds.push(id)
  800 + } else {
  801 + item._key = key
  802 + item.num = 1
  803 + item.checkedNum = 0
  804 + item.activityIds = [id]
  805 + couponGroup[key] = item
  806 + couponList.push(item)
  807 + }
  808 + })
  809 + couponArr = couponList
  810 + // 单次使用数量限制,0表示不限制,默认0;合并完成后统一计算
  811 + couponArr.forEach(item => {
  812 + let useLimit = item.single_use_limit ? (item.single_use_limit * 1) : 0
  813 + item.maxNum = (useLimit > 0 && useLimit < item.num) ? useLimit : item.num
  814 + })
  815 + console.log('couponArr----',couponArr);
  816 +
  817 + this.setData({
  818 + couponArr
772 }) 819 })
773 }, 820 },
774 // 加减号选择券的张数 821 // 加减号选择券的张数
775 changeCouponNum(e) { 822 changeCouponNum(e) {
776 let type = e.currentTarget.dataset.type; 823 let type = e.currentTarget.dataset.type;
777 - let aid = e.currentTarget.dataset.aid; 824 + let key = e.currentTarget.dataset.key;
778 const list = this.data.couponArr 825 const list = this.data.couponArr
779 - let item = list.find(i => i.aid == aid) 826 + let item = list.find(i => i._key == key)
780 if (!item) return 827 if (!item) return
781 if (type == 'plus') { 828 if (type == 'plus') {
782 if (item.canAdd != '1') return 829 if (item.canAdd != '1') return
@@ -790,10 +837,10 @@ Page({ @@ -790,10 +837,10 @@ Page({
790 }, 837 },
791 // 加减号中间输入框:只允许正整数或0,且不能超过当前可用张数 838 // 加减号中间输入框:只允许正整数或0,且不能超过当前可用张数
792 numInputChange(e) { 839 numInputChange(e) {
793 - let aid = e.currentTarget.dataset.aid; 840 + let key = e.currentTarget.dataset.key;
794 let val = (e.detail.value || '').replace(/[^\d]/g, ''); // 只保留数字 841 let val = (e.detail.value || '').replace(/[^\d]/g, ''); // 只保留数字
795 const list = this.data.couponArr 842 const list = this.data.couponArr
796 - let item = list.find(i => i.aid == aid) 843 + let item = list.find(i => i._key == key)
797 if (!item) return 844 if (!item) return
798 let maxSelect = this.getMaxSelectNum(item) 845 let maxSelect = this.getMaxSelectNum(item)
799 let num = val === '' ? 0 : parseInt(val, 10) 846 let num = val === '' ? 0 : parseInt(val, 10)
@@ -809,7 +856,7 @@ Page({ @@ -809,7 +856,7 @@ Page({
809 let descStr = 0 856 let descStr = 0
810 let val = 0 857 let val = 0
811 list.forEach(i => { 858 list.forEach(i => {
812 - if (i.checkedNum > 0 && i.aid != item.aid) { 859 + if (i.checkedNum > 0 && i._key != item._key) {
813 let d = parseFloat(i.desc) || 0 860 let d = parseFloat(i.desc) || 0
814 if (d > 0) descStr += d * i.checkedNum 861 if (d > 0) descStr += d * i.checkedNum
815 val += parseFloat(i.price) * i.checkedNum 862 val += parseFloat(i.price) * i.checkedNum
@@ -893,7 +940,8 @@ Page({ @@ -893,7 +940,8 @@ Page({
893 for (let k = 0; k < item.checkedNum; k++) { 940 for (let k = 0; k < item.checkedNum; k++) {
894 finalList.push({ 941 finalList.push({
895 ...item, 942 ...item,
896 - activity_id: item.activityIds[k] 943 + activity_id: item.isinitial == '0' ? '' : item.activityIds[k],
  944 + phone_activity_id: item.isinitial == '0' ? item.activityIds[k] : (item.phone_activity_id || ''),
897 }) 945 })
898 } 946 }
899 } 947 }
@@ -1070,8 +1118,10 @@ Page({ @@ -1070,8 +1118,10 @@ Page({
1070 wx.showLoading({ 1118 wx.showLoading({
1071 title: '支付中', 1119 title: '支付中',
1072 }) 1120 })
1073 - let str = this.data.finalList.map(item => item.activity_id).join(',');  
1074 - console.log('核销所勾选的券传参', str); 1121 + // isinitial为1的券用activity_id传参,isinitial为0的券用phone_activity_id传参
  1122 + let activityIdStr = this.data.finalList.filter(item => item.isinitial == '1').map(item => item.activity_id).join(',');
  1123 + let phoneActivityIdStr = this.data.finalList.filter(item => item.isinitial == '0').map(item => item.phone_activity_id).join(',');
  1124 + console.log('核销所勾选的券传参', activityIdStr, phoneActivityIdStr);
1075 let params = { 1125 let params = {
1076 sellerid: this.data.seller.sid, 1126 sellerid: this.data.seller.sid,
1077 price: soothPrice, 1127 price: soothPrice,
@@ -1080,8 +1130,11 @@ Page({ @@ -1080,8 +1130,11 @@ Page({
1080 params.consume = this.data.consumeDiscount; 1130 params.consume = this.data.consumeDiscount;
1081 params.phone = this.data.purePhoneNumber; 1131 params.phone = this.data.purePhoneNumber;
1082 } 1132 }
1083 - if (str) {  
1084 - params.activity_id = str; 1133 + if (activityIdStr) {
  1134 + params.activity_id = activityIdStr;
  1135 + }
  1136 + if (phoneActivityIdStr) {
  1137 + params.phone_activity_id = phoneActivityIdStr;
1085 } 1138 }
1086 // 用余额支付 || 支付金额为0 1139 // 用余额支付 || 支付金额为0
1087 if (this.data.soothPrice == '0.00') { 1140 if (this.data.soothPrice == '0.00') {
@@ -1091,8 +1144,11 @@ Page({ @@ -1091,8 +1144,11 @@ Page({
1091 price: this.data.inputValue, 1144 price: this.data.inputValue,
1092 phone: this.data.purePhoneNumber, 1145 phone: this.data.purePhoneNumber,
1093 } 1146 }
1094 - if (str) {  
1095 - obj.activity_id = str; 1147 + if (activityIdStr) {
  1148 + obj.activity_id = activityIdStr;
  1149 + }
  1150 + if (phoneActivityIdStr) {
  1151 + obj.phone_activity_id = phoneActivityIdStr;
1096 } 1152 }
1097 let consumeDiscount = this.data.consumeDiscount * 1 1153 let consumeDiscount = this.data.consumeDiscount * 1
1098 if (this.data.balancePay * 1 > 0) { 1154 if (this.data.balancePay * 1 > 0) {
@@ -1124,6 +1180,7 @@ Page({ @@ -1124,6 +1180,7 @@ Page({
1124 if (this.data.balancePay) { 1180 if (this.data.balancePay) {
1125 params.recharge_balance = this.data.balancePay; 1181 params.recharge_balance = this.data.balancePay;
1126 } 1182 }
  1183 + console.log('params-----',params);
1127 App.PayOnline.CombineTransactionsByNewActivity(params).then(res => { 1184 App.PayOnline.CombineTransactionsByNewActivity(params).then(res => {
1128 console.log('付款信息', res.data); 1185 console.log('付款信息', res.data);
1129 if (res.ret != '200') { 1186 if (res.ret != '200') {
@@ -1204,7 +1261,7 @@ Page({ @@ -1204,7 +1261,7 @@ Page({
1204 } 1261 }
1205 }) 1262 })
1206 }, 1263 },
1207 - payFail() { 1264 + payFail(isShow) {
1208 this.setData({ 1265 this.setData({
1209 inputValue: '', 1266 inputValue: '',
1210 finalList: [], 1267 finalList: [],
@@ -1216,8 +1273,11 @@ Page({ @@ -1216,8 +1273,11 @@ Page({
1216 payType:'2', 1273 payType:'2',
1217 soothPrice: '', 1274 soothPrice: '',
1218 }) 1275 })
1219 - this.getCoupon()  
1220 - this.getUserInfo() 1276 + // onShow触发时不提前拉券,等getCheckUserHavePhone拿到手机号后再拉,避免漏掉手机号维度的券
  1277 + if (!isShow) {
  1278 + this.getCoupon()
  1279 + this.getUserInfo(this.data.purePhoneNumber)
  1280 + }
1221 }, 1281 },
1222 giftConsumeFun(priceSum, orderid) { 1282 giftConsumeFun(priceSum, orderid) {
1223 let isReturn = this.data.isReturn; 1283 let isReturn = this.data.isReturn;
@@ -1251,7 +1311,7 @@ Page({ @@ -1251,7 +1311,7 @@ Page({
1251 sellerid: this.data.seller.sid 1311 sellerid: this.data.seller.sid
1252 }).then(res => { 1312 }).then(res => {
1253 if(type == '1'){ 1313 if(type == '1'){
1254 - this.getUserInfo() 1314 + this.getUserInfo(this.data.purePhoneNumber)
1255 } 1315 }
1256 }) 1316 })
1257 }, 1317 },
@@ -1361,11 +1421,13 @@ Page({ @@ -1361,11 +1421,13 @@ Page({
1361 let consumeDiscount = this.data.consumeDiscount; 1421 let consumeDiscount = this.data.consumeDiscount;
1362 let inputValue = this.data.inputValue; 1422 let inputValue = this.data.inputValue;
1363 const amount = parseFloat(inputValue - consumeDiscount); 1423 const amount = parseFloat(inputValue - consumeDiscount);
  1424 + // 券唯一标识:手机号维度券没有 activity_id,用 phone_activity_id 区分,避免不同券互相误匹配
  1425 + const couponKey = coupon => (coupon.isinitial == '0' ? 'p_' + coupon.phone_activity_id : 'o_' + coupon.activity_id);
1364 const validCoupons = arr.filter(coupon => (coupon.isOk == '1' && parseFloat(coupon.desc) <= amount) && amount>=parseFloat(coupon.price)); 1426 const validCoupons = arr.filter(coupon => (coupon.isOk == '1' && parseFloat(coupon.desc) <= amount) && amount>=parseFloat(coupon.price));
1365 // 排序后,优先选择最大优惠的券 1427 // 排序后,优先选择最大优惠的券
1366 validCoupons.sort((a, b) => parseFloat(b.price) - parseFloat(a.price)); 1428 validCoupons.sort((a, b) => parseFloat(b.price) - parseFloat(a.price));
1367 arr.forEach(item => { 1429 arr.forEach(item => {
1368 - const isValid = validCoupons.some(validCoupon => validCoupon.activity_id == item.activity_id); 1430 + const isValid = validCoupons.some(validCoupon => couponKey(validCoupon) == couponKey(item));
1369 item.canCheck = isValid ? '1' : '0'; // 如果在 validCoupons 中,设置 canCheck 为 1,否则为 0 1431 item.canCheck = isValid ? '1' : '0'; // 如果在 validCoupons 中,设置 canCheck 为 1,否则为 0
1370 }); 1432 });
1371 console.log('可以勾选的券 && 满足付款条件的券', validCoupons); 1433 console.log('可以勾选的券 && 满足付款条件的券', validCoupons);
@@ -1399,12 +1461,12 @@ Page({ @@ -1399,12 +1461,12 @@ Page({
1399 let maxCopies = Math.floor((amount - thresholdDescSum) / couponDesc) 1461 let maxCopies = Math.floor((amount - thresholdDescSum) / couponDesc)
1400 if (maxCopies > coupon.maxNum) maxCopies = coupon.maxNum 1462 if (maxCopies > coupon.maxNum) maxCopies = coupon.maxNum
1401 if (maxCopies > 0) { 1463 if (maxCopies > 0) {
1402 - selectCount[coupon.aid] = maxCopies 1464 + selectCount[coupon._key] = maxCopies
1403 thresholdDescSum += couponDesc * maxCopies 1465 thresholdDescSum += couponDesc * maxCopies
1404 maxThresholdValue += couponPrice * maxCopies 1466 maxThresholdValue += couponPrice * maxCopies
1405 } 1467 }
1406 }) 1468 })
1407 - list1 = stackingCoupons.filter(i => (selectCount[i.aid] || 0) > 0) 1469 + list1 = stackingCoupons.filter(i => (selectCount[i._key] || 0) > 0)
1408 console.log('可叠加优惠券组合', list1); 1470 console.log('可叠加优惠券组合', list1);
1409 // 3. 无门槛可叠加券:满减门槛之和小于输入金额时可以叠加,等于时和满减组合取优惠更大的 1471 // 3. 无门槛可叠加券:满减门槛之和小于输入金额时可以叠加,等于时和满减组合取优惠更大的
1410 // 先算无门槛券单独使用的优惠总额 1472 // 先算无门槛券单独使用的优惠总额
@@ -1417,7 +1479,7 @@ Page({ @@ -1417,7 +1479,7 @@ Page({
1417 let num = Math.floor((amount - noDescValue) / couponPrice) 1479 let num = Math.floor((amount - noDescValue) / couponPrice)
1418 if (num > coupon.maxNum) num = coupon.maxNum 1480 if (num > coupon.maxNum) num = coupon.maxNum
1419 if (num > 0) { 1481 if (num > 0) {
1420 - noDescCount[coupon.aid] = num 1482 + noDescCount[coupon._key] = num
1421 noDescValue += couponPrice * num 1483 noDescValue += couponPrice * num
1422 } 1484 }
1423 } 1485 }
@@ -1432,21 +1494,21 @@ Page({ @@ -1432,21 +1494,21 @@ Page({
1432 let num = Math.floor((amount - maxStackableValue) / couponPrice) 1494 let num = Math.floor((amount - maxStackableValue) / couponPrice)
1433 if (num > coupon.maxNum) num = coupon.maxNum 1495 if (num > coupon.maxNum) num = coupon.maxNum
1434 if (num > 0) { 1496 if (num > 0) {
1435 - selectCount[coupon.aid] = num 1497 + selectCount[coupon._key] = num
1436 maxStackableValue += couponPrice * num 1498 maxStackableValue += couponPrice * num
1437 } 1499 }
1438 } 1500 }
1439 }) 1501 })
1440 - list1 = stackingCoupons.filter(i => (selectCount[i.aid] || 0) > 0) 1502 + list1 = stackingCoupons.filter(i => (selectCount[i._key] || 0) > 0)
1441 } else if (noDescValue > maxThresholdValue) { 1503 } else if (noDescValue > maxThresholdValue) {
1442 // 门槛等于输入金额,不能叠加,取无门槛券或满减券中优惠更大的 1504 // 门槛等于输入金额,不能叠加,取无门槛券或满减券中优惠更大的
1443 - list1 = stackingCoupons.filter(i => (noDescCount[i.aid] || 0) > 0) 1505 + list1 = stackingCoupons.filter(i => (noDescCount[i._key] || 0) > 0)
1444 selectCount = noDescCount 1506 selectCount = noDescCount
1445 maxStackableValue = noDescValue 1507 maxStackableValue = noDescValue
1446 } else if (noDescValue == maxThresholdValue && noDescValue > 0) { 1508 } else if (noDescValue == maxThresholdValue && noDescValue > 0) {
1447 // 优惠相同取最早到期 1509 // 优惠相同取最早到期
1448 - let listThreshold = stackingCoupons.filter(i => (selectCount[i.aid] || 0) > 0)  
1449 - let listNoDesc = stackingCoupons.filter(i => (noDescCount[i.aid] || 0) > 0) 1510 + let listThreshold = stackingCoupons.filter(i => (selectCount[i._key] || 0) > 0)
  1511 + let listNoDesc = stackingCoupons.filter(i => (noDescCount[i._key] || 0) > 0)
1450 let min1 = listThreshold.length > 0 ? Math.min(...listThreshold.map(item => item.useEtime)) : Infinity 1512 let min1 = listThreshold.length > 0 ? Math.min(...listThreshold.map(item => item.useEtime)) : Infinity
1451 let min2 = listNoDesc.length > 0 ? Math.min(...listNoDesc.map(item => item.useEtime)) : Infinity 1513 let min2 = listNoDesc.length > 0 ? Math.min(...listNoDesc.map(item => item.useEtime)) : Infinity
1452 if (min2 < min1) { 1514 if (min2 < min1) {
@@ -1500,11 +1562,11 @@ Page({ @@ -1500,11 +1562,11 @@ Page({
1500 let discountPrice = 0; 1562 let discountPrice = 0;
1501 // 更新选中的优惠券 1563 // 更新选中的优惠券
1502 finalList.forEach(coupon => { 1564 finalList.forEach(coupon => {
1503 - let target = arr.findIndex(obj => obj.activity_id === coupon.activity_id); 1565 + let target = arr.findIndex(obj => couponKey(obj) === couponKey(coupon));
1504 if (target>-1) { 1566 if (target>-1) {
1505 arr[target].showCpupon = 1; 1567 arr[target].showCpupon = 1;
1506 - arr[target].checkedNum = stackCount[coupon.aid] || 1;  
1507 - discountPrice += parseFloat(coupon.price) * (stackCount[coupon.aid] || 1); // 使用 parseFloat 确保类型正确 1568 + arr[target].checkedNum = stackCount[coupon._key] || 1;
  1569 + discountPrice += parseFloat(coupon.price) * (stackCount[coupon._key] || 1); // 使用 parseFloat 确保类型正确
1508 } 1570 }
1509 console.log('选中的券', { 1571 console.log('选中的券', {
1510 ...coupon 1572 ...coupon
@@ -1517,7 +1579,8 @@ Page({ @@ -1517,7 +1579,8 @@ Page({
1517 for (let k = 0; k < item.checkedNum; k++) { 1579 for (let k = 0; k < item.checkedNum; k++) {
1518 finalList.push({ 1580 finalList.push({
1519 ...item, 1581 ...item,
1520 - activity_id: item.activityIds[k] 1582 + activity_id: item.isinitial == '0' ? '' : item.activityIds[k],
  1583 + phone_activity_id: item.isinitial == '0' ? item.activityIds[k] : (item.phone_activity_id || ''),
1521 }) 1584 })
1522 } 1585 }
1523 } 1586 }
@@ -1842,7 +1905,7 @@ Page({ @@ -1842,7 +1905,7 @@ Page({
1842 * 生命周期函数--监听页面显示 1905 * 生命周期函数--监听页面显示
1843 */ 1906 */
1844 onShow() { 1907 onShow() {
1845 - this.payFail() 1908 + this.payFail(true)
1846 this.getCheckUserHavePhone() 1909 this.getCheckUserHavePhone()
1847 this.getFreeMealConfigFun() 1910 this.getFreeMealConfigFun()
1848 }, 1911 },
@@ -17,16 +17,29 @@ @@ -17,16 +17,29 @@
17 <text>¥</text> 17 <text>¥</text>
18 <input type="digit" value="{{inputValue}}" bindchange="bindKeyInput" /> 18 <input type="digit" value="{{inputValue}}" bindchange="bindKeyInput" />
19 </view> 19 </view>
20 - <view bindtap="showCouponModal" class="couponsBox colorOrange"> 20 + <block wx:if="{{purePhoneNumber}}">
  21 + <view bindtap="showCouponModal" class="couponsBox colorOrange">
21 22
22 - <view class="couponLeft">选择优惠券</view>  
23 - <view class="couponRight">  
24 - <text wx:if="{{discountPrice && discountPrice!='0.00' && couponSwitch}}">-{{discountPrice}}</text>  
25 - <text class="noUse font28r" wx:if="{{couponArr.length == '0'}}">暂无可用</text>  
26 - <text class="noUse font28r" wx:elif="{{coexist == '0' && !couponSwitch}}">不可用</text>  
27 - <view class="more" style="margin-top: 6rpx;"></view> 23 + <view class="couponLeft">选择优惠券</view>
  24 + <view class="couponRight">
  25 + <text wx:if="{{discountPrice && discountPrice!='0.00' && couponSwitch}}">-{{discountPrice}}</text>
  26 + <text class="noUse font28r" wx:if="{{couponArr.length == '0'}}">暂无可用</text>
  27 + <text class="noUse font28r" wx:elif="{{coexist == '0' && !couponSwitch}}">不可用</text>
  28 + <view class="more" style="margin-top: 6rpx;"></view>
  29 + </view>
28 </view> 30 </view>
29 - </view> 31 + </block>
  32 + <block wx:else>
  33 + <button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberFun" class="couponsBox colorOrange">
  34 + <view class="couponLeft font28r">选择优惠券</view>
  35 + <view class="couponRight font28r">
  36 + <text wx:if="{{discountPrice && discountPrice!='0.00' && couponSwitch}}">-{{discountPrice}}</text>
  37 + <text class="noUse font28r" wx:if="{{couponArr.length == '0'}}">暂无可用</text>
  38 + <text class="noUse font28r" wx:elif="{{coexist == '0' && !couponSwitch}}">不可用</text>
  39 + <view class="more" style="margin-top: 6rpx;"></view>
  40 + </view>
  41 + </button>
  42 + </block>
30 <block wx:if="{{purePhoneNumber}}"> 43 <block wx:if="{{purePhoneNumber}}">
31 <view bindtap="showConsumeModal" class="couponsBox colorOrange"> 44 <view bindtap="showConsumeModal" class="couponsBox colorOrange">
32 <view class="couponLeft">使用消费金抵扣</view> 45 <view class="couponLeft">使用消费金抵扣</view>
@@ -152,7 +165,7 @@ @@ -152,7 +165,7 @@
152 <view class="infoBottom font24r">注意:消费金与优惠券{{coexist == '1'?'可':'不可'}}同时使用</view> 165 <view class="infoBottom font24r">注意:消费金与优惠券{{coexist == '1'?'可':'不可'}}同时使用</view>
153 </view> 166 </view>
154 <scroll-view class="couponBox" scroll-y="true"> 167 <scroll-view class="couponBox" scroll-y="true">
155 - <view wx:for="{{couponArr}}" data-aid="{{item.aid}}" class="couponItems {{item.showCpupon == '0' ? 'couponNo' : ''}}"> 168 + <view wx:for="{{couponArr}}" data-key="{{item._key}}" class="couponItems {{item.showCpupon == '0' ? 'couponNo' : ''}}">
156 <view class="itemLeft"> 169 <view class="itemLeft">
157 <view class="priceText" wx:if="{{item.price}}"> 170 <view class="priceText" wx:if="{{item.price}}">
158 <view class="icons font24r">¥</view><text class="priceText">{{item.price}}</text> 171 <view class="icons font24r">¥</view><text class="priceText">{{item.price}}</text>
@@ -163,11 +176,11 @@ @@ -163,11 +176,11 @@
163 <view class="itemRight"> 176 <view class="itemRight">
164 <view class="anameText"> 177 <view class="anameText">
165 <view class="anameInfo"> 178 <view class="anameInfo">
166 - <view class="names font40r">{{item.aname}}</view>  
167 - <view class="discountText1 font20r">{{item.accumulationShow == '1' ? '可' : '不可'}}叠加</view> 179 + <view class="names font40r">{{item.aname}}<text class="discountText1 font20r">{{item.accumulationShow == '1' ? '可' : '不可'}}叠加</text></view>
  180 +
168 </view> 181 </view>
169 </view> 182 </view>
170 - <view wx:if="{{item.endDateStr}}" class="font20r bottomTitle">有效日期:<view class="bottom font20r">{{item.endDateStr}}</view> 183 + <view wx:if="{{item.endDateStr}}" class="font20r bottomTitle"><text>有效日期:</text><view class="bottom font20r">{{item.endDateStr}}</view>
171 </view> 184 </view>
172 <!-- <view class="font20r bottom">{{item.arule.is_same_day=='1'?'领取当日可用':'领取当日不可用'}}</view> 185 <!-- <view class="font20r bottom">{{item.arule.is_same_day=='1'?'领取当日可用':'领取当日不可用'}}</view>
173 <view wx:if="{{item.aexpiration>0}}" class="font20r bottom">领取后{{item.aexpiration}}天内使用</view> 186 <view wx:if="{{item.aexpiration>0}}" class="font20r bottom">领取后{{item.aexpiration}}天内使用</view>
@@ -184,9 +197,9 @@ @@ -184,9 +197,9 @@
184 <view class="rightBox"> 197 <view class="rightBox">
185 <view class="ownNum font20r">拥有{{item.num}}张</view> 198 <view class="ownNum font20r">拥有{{item.num}}张</view>
186 <view class="numBox"> 199 <view class="numBox">
187 - <view class="numBtn {{item.checkedNum == 0 ? 'numBtnDisabled' : ''}}" bindtap="changeCouponNum" data-aid="{{item.aid}}" data-type="minus">-</view>  
188 - <input class="numText" type="number" value="{{item.checkedNum}}" data-aid="{{item.aid}}" disabled="{{item.showCpupon == '0'}}" bindinput="numInputChange" />  
189 - <view class="numBtn {{item.canAdd != '1' ? 'numBtnDisabled' : ''}}" bindtap="changeCouponNum" data-aid="{{item.aid}}" data-type="plus">+</view> 200 + <view class="numBtn {{item.checkedNum == 0 ? 'numBtnDisabled' : ''}}" bindtap="changeCouponNum" data-key="{{item._key}}" data-type="minus">-</view>
  201 + <input class="numText" type="number" value="{{item.checkedNum}}" data-key="{{item._key}}" disabled="{{item.showCpupon == '0'}}" bindinput="numInputChange" />
  202 + <view class="numBtn {{item.canAdd != '1' ? 'numBtnDisabled' : ''}}" bindtap="changeCouponNum" data-key="{{item._key}}" data-type="plus">+</view>
190 </view> 203 </view>
191 </view> 204 </view>
192 </view> 205 </view>
@@ -57,7 +57,7 @@ page { @@ -57,7 +57,7 @@ page {
57 align-items: center; 57 align-items: center;
58 justify-content: space-between; 58 justify-content: space-between;
59 color: #999; 59 color: #999;
60 - margin: 24rpx 0; 60 + line-height: 70rpx;
61 padding: 0; 61 padding: 0;
62 background: transparent; 62 background: transparent;
63 border: none; 63 border: none;
@@ -174,10 +174,13 @@ page { @@ -174,10 +174,13 @@ page {
174 border-radius: 20rpx; 174 border-radius: 20rpx;
175 display: flex; 175 display: flex;
176 padding: 20rpx 10rpx; 176 padding: 20rpx 10rpx;
  177 + box-sizing: border-box;
  178 + overflow: hidden;
177 } 179 }
178 180
179 .itemLeft { 181 .itemLeft {
180 min-width: 21%; 182 min-width: 21%;
  183 + flex-shrink: 0;
181 display: flex; 184 display: flex;
182 align-items: center; 185 align-items: center;
183 flex-direction: column; 186 flex-direction: column;
@@ -270,11 +273,16 @@ page { @@ -270,11 +273,16 @@ page {
270 } 273 }
271 274
272 .bottomTitle text { 275 .bottomTitle text {
  276 + width: max-content;
273 flex-shrink: 0; 277 flex-shrink: 0;
  278 + white-space: nowrap;
274 } 279 }
275 280
276 .bottom { 281 .bottom {
277 font-weight: normal; 282 font-weight: normal;
  283 + width: max-content;
  284 + flex-shrink: 0;
  285 + white-space: nowrap;
278 } 286 }
279 287
280 .priceText { 288 .priceText {
@@ -295,12 +303,21 @@ page { @@ -295,12 +303,21 @@ page {
295 303
296 .itemRight { 304 .itemRight {
297 flex: 1; 305 flex: 1;
  306 + min-width: 0;
  307 + overflow: hidden;
  308 +}
  309 +
  310 +.rightBox {
  311 + min-width: 28%;
  312 + flex-shrink: 0;
  313 + display: flex;
  314 + align-items: center;
  315 + flex-direction: column;
298 } 316 }
299 317
300 .itemRight view { 318 .itemRight view {
301 display: flex; 319 display: flex;
302 line-height: 36rpx; 320 line-height: 36rpx;
303 - flex-shrink:0;  
304 } 321 }
305 322
306 .nodate { 323 .nodate {
@@ -63,6 +63,7 @@ Page({ @@ -63,6 +63,7 @@ Page({
63 consume: options.consume, //当餐免费使用的消费金金额 63 consume: options.consume, //当餐免费使用的消费金金额
64 activity_id: options.activity_id, //当餐免费使用的券ID 64 activity_id: options.activity_id, //当餐免费使用的券ID
65 inputValue: options.inputValue, //当餐免费抵扣前的金额 65 inputValue: options.inputValue, //当餐免费抵扣前的金额
  66 + phone_activity_id: options.phone_activity_id || '',
66 }, 67 },
67 type: options.type, 68 type: options.type,
68 }) 69 })
@@ -457,6 +458,9 @@ Page({ @@ -457,6 +458,9 @@ Page({
457 if (this.data.opt.activity_id) { 458 if (this.data.opt.activity_id) {
458 params.activity_id = this.data.opt.activity_id; 459 params.activity_id = this.data.opt.activity_id;
459 } 460 }
  461 + if (this.data.opt.phone_activity_id) {
  462 + params.phone_activity_id = this.data.opt.phone_activity_id;
  463 + }
460 App.Activity.CreateRechargeBalanceOrder({ 464 App.Activity.CreateRechargeBalanceOrder({
461 ...params 465 ...params
462 }).then(res => { 466 }).then(res => {
@@ -44,6 +44,7 @@ Page({ @@ -44,6 +44,7 @@ Page({
44 consume:options.consume, 44 consume:options.consume,
45 activity_id:options.activity_id, 45 activity_id:options.activity_id,
46 givePrice:options.givePrice, 46 givePrice:options.givePrice,
  47 + phone_activity_id: options.phone_activity_id,
47 } 48 }
48 }) 49 })
49 console.log('onLoad',{...this.data.opt}); 50 console.log('onLoad',{...this.data.opt});
@@ -126,6 +127,7 @@ Page({ @@ -126,6 +127,7 @@ Page({
126 multiple: this.data.opt.multiple, 127 multiple: this.data.opt.multiple,
127 consume: this.data.opt.consume, 128 consume: this.data.opt.consume,
128 activity_id: this.data.opt.activity_id, 129 activity_id: this.data.opt.activity_id,
  130 + phone_activity_id: this.data.opt.phone_activity_id,
129 }, './confirmPayment') 131 }, './confirmPayment')
130 wx.navigateTo({ 132 wx.navigateTo({
131 url 133 url
@@ -15,13 +15,26 @@ Page({ @@ -15,13 +15,26 @@ Page({
15 list:[] 15 list:[]
16 }) 16 })
17 this.init(); 17 this.init();
18 - this.getlist(); 18 + this.getCheckUserHavePhone();
19 }, 19 },
20 - getlist() {  
21 - App.Activity.GetNewRechargeListByOpenid({  
22 - page:this.page,  
23 - size:this.size,  
24 - }).then((res) => { 20 + // 检测用户是否绑定手机号
  21 + getCheckUserHavePhone() {
  22 + App.Wechat.CheckUserHavePhone({
  23 + openid: getApp().openid,
  24 + }).then((json) => {
  25 + if (json.ret == 200) {
  26 + let data = json.data;
  27 + let phone = (data && data.phone) ? data.phone : '';
  28 + this.getlist(phone)
  29 + }
  30 + })
  31 + },
  32 + getlist(phone) {
  33 + let params = {
  34 + openid: getApp().openid,
  35 + }
  36 + if(phone) params.phone = phone
  37 + App.Activity.GetNewRechargeListByOpenid({...params}).then((res) => {
25 if (res.ret == 200) { 38 if (res.ret == 200) {
26 let list=this.data.list; 39 let list=this.data.list;
27 list=list.concat(res.data) 40 list=list.concat(res.data)
@@ -75,11 +75,23 @@ Page({ @@ -75,11 +75,23 @@ Page({
75 user:res.data 75 user:res.data
76 }) 76 })
77 }) 77 })
78 - this.getlist() 78 + this.getCheckUserHavePhone()
79 this.GetCollectionSellerList() 79 this.GetCollectionSellerList()
80 this.getInfo() 80 this.getInfo()
81 this.getUserInfo() 81 this.getUserInfo()
82 }, 82 },
  83 + // 检测用户是否绑定手机号
  84 + getCheckUserHavePhone() {
  85 + App.Wechat.CheckUserHavePhone({
  86 + openid: getApp().openid,
  87 + }).then((json) => {
  88 + if (json.ret == 200) {
  89 + let data = json.data;
  90 + let phone = (data && data.phone) ? data.phone : '';
  91 + this.getlist(phone)
  92 + }
  93 + })
  94 + },
83 // 获取用户昵称、头像 95 // 获取用户昵称、头像
84 getInfo() { 96 getInfo() {
85 App.Wechat.CheckUserHavePhone({ 97 App.Wechat.CheckUserHavePhone({
@@ -129,10 +141,12 @@ Page({ @@ -129,10 +141,12 @@ Page({
129 }) 141 })
130 }, 142 },
131 //获取用户未使用优惠券列表数量 143 //获取用户未使用优惠券列表数量
132 - getlist() {  
133 - App.Activity.GetNewRechargeListByOpenid({  
134 - openid: getApp().openid,  
135 - }).then((res) => { 144 + getlist(phone) {
  145 + let params = {
  146 + openid: getApp().openid,
  147 + }
  148 + if(phone) params.phone = phone
  149 + App.Activity.GetNewRechargeListByOpenid({...params}).then((res) => {
136 if (res.ret == 200) { 150 if (res.ret == 200) {
137 let list = res.data; 151 let list = res.data;
138 list = list.filter(item => { 152 list = list.filter(item => {
@@ -140,6 +140,7 @@ Page({ @@ -140,6 +140,7 @@ Page({
140 lat: reserev.lat, 140 lat: reserev.lat,
141 long: reserev.long, 141 long: reserev.long,
142 is_online_reserve: reserev.is_online_reserve, 142 is_online_reserve: reserev.is_online_reserve,
  143 + image: reserev.seller_image,
143 } 144 }
144 }) 145 })
145 console.log('sellerseller', { 146 console.log('sellerseller', {
@@ -654,10 +655,11 @@ Page({ @@ -654,10 +655,11 @@ Page({
654 sid: this.data.sid, 655 sid: this.data.sid,
655 fromid: getApp().openid 656 fromid: getApp().openid
656 } 657 }
  658 + let img = this.data.seller.image.replace(/^http:/, "https:");
657 return { 659 return {
658 title: '向您推荐' + this.data.seller.sellName + ',快来看看吧!', 660 title: '向您推荐' + this.data.seller.sellName + ',快来看看吧!',
659 path: util.http_build_query(parmdata, '/pages/reserve/shopHome'), 661 path: util.http_build_query(parmdata, '/pages/reserve/shopHome'),
660 - imageUrl: this.data.home.image || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', 662 + imageUrl: img || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
661 } 663 }
662 }, 664 },
663 // 拨打电话 665 // 拨打电话
@@ -35,7 +35,8 @@ @@ -35,7 +35,8 @@
35 "disableUseStrict": false, 35 "disableUseStrict": false,
36 "useCompilerPlugins": false, 36 "useCompilerPlugins": false,
37 "minifyWXML": true, 37 "minifyWXML": true,
38 - "compileHotReLoad": true 38 + "compileHotReLoad": true,
  39 + "ignoreUploadUnusedFiles": true
39 }, 40 },
40 "editorSetting": { 41 "editorSetting": {
41 "tabIndent": "insertSpaces", 42 "tabIndent": "insertSpaces",
@@ -8,14 +8,189 @@ @@ -8,14 +8,189 @@
8 { 8 {
9 "name": "免费券付费券付款页", 9 "name": "免费券付费券付款页",
10 "pathName": "pack-activity/pack/buyFreeCoupon", 10 "pathName": "pack-activity/pack/buyFreeCoupon",
11 - "query": "sid=17948", 11 + "query": "sid=4352",
12 "launchMode": "default", 12 "launchMode": "default",
13 "scene": null 13 "scene": null
14 }, 14 },
15 { 15 {
16 "name": "4352-----新邀请函入口页", 16 "name": "4352-----新邀请函入口页",
17 "pathName": "pages/customer/detail_owner_invitation_new", 17 "pathName": "pages/customer/detail_owner_invitation_new",
18 - "query": "id=1460829&uid=27201&hasSellerShare=1&paymentId=", 18 + "query": "id=3206045&hasInvitation=1&hasSellerShare=&uid=7035&fromid=oB-xJ5NGdgXHM0Pdsq2kAf7z-n9k",
  19 + "launchMode": "default",
  20 + "scene": null
  21 + },
  22 + {
  23 + "name": "测试-----新邀请函入口页",
  24 + "pathName": "pages/customer/detail_owner_invitation_new",
  25 + "query": "id=3163225&hasInvitation=1&hasSellerShare=1&uid=",
  26 + "launchMode": "default",
  27 + "scene": null
  28 + },
  29 + {
  30 + "name": "免费券详情页",
  31 + "pathName": "pack-activity/pack/receiveCoupon",
  32 + "query": "id=1450&types=3&name=22&sid=4352&oid=&StyleType=",
  33 + "launchMode": "default",
  34 + "scene": null
  35 + },
  36 + {
  37 + "name": "预订本",
  38 + "pathName": "pack-book/pages/reservation/reservation",
  39 + "query": "manager_id=23707&seller_openid=oGefL4sU0895yaX4x8mZsPJYz-UM&seller_id=4352",
  40 + "launchMode": "default",
  41 + "scene": null
  42 + },
  43 + {
  44 + "name": "pages/customer/detail_invitation",
  45 + "pathName": "pages/customer/detail_invitation",
  46 + "query": "",
  47 + "launchMode": "default",
  48 + "scene": null
  49 + },
  50 + {
  51 + "name": "pages/customer/index",
  52 + "pathName": "pages/customer/index",
  53 + "query": "id=2820926&fromid=1111&hasInvitation=1",
  54 + "launchMode": "default",
  55 + "scene": 1044
  56 + },
  57 + {
  58 + "name": "商家详情",
  59 + "pathName": "pages/reserve/shopHome",
  60 + "query": "sid=17948",
  61 + "launchMode": "default",
  62 + "scene": null
  63 + },
  64 + {
  65 + "name": "我的页面",
  66 + "pathName": "pages/me/index",
  67 + "query": "",
  68 + "launchMode": "default",
  69 + "scene": null
  70 + },
  71 + {
  72 + "name": "店铺套餐",
  73 + "pathName": "pack-cookbook/pages/comboList",
  74 + "query": "sid=4352&uid=7035",
  75 + "launchMode": "default",
  76 + "scene": null
  77 + },
  78 + {
  79 + "name": "支付成功",
  80 + "pathName": "pack-activity/pack/paySuccess",
  81 + "query": "totalPrice=0&totalConsumePrice=0",
  82 + "launchMode": "default",
  83 + "scene": null
  84 + },
  85 + {
  86 + "name": "商家入驻",
  87 + "pathName": "pages/customer/joinSeller",
  88 + "query": "",
  89 + "launchMode": "default",
  90 + "scene": null
  91 + },
  92 + {
  93 + "name": "我的余额页面",
  94 + "pathName": "pages/me/myBalance",
  95 + "query": "sellerid=17948",
  96 + "launchMode": "default",
  97 + "scene": null
  98 + },
  99 + {
  100 + "name": "领取消费金",
  101 + "pathName": "pack-activity/pack/getConsume",
  102 + "query": "sid=4352&price=10.20",
  103 + "launchMode": "default",
  104 + "scene": null
  105 + },
  106 + {
  107 + "name": "点餐完成页面",
  108 + "pathName": "pack-cookbook/pages/success_new",
  109 + "query": "type=1&sellerName=长安大排档&rid=2363547&oid=25851&sid=4352&hasSuccess=1",
  110 + "launchMode": "default",
  111 + "scene": null
  112 + },
  113 + {
  114 + "name": "登陆",
  115 + "pathName": "pages/customer/login",
  116 + "query": "",
  117 + "launchMode": "default",
  118 + "scene": null
  119 + },
  120 + {
  121 + "name": "意见反馈",
  122 + "pathName": "pages/pinglun/createOpinion",
  123 + "query": "oid=392094&sellid=4352&sellName=14&types=1",
  124 + "launchMode": "default",
  125 + "scene": null
  126 + },
  127 + {
  128 + "name": "pages/reserve/submit",
  129 + "pathName": "pages/reserve/submit",
  130 + "query": "",
  131 + "launchMode": "default",
  132 + "scene": null
  133 + },
  134 + {
  135 + "name": "运营超时预订",
  136 + "pathName": "pages/customer/index",
  137 + "query": "act=tobook&seller_id=4352&seller_openid=oGefL4sU0895yaX4x8mZsPJYz-UM&sellerOpenid=oGefL4sU0895yaX4x8mZsPJYz-UM&manager_id=&rid=1877529",
  138 + "launchMode": "default",
  139 + "scene": null
  140 + },
  141 + {
  142 + "name": "变更预订",
  143 + "pathName": "pack-book/pages/reservation/alterReservation",
  144 + "query": "id=1864634",
  145 + "launchMode": "default",
  146 + "scene": null
  147 + },
  148 + {
  149 + "name": "通知页",
  150 + "pathName": "pack-book/pages/reservation/noticePage",
  151 + "query": "id=1856053&isMany=0",
  152 + "launchMode": "default",
  153 + "scene": null
  154 + },
  155 + {
  156 + "name": "添加核餐",
  157 + "pathName": "pack-book/pages/reservation/addCheckDining",
  158 + "query": "id=1849266",
  159 + "launchMode": "default",
  160 + "scene": null
  161 + },
  162 + {
  163 + "name": "添加订金",
  164 + "pathName": "pack-book/pages/reservation/addDeposit",
  165 + "query": "id=1849266",
  166 + "launchMode": "default",
  167 + "scene": null
  168 + },
  169 + {
  170 + "name": "预订详情",
  171 + "pathName": "pack-book/pages/reservation/bookDetails",
  172 + "query": "id=1849266&date=2025-09-03&date1=%E4%B8%83%E6%9C%88%E5%8D%81%E4%BA%8C&week=%E6%98%9F%E6%9C%9F%E4%B8%89&threeText=%E4%BB%8A%E5%A4%A9",
  173 + "launchMode": "default",
  174 + "scene": null
  175 + },
  176 + {
  177 + "name": "商家有礼",
  178 + "pathName": "pages/reserve/sellerGift",
  179 + "query": "id=1824183&form=1",
  180 + "launchMode": "default",
  181 + "scene": null
  182 + },
  183 + {
  184 + "name": "订座",
  185 + "pathName": "pack-book/pages/book/b_addnew",
  186 + "query": "",
  187 + "launchMode": "default",
  188 + "scene": null
  189 + },
  190 + {
  191 + "name": "pack-book/pages/book/b_index",
  192 + "pathName": "pack-book/pages/book/b_index",
  193 + "query": "seller_id=4352&seller_openid=oGefL4sU0895yaX4x8mZsPJYz-UM&manager_id=24221",
19 "launchMode": "default", 194 "launchMode": "default",
20 "scene": null 195 "scene": null
21 }, 196 },
@@ -48,20 +223,6 @@ @@ -48,20 +223,6 @@
48 "scene": null 223 "scene": null
49 }, 224 },
50 { 225 {
51 - "name": "免费券详情页",  
52 - "pathName": "pack-activity/pack/receiveCoupon",  
53 - "query": "id=1173&types=3&name=22&sid=4352&oid=&StyleType=",  
54 - "launchMode": "default",  
55 - "scene": null  
56 - },  
57 - {  
58 - "name": "商家详情",  
59 - "pathName": "pages/reserve/shopHome",  
60 - "query": "sid=4352",  
61 - "launchMode": "default",  
62 - "scene": null  
63 - },  
64 - {  
65 "name": "付费券券详情", 226 "name": "付费券券详情",
66 "pathName": "pack-activity/pack/buyCoupon", 227 "pathName": "pack-activity/pack/buyCoupon",
67 "query": "id=394&name=14&sid=4352&oid=&types=3", 228 "query": "id=394&name=14&sid=4352&oid=&types=3",
@@ -69,13 +230,6 @@ @@ -69,13 +230,6 @@
69 "scene": null 230 "scene": null
70 }, 231 },
71 { 232 {
72 - "name": "测试-----新邀请函入口页",  
73 - "pathName": "pages/customer/detail_owner_invitation_new",  
74 - "query": "id=1438440&onlineReserve=1&hasInvitation=1&paymentId=&tplid=1&hasSellerShare=1&isDeposit=1&bookType=2",  
75 - "launchMode": "default",  
76 - "scene": null  
77 - },  
78 - {  
79 "name": "旧首页", 233 "name": "旧首页",
80 "pathName": "pages/reserve/index", 234 "pathName": "pages/reserve/index",
81 "query": "a=b&c=d", 235 "query": "a=b&c=d",
@@ -111,13 +265,6 @@ @@ -111,13 +265,6 @@
111 "scene": null 265 "scene": null
112 }, 266 },
113 { 267 {
114 - "name": "点餐完成页面",  
115 - "pathName": "pack-cookbook/pages/success_new",  
116 - "query": "type=1&sellerName=长安大排档&rid=1342185&oid=16907&sid=4352&hasSuccess=1",  
117 - "launchMode": "default",  
118 - "scene": null  
119 - },  
120 - {  
121 "name": "收藏页", 268 "name": "收藏页",
122 "pathName": "pages/me/follow", 269 "pathName": "pages/me/follow",
123 "query": "", 270 "query": "",
@@ -240,17 +387,6 @@ @@ -240,17 +387,6 @@
240 "query": "" 387 "query": ""
241 }, 388 },
242 { 389 {
243 - "name": "pages/customer/index",  
244 - "pathName": "pages/customer/index",  
245 - "query": "id=58295&fromid=1111&hasInvitation=1",  
246 - "scene": 1044,  
247 - "shareInfo": {  
248 - "groupName": "测试模拟群1",  
249 - "shareName": "8DEbIRpK4pa9mH_QY2vU4ZUKYPuI97WoQ4BQoFej-Q8@cr4dev",  
250 - "shareKey": "PZhnqMlY2TnRuHhATyGeSamVmBQUDXXr_WtjRSddeeFK17UAiOP-HNOdhxiEN7PFub5S1DjAeUl0IXOdW-VDqg~~"  
251 - }  
252 - },  
253 - {  
254 "name": "邀请设置页 pages/customer/invite", 390 "name": "邀请设置页 pages/customer/invite",
255 "pathName": "pages/customer/invite", 391 "pathName": "pages/customer/invite",
256 "query": "id=64" 392 "query": "id=64"
@@ -771,13 +907,6 @@ @@ -771,13 +907,6 @@
771 "scene": null 907 "scene": null
772 }, 908 },
773 { 909 {
774 - "name": "意见反馈",  
775 - "pathName": "pages/pinglun/createOpinion",  
776 - "query": "oid=392094&sellid=4352&sellName=14&types=1",  
777 - "launchMode": "default",  
778 - "scene": null  
779 - },  
780 - {  
781 "name": "", 910 "name": "",
782 "pathName": "pages/me/wananchi", 911 "pathName": "pages/me/wananchi",
783 "query": "type=1&oid=392864&sid=8", 912 "query": "type=1&oid=392864&sid=8",
@@ -793,13 +922,6 @@ @@ -793,13 +922,6 @@
793 }, 922 },
794 { 923 {
795 "name": "", 924 "name": "",
796 - "pathName": "pages/customer/joinSeller",  
797 - "query": "",  
798 - "launchMode": "default",  
799 - "scene": null  
800 - },  
801 - {  
802 - "name": "",  
803 "pathName": "pages/customer/collectSeller", 925 "pathName": "pages/customer/collectSeller",
804 "query": "", 926 "query": "",
805 "launchMode": "default", 927 "launchMode": "default",
@@ -825,18 +947,11 @@ @@ -825,18 +947,11 @@
825 "query": "", 947 "query": "",
826 "launchMode": "default", 948 "launchMode": "default",
827 "scene": null 949 "scene": null
828 - },  
829 - {  
830 - "name": "商家有礼",  
831 - "pathName": "pages/reserve/sellerGift",  
832 - "query": "id=928221",  
833 - "launchMode": "default",  
834 - "scene": null  
835 } 950 }
836 ] 951 ]
837 } 952 }
838 }, 953 },
839 "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", 954 "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
840 "projectname": "%E5%91%A8%E5%88%B0%E5%AE%89%E6%8E%92", 955 "projectname": "%E5%91%A8%E5%88%B0%E5%AE%89%E6%8E%92",
841 - "libVersion": "3.7.3" 956 + "libVersion": "3.10.2"
842 } 957 }
@@ -952,4 +952,11 @@ export default { @@ -952,4 +952,11 @@ export default {
952 'App.Activity.GetBalanceListByOpenid':{ 952 'App.Activity.GetBalanceListByOpenid':{
953 hasDisabledRMT:true, 953 hasDisabledRMT:true,
954 }, 954 },
  955 +
  956 + //根据授权手机号获取预发优惠券
  957 + 'App.Activity.GetActivityListByPhone':{
  958 + hasDisabledRMT:true,
  959 + },
  960 +
  961 +
955 } 962 }