|
|
|
// pages/pinglun/createOpinion.js
|
|
|
|
import util from '../../utils/util';
|
|
|
|
import App from '../../utils/api'
|
|
|
|
import RS from '../../utils/reserveStatus'
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -9,21 +10,104 @@ Page({ |
|
|
|
data: {
|
|
|
|
options: {},
|
|
|
|
filesHttps: [],
|
|
|
|
dateSmart:'',
|
|
|
|
tablesText:'',
|
|
|
|
detail:{},
|
|
|
|
tableNum:'',
|
|
|
|
cusdem:'',
|
|
|
|
coupon:'',
|
|
|
|
couponId:'',
|
|
|
|
price:'',
|
|
|
|
coupon:'',
|
|
|
|
},
|
|
|
|
text: '',
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
|
|
|
let data = options
|
|
|
|
data.record = util.determine(options.record)
|
|
|
|
this.setData({
|
|
|
|
options: data
|
|
|
|
})
|
|
|
|
console.log('options', {
|
|
|
|
...data
|
|
|
|
});
|
|
|
|
if(options){
|
|
|
|
this.setData({
|
|
|
|
options
|
|
|
|
})
|
|
|
|
console.log('options', {
|
|
|
|
...options
|
|
|
|
});
|
|
|
|
this.getDetail()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getDetail() {
|
|
|
|
App.Reserve.Detail({
|
|
|
|
openid: getApp().openid,
|
|
|
|
rid: this.data.options.oid
|
|
|
|
}).then(res => {
|
|
|
|
let tablesText = '', //桌子信息
|
|
|
|
tableNum =0;
|
|
|
|
res.data.tables.forEach((t,i) => {
|
|
|
|
tableNum+=t.table_pnum*1
|
|
|
|
tablesText+=t.rname+t.name+(i==(res.data.tables.length-1)?'':'、');
|
|
|
|
})
|
|
|
|
let reserev = RS.reserve(res.data)
|
|
|
|
let dateSmart
|
|
|
|
if (res.data.type == 1) {
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, 'YYYY/MM/DD 星期WW')
|
|
|
|
if (res.data.is_set_ddate == 1) {
|
|
|
|
dateSmart += ' ' + util.unixtoTime(reserev.ddate, 'YYYY/MM/DD 星期WW')
|
|
|
|
} else {
|
|
|
|
dateSmart += ' ' + reserev.soltName
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, 'YYYY/MM/DD 星期WW HH:II')
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
dateSmart,
|
|
|
|
tablesText,
|
|
|
|
tableNum:res.data.actual_pum?res.data.actual_pum:tableNum,
|
|
|
|
cusdem:res.data.cusdem,
|
|
|
|
})
|
|
|
|
setTimeout(() => {
|
|
|
|
this.getSellerTemplateConfFun(reserev.sid);
|
|
|
|
}, 0);
|
|
|
|
}).catch(res=>{
|
|
|
|
console.log(res,'详情请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getSellerTemplateConfFun(sid) {
|
|
|
|
console.log('sidsidsidsid',sid);
|
|
|
|
App.Seller.GetSellerTemplateConf({
|
|
|
|
sid
|
|
|
|
}).then(res => {
|
|
|
|
let data=res.data
|
|
|
|
let marketing,is_comments;
|
|
|
|
marketing = util.determine(data.marketing);
|
|
|
|
if(marketing){
|
|
|
|
is_comments = marketing.is_comments?marketing.is_comments:'';
|
|
|
|
marketing.coupon_data_comments=(is_comments=='1' && marketing.is_comments_coupon=='1')?util.determine(marketing.coupon_data_comments):'';
|
|
|
|
}
|
|
|
|
|
|
|
|
let coupon_data_comments=marketing.coupon_data_comments;//赠送优惠券的列表
|
|
|
|
let coupon=marketing.is_comments_coupon;//评价赠送优惠券
|
|
|
|
let couponId,price,use;
|
|
|
|
if(coupon && coupon_data_comments && coupon_data_comments.length>0){
|
|
|
|
let obj=coupon_data_comments[0];
|
|
|
|
console.log('填写意见获取的券的信息',obj);
|
|
|
|
couponId=obj.id;
|
|
|
|
price=obj.price;
|
|
|
|
use=JSON.stringify(obj.use)
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
coupon:coupon || '',
|
|
|
|
couponId:couponId || '',
|
|
|
|
price:price || '',
|
|
|
|
use:use || '',
|
|
|
|
})
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
marketing,
|
|
|
|
})
|
|
|
|
}).catch(res=>{
|
|
|
|
console.log('GetSellerTemplateConf请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取上传的图片或者视频
|
|
|
|
tpupload(e) {
|
|
|
|
this.setData({
|
|
...
|
...
|
@@ -68,22 +152,21 @@ Page({ |
|
|
|
let url = ''
|
|
|
|
let options = this.data.options
|
|
|
|
// 有券
|
|
|
|
if (this.options.coupon == '1') {
|
|
|
|
if (this.data.coupon == '1') {
|
|
|
|
url = util.http_build_query({
|
|
|
|
sellerName: options.sellerName,
|
|
|
|
coupon: options.coupon,
|
|
|
|
couponId: options.couponId,
|
|
|
|
coupon: options.coupon,
|
|
|
|
price: options.price,
|
|
|
|
use: options.use,
|
|
|
|
coupon: this.data.coupon,
|
|
|
|
couponId: this.data.couponId,
|
|
|
|
price: this.data.price,
|
|
|
|
use: this.data.use,
|
|
|
|
oid: options.oid,
|
|
|
|
sid: options.sellerid,
|
|
|
|
}, './opinionSuccess')
|
|
|
|
} else { //没券
|
|
|
|
url = util.http_build_query({
|
|
|
|
sellerName: options.sellerName,
|
|
|
|
coupon: options.coupon, //1有券 2没有券
|
|
|
|
couponId: options.couponId || '',
|
|
|
|
coupon: this.data.coupon, //1有券 2没有券
|
|
|
|
couponId: this.data.couponId || '',
|
|
|
|
}, './opinionSuccess')
|
|
|
|
}
|
|
|
|
wx.redirectTo({
|
...
|
...
|
|