Showing
4 changed files
with
104 additions
and
45 deletions
| @@ -44,7 +44,6 @@ Page({ | @@ -44,7 +44,6 @@ Page({ | ||
| 44 | swich_phone:'0', | 44 | swich_phone:'0', |
| 45 | is_comments:'0', | 45 | is_comments:'0', |
| 46 | is_user_comments:false, | 46 | is_user_comments:false, |
| 47 | - cusdem:'',//备注 传参给意见反馈 | ||
| 48 | }, | 47 | }, |
| 49 | /** | 48 | /** |
| 50 | * 生命周期函数--监听页面加载 | 49 | * 生命周期函数--监听页面加载 |
| @@ -82,32 +81,11 @@ Page({ | @@ -82,32 +81,11 @@ Page({ | ||
| 82 | }, | 81 | }, |
| 83 | // 去评价 | 82 | // 去评价 |
| 84 | evaluateFun(){ | 83 | evaluateFun(){ |
| 85 | - let coupon_data_comments=this.data.marketing.coupon_data_comments;//赠送优惠券的列表 | ||
| 86 | - let coupon=this.data.marketing.is_comments_coupon;//评价赠送优惠券 | ||
| 87 | - let couponId,price,use; | ||
| 88 | - if(coupon && coupon_data_comments && coupon_data_comments.length>0){ | ||
| 89 | - let obj=coupon_data_comments[0]; | ||
| 90 | - console.log('填写意见获取的券的信息',obj); | ||
| 91 | - couponId=obj.id; | ||
| 92 | - price=obj.price; | ||
| 93 | - use=JSON.stringify(obj.use) | ||
| 94 | - } | ||
| 95 | - let record={ | ||
| 96 | - date:this.data.seller.date, | ||
| 97 | - tablesText:this.data.seller.tablesText, | ||
| 98 | - tableNum:this.data.detail.actual_pum?this.data.detail.actual_pum:this.data.tableNum, | ||
| 99 | - cusdem:this.data.cusdem, | ||
| 100 | - } | ||
| 101 | let url=util.http_build_query({ | 84 | let url=util.http_build_query({ |
| 102 | sellerName:this.data.seller.name, | 85 | sellerName:this.data.seller.name, |
| 103 | - record:JSON.stringify(record), | ||
| 104 | sellerid:this.data.seller.sid, | 86 | sellerid:this.data.seller.sid, |
| 105 | oid:this.data.detail.id, | 87 | oid:this.data.detail.id, |
| 106 | types:'1', | 88 | types:'1', |
| 107 | - coupon:coupon || '', | ||
| 108 | - couponId:couponId || '', | ||
| 109 | - price:price || '', | ||
| 110 | - use:use || '', | ||
| 111 | },'/pages/pinglun/createOpinion') | 89 | },'/pages/pinglun/createOpinion') |
| 112 | wx.navigateTo({ | 90 | wx.navigateTo({ |
| 113 | url | 91 | url |
| @@ -189,7 +167,6 @@ Page({ | @@ -189,7 +167,6 @@ Page({ | ||
| 189 | detail: this.formatDatail(reserev, dateSmart), | 167 | detail: this.formatDatail(reserev, dateSmart), |
| 190 | tableNum, | 168 | tableNum, |
| 191 | is_user_comments:res.data.is_user_comments, | 169 | is_user_comments:res.data.is_user_comments, |
| 192 | - cusdem:res.data.cusdem, | ||
| 193 | seller: { | 170 | seller: { |
| 194 | name: reserev.seller.sellername, | 171 | name: reserev.seller.sellername, |
| 195 | sid:reserev.sid, | 172 | sid:reserev.sid, |
| @@ -323,7 +300,6 @@ Page({ | @@ -323,7 +300,6 @@ Page({ | ||
| 323 | if(marketing){ | 300 | if(marketing){ |
| 324 | is_comments = marketing.is_comments?marketing.is_comments:''; | 301 | is_comments = marketing.is_comments?marketing.is_comments:''; |
| 325 | coupon=marketing.coupon_data?util.determine(marketing.coupon_data):''; | 302 | coupon=marketing.coupon_data?util.determine(marketing.coupon_data):''; |
| 326 | - marketing.coupon_data_comments=(is_comments=='1' && marketing.is_comments_coupon=='1')?util.determine(marketing.coupon_data_comments):''; | ||
| 327 | } | 303 | } |
| 328 | // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 | 304 | // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 |
| 329 | if(coupon && util.getType(coupon)=='object'){ | 305 | if(coupon && util.getType(coupon)=='object'){ |
| @@ -97,7 +97,7 @@ | @@ -97,7 +97,7 @@ | ||
| 97 | </block> | 97 | </block> |
| 98 | </view> | 98 | </view> |
| 99 | <view wx:if="{{is_comments=='1' && !is_user_comments}}" class="evaluateBox" bindtap="evaluateFun"> | 99 | <view wx:if="{{is_comments=='1' && !is_user_comments}}" class="evaluateBox" bindtap="evaluateFun"> |
| 100 | - <text wx:if="{{is_comments=='1' && marketing.is_comments_coupon!='1'}}">{{'想吐槽?戳这里填写意见!-->'}}</text> | 100 | + <text wx:if="{{is_comments=='1' && marketing.is_comments_coupon!='1'}}">想吐槽?戳这里填写意见!--></text> |
| 101 | <text wx:if="{{marketing.is_comments_coupon=='1'}}">想吐槽?戳这里填写意见反馈赢好礼!</text> | 101 | <text wx:if="{{marketing.is_comments_coupon=='1'}}">想吐槽?戳这里填写意见反馈赢好礼!</text> |
| 102 | <image src="https://qn.colorcun.com/evaluate.png" mode=""/> | 102 | <image src="https://qn.colorcun.com/evaluate.png" mode=""/> |
| 103 | </view> | 103 | </view> |
| 1 | // pages/pinglun/createOpinion.js | 1 | // pages/pinglun/createOpinion.js |
| 2 | import util from '../../utils/util'; | 2 | import util from '../../utils/util'; |
| 3 | import App from '../../utils/api' | 3 | import App from '../../utils/api' |
| 4 | +import RS from '../../utils/reserveStatus' | ||
| 4 | Page({ | 5 | Page({ |
| 5 | 6 | ||
| 6 | /** | 7 | /** |
| @@ -9,21 +10,104 @@ Page({ | @@ -9,21 +10,104 @@ Page({ | ||
| 9 | data: { | 10 | data: { |
| 10 | options: {}, | 11 | options: {}, |
| 11 | filesHttps: [], | 12 | filesHttps: [], |
| 13 | + dateSmart:'', | ||
| 14 | + tablesText:'', | ||
| 15 | + detail:{}, | ||
| 16 | + tableNum:'', | ||
| 17 | + cusdem:'', | ||
| 18 | + coupon:'', | ||
| 19 | + couponId:'', | ||
| 20 | + price:'', | ||
| 21 | + coupon:'', | ||
| 12 | }, | 22 | }, |
| 13 | text: '', | 23 | text: '', |
| 14 | /** | 24 | /** |
| 15 | * 生命周期函数--监听页面加载 | 25 | * 生命周期函数--监听页面加载 |
| 16 | */ | 26 | */ |
| 17 | onLoad(options) { | 27 | onLoad(options) { |
| 18 | - let data = options | ||
| 19 | - data.record = util.determine(options.record) | ||
| 20 | - this.setData({ | ||
| 21 | - options: data | ||
| 22 | - }) | ||
| 23 | - console.log('options', { | ||
| 24 | - ...data | ||
| 25 | - }); | 28 | + if(options){ |
| 29 | + this.setData({ | ||
| 30 | + options | ||
| 31 | + }) | ||
| 32 | + console.log('options', { | ||
| 33 | + ...options | ||
| 34 | + }); | ||
| 35 | + this.getDetail() | ||
| 36 | + } | ||
| 26 | }, | 37 | }, |
| 38 | + getDetail() { | ||
| 39 | + App.Reserve.Detail({ | ||
| 40 | + openid: getApp().openid, | ||
| 41 | + rid: this.data.options.oid | ||
| 42 | + }).then(res => { | ||
| 43 | + let tablesText = '', //桌子信息 | ||
| 44 | + tableNum =0; | ||
| 45 | + res.data.tables.forEach((t,i) => { | ||
| 46 | + tableNum+=t.table_pnum*1 | ||
| 47 | + tablesText+=t.rname+t.name+(i==(res.data.tables.length-1)?'':'、'); | ||
| 48 | + }) | ||
| 49 | + let reserev = RS.reserve(res.data) | ||
| 50 | + let dateSmart | ||
| 51 | + if (res.data.type == 1) { | ||
| 52 | + dateSmart = util.unixtoTime(reserev.ddate, 'YYYY/MM/DD 星期WW') | ||
| 53 | + if (res.data.is_set_ddate == 1) { | ||
| 54 | + dateSmart += ' ' + util.unixtoTime(reserev.ddate, 'YYYY/MM/DD 星期WW') | ||
| 55 | + } else { | ||
| 56 | + dateSmart += ' ' + reserev.soltName | ||
| 57 | + } | ||
| 58 | + } else { | ||
| 59 | + dateSmart = util.unixtoTime(reserev.ddate, 'YYYY/MM/DD 星期WW HH:II') | ||
| 60 | + } | ||
| 61 | + this.setData({ | ||
| 62 | + dateSmart, | ||
| 63 | + tablesText, | ||
| 64 | + tableNum:res.data.actual_pum?res.data.actual_pum:tableNum, | ||
| 65 | + cusdem:res.data.cusdem, | ||
| 66 | + }) | ||
| 67 | + setTimeout(() => { | ||
| 68 | + this.getSellerTemplateConfFun(reserev.sid); | ||
| 69 | + }, 0); | ||
| 70 | + }).catch(res=>{ | ||
| 71 | + console.log(res,'详情请求失败'); | ||
| 72 | + }) | ||
| 73 | + }, | ||
| 74 | + getSellerTemplateConfFun(sid) { | ||
| 75 | + console.log('sidsidsidsid',sid); | ||
| 76 | + App.Seller.GetSellerTemplateConf({ | ||
| 77 | + sid | ||
| 78 | + }).then(res => { | ||
| 79 | + let data=res.data | ||
| 80 | + let marketing,is_comments; | ||
| 81 | + marketing = util.determine(data.marketing); | ||
| 82 | + if(marketing){ | ||
| 83 | + is_comments = marketing.is_comments?marketing.is_comments:''; | ||
| 84 | + marketing.coupon_data_comments=(is_comments=='1' && marketing.is_comments_coupon=='1')?util.determine(marketing.coupon_data_comments):''; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + let coupon_data_comments=marketing.coupon_data_comments;//赠送优惠券的列表 | ||
| 88 | + let coupon=marketing.is_comments_coupon;//评价赠送优惠券 | ||
| 89 | + let couponId,price,use; | ||
| 90 | + if(coupon && coupon_data_comments && coupon_data_comments.length>0){ | ||
| 91 | + let obj=coupon_data_comments[0]; | ||
| 92 | + console.log('填写意见获取的券的信息',obj); | ||
| 93 | + couponId=obj.id; | ||
| 94 | + price=obj.price; | ||
| 95 | + use=JSON.stringify(obj.use) | ||
| 96 | + } | ||
| 97 | + this.setData({ | ||
| 98 | + coupon:coupon || '', | ||
| 99 | + couponId:couponId || '', | ||
| 100 | + price:price || '', | ||
| 101 | + use:use || '', | ||
| 102 | + }) | ||
| 103 | + | ||
| 104 | + this.setData({ | ||
| 105 | + marketing, | ||
| 106 | + }) | ||
| 107 | + }).catch(res=>{ | ||
| 108 | + console.log('GetSellerTemplateConf请求失败'); | ||
| 109 | + }) | ||
| 110 | + }, | ||
| 27 | // 获取上传的图片或者视频 | 111 | // 获取上传的图片或者视频 |
| 28 | tpupload(e) { | 112 | tpupload(e) { |
| 29 | this.setData({ | 113 | this.setData({ |
| @@ -68,22 +152,21 @@ Page({ | @@ -68,22 +152,21 @@ Page({ | ||
| 68 | let url = '' | 152 | let url = '' |
| 69 | let options = this.data.options | 153 | let options = this.data.options |
| 70 | // 有券 | 154 | // 有券 |
| 71 | - if (this.options.coupon == '1') { | 155 | + if (this.data.coupon == '1') { |
| 72 | url = util.http_build_query({ | 156 | url = util.http_build_query({ |
| 73 | sellerName: options.sellerName, | 157 | sellerName: options.sellerName, |
| 74 | - coupon: options.coupon, | ||
| 75 | - couponId: options.couponId, | ||
| 76 | - coupon: options.coupon, | ||
| 77 | - price: options.price, | ||
| 78 | - use: options.use, | 158 | + coupon: this.data.coupon, |
| 159 | + couponId: this.data.couponId, | ||
| 160 | + price: this.data.price, | ||
| 161 | + use: this.data.use, | ||
| 79 | oid: options.oid, | 162 | oid: options.oid, |
| 80 | sid: options.sellerid, | 163 | sid: options.sellerid, |
| 81 | }, './opinionSuccess') | 164 | }, './opinionSuccess') |
| 82 | } else { //没券 | 165 | } else { //没券 |
| 83 | url = util.http_build_query({ | 166 | url = util.http_build_query({ |
| 84 | sellerName: options.sellerName, | 167 | sellerName: options.sellerName, |
| 85 | - coupon: options.coupon, //1有券 2没有券 | ||
| 86 | - couponId: options.couponId || '', | 168 | + coupon: this.data.coupon, //1有券 2没有券 |
| 169 | + couponId: this.data.couponId || '', | ||
| 87 | }, './opinionSuccess') | 170 | }, './opinionSuccess') |
| 88 | } | 171 | } |
| 89 | wx.redirectTo({ | 172 | wx.redirectTo({ |
| @@ -3,19 +3,19 @@ | @@ -3,19 +3,19 @@ | ||
| 3 | <view class="box"> | 3 | <view class="box"> |
| 4 | <view class="info"> | 4 | <view class="info"> |
| 5 | <view class="texts font28r">就餐时间:</view> | 5 | <view class="texts font28r">就餐时间:</view> |
| 6 | - <view class="texts_right font28r">{{options.record.date}}</view> | 6 | + <view class="texts_right font28r">{{dateSmart}}</view> |
| 7 | </view> | 7 | </view> |
| 8 | <view class="info"> | 8 | <view class="info"> |
| 9 | <view class="texts font28r">桌位台号:</view> | 9 | <view class="texts font28r">桌位台号:</view> |
| 10 | - <view class="texts_right font28r">{{options.record.tablesText}}</view> | 10 | + <view class="texts_right font28r">{{tablesText}}</view> |
| 11 | </view> | 11 | </view> |
| 12 | <view class="info"> | 12 | <view class="info"> |
| 13 | <view class="texts font28r">就餐人数:</view> | 13 | <view class="texts font28r">就餐人数:</view> |
| 14 | - <view class="texts_right font28r">{{options.record.tableNum}}</view> | 14 | + <view class="texts_right font28r">{{tableNum}}</view> |
| 15 | </view> | 15 | </view> |
| 16 | <view class="info"> | 16 | <view class="info"> |
| 17 | <view class="texts font28r">备注信息:</view> | 17 | <view class="texts font28r">备注信息:</view> |
| 18 | - <view wx:if="{{options.record.cusdem}}" class="texts_right font28r">{{options.record.cusdem}}</view> | 18 | + <view wx:if="{{cusdem}}" class="texts_right font28r">{{cusdem}}</view> |
| 19 | </view> | 19 | </view> |
| 20 | </view> | 20 | </view> |
| 21 | <view class="main"> | 21 | <view class="main"> |
-
Please register or login to post a comment