Commit 5dc2fb0e4124f57e17f59ffa86f71fac50e6bc93

Authored by vking
1 parent 3caf02ce

taocan-share-pinglun

@@ -42,7 +42,9 @@ @@ -42,7 +42,9 @@
42 "pages/taocan/index", 42 "pages/taocan/index",
43 "pages/taocan/order", 43 "pages/taocan/order",
44 "pages/taocan/orderHis", 44 "pages/taocan/orderHis",
45 - "pages/pinglun/create" 45 + "pages/pinglun/create",
  46 + "pages/pinglun/success",
  47 + "pages/pinglun/mylist"
46 ], 48 ],
47 "subpackages": [ 49 "subpackages": [
48 { 50 {
@@ -173,7 +175,7 @@ @@ -173,7 +175,7 @@
173 }, 175 },
174 "usingComponents": { 176 "usingComponents": {
175 "layout": "/components/layout", 177 "layout": "/components/layout",
176 - "page":"/components/2.0/common/page" 178 + "page": "/components/2.0/common/page"
177 }, 179 },
178 "debug": true, 180 "debug": true,
179 "sitemapLocation": "sitemap.json" 181 "sitemapLocation": "sitemap.json"
1 // pages/pinglun/create.js 1 // pages/pinglun/create.js
2 import App from '../../utils/api' 2 import App from '../../utils/api'
3 import util from '../../utils/util' 3 import util from '../../utils/util'
  4 +import DA from '../../pages/reserve/data';
4 Page({ 5 Page({
5 6
6 /** 7 /**
@@ -54,10 +55,23 @@ Page({ @@ -54,10 +55,23 @@ Page({
54 */ 55 */
55 onLoad: function (options) { 56 onLoad: function (options) {
56 this.options=options 57 this.options=options
57 - this.setData({  
58 - sellername:options.sellername,  
59 - }) 58 + this.initPage()
60 }, 59 },
  60 + async initPage(){
  61 + try{
  62 + this.setData({
  63 + labels:await DA.getLabels(),
  64 + sellername:this.options.sellername,
  65 + loading:1,
  66 + })
  67 + }catch(e){
  68 + this.setData({
  69 + loading:-1,
  70 + })
  71 + }
  72 + }
  73 +
  74 + ,
61 75
62 /** 76 /**
63 * 生命周期函数--监听页面初次渲染完成 77 * 生命周期函数--监听页面初次渲染完成
@@ -140,4 +154,54 @@ Page({ @@ -140,4 +154,54 @@ Page({
140 }) 154 })
141 util.toast('图片已删除','none') 155 util.toast('图片已删除','none')
142 }, 156 },
  157 + labelTap(e){
  158 + let labels=this.data.labels
  159 + labels[util.attr(e,'index')].active=!labels[util.attr(e,'index')].active
  160 + this.setData({
  161 + labels:labels,
  162 + })
  163 + },
  164 + text:'',
  165 + textareaInput(e){
  166 + this.text=util.val(e).trim();
  167 + },
  168 + submitIng:false,
  169 + submit(){
  170 + if(this.submitIng) return;
  171 + let eval_label=[]
  172 + this.data.labels.some(l=>{
  173 + if(l.active){
  174 + eval_label.push(l.name)
  175 + }
  176 + })
  177 + if(eval_label.length<1) return util.toast('请选择标签','none')
  178 + this.submitIng=true
  179 + let enclosure=[];
  180 + this.data.files.some(attr=>{
  181 + if(attr.remote){
  182 + enclosure.push(attr.remote)
  183 + }
  184 + })
  185 + let params={
  186 + sid:this.options.sid,
  187 + rid:this.options.oid,
  188 + eval_label:eval_label.toString(),
  189 + author_openid:getApp().openid,
  190 + enclosure:JSON.stringify(enclosure),
  191 + identity:1,
  192 + text:this.text||'',
  193 + types:1,
  194 + grade:this.statVal,
  195 + }
  196 + App.User.SetComment(params).then(res=>{
  197 + if(res.ret!=200){
  198 + return util.toast(res.msg,'')
  199 + }
  200 + wx.redirectTo({
  201 + url:'./success?sellername='+this.options.sellername
  202 + })
  203 + }).catch(e=>{
  204 + this.submitIng=false
  205 + })
  206 + }
143 }) 207 })
1 <!--pages/pinglun/create.wxml--> 1 <!--pages/pinglun/create.wxml-->
2 <nav>{{sellername}}</nav> 2 <nav>{{sellername}}</nav>
3 -<page loading="1">  
4 - <view class="view"> 3 +<page loading="{{loading}}">
  4 + <view class="view" style="padding-bottom: 200rpx;">
5 <view class="view padding-lr-lg"> 5 <view class="view padding-lr-lg">
6 <view class="view flex align-center solid-bottom" style="height: 136rpx;"> 6 <view class="view flex align-center solid-bottom" style="height: 136rpx;">
7 <view class="txt-36-h text-bold">评分</view> 7 <view class="txt-36-h text-bold">评分</view>
@@ -14,13 +14,16 @@ @@ -14,13 +14,16 @@
14 <view class="txt-36-h text-bold" style="margin-top: 48rpx; min-width: 72rpx;">标签</view> 14 <view class="txt-36-h text-bold" style="margin-top: 48rpx; min-width: 72rpx;">标签</view>
15 <view class="txt-36-h text-bold margin-left-xs margin-right" style="color:#FF7A00;margin-top: 48rpx;">*</view> 15 <view class="txt-36-h text-bold margin-left-xs margin-right" style="color:#FF7A00;margin-top: 48rpx;">*</view>
16 <view class="view margin-top-lg flex flex-wrap"> 16 <view class="view margin-top-lg flex flex-wrap">
17 - <view class="tag-item view padding-lr margin-bottom margin-right flex align-center">包间环境好</view>  
18 - <view class="tag-item active view padding-lr margin-bottom margin-right flex align-center">包间环境好</view>  
19 - <view class="tag-item view padding-lr margin-bottom margin-right flex align-center">包间环境好</view> 17 + <block wx:for="{{labels}}" wx:key="labels">
  18 + <view bindtap="labelTap" data-index="{{index}}"
  19 + class="tag-item {{item.active?'active':''}} view padding-lr margin-bottom margin-right flex align-center">{{item.name}}</view>
  20 + </block>
20 </view> 21 </view>
21 </view> 22 </view>
22 <textarea 23 <textarea
23 - class="margin-top-lg" style="height: 294rpx; font-size: 30rpx;" 24 + class="margin-top-lg" style="height: 294rpx; font-size: 30rpx;line-height: 42rpx;"
  25 + bindinput="textareaInput"
  26 + placeholder-style="font-size: 30rpx;line-height: 42rpx;color:#999999;"
24 placeholder="从包间环境、菜品口味、服务来评价餐厅,可以帮助更多想要订这家餐厅的人哦~"></textarea> 27 placeholder="从包间环境、菜品口味、服务来评价餐厅,可以帮助更多想要订这家餐厅的人哦~"></textarea>
25 </view> 28 </view>
26 <scroll-view class="view" 29 <scroll-view class="view"
  1 +// pages/pinglun/mylist.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad: function (options) {
  15 +
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面初次渲染完成
  20 + */
  21 + onReady: function () {
  22 +
  23 + },
  24 +
  25 + /**
  26 + * 生命周期函数--监听页面显示
  27 + */
  28 + onShow: function () {
  29 +
  30 + },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面隐藏
  34 + */
  35 + onHide: function () {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面卸载
  41 + */
  42 + onUnload: function () {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 页面相关事件处理函数--监听用户下拉动作
  48 + */
  49 + onPullDownRefresh: function () {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 页面上拉触底事件的处理函数
  55 + */
  56 + onReachBottom: function () {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 用户点击右上角分享
  62 + */
  63 + onShareAppMessage: function () {
  64 +
  65 + }
  66 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<!--pages/pinglun/mylist.wxml-->
  2 +<text>pages/pinglun/mylist.wxml</text>
  1 +/* pages/pinglun/mylist.wxss */
  1 +// pages/pinglun/success.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad: function (options) {
  15 + this.setData({
  16 + sellername:options.sellername||'',
  17 + })
  18 + },
  19 +
  20 + /**
  21 + * 生命周期函数--监听页面初次渲染完成
  22 + */
  23 + onReady: function () {
  24 +
  25 + },
  26 +
  27 + /**
  28 + * 生命周期函数--监听页面显示
  29 + */
  30 + onShow: function () {
  31 +
  32 + },
  33 +
  34 + /**
  35 + * 生命周期函数--监听页面隐藏
  36 + */
  37 + onHide: function () {
  38 +
  39 + },
  40 +
  41 + /**
  42 + * 生命周期函数--监听页面卸载
  43 + */
  44 + onUnload: function () {
  45 +
  46 + },
  47 +
  48 + /**
  49 + * 页面相关事件处理函数--监听用户下拉动作
  50 + */
  51 + onPullDownRefresh: function () {
  52 +
  53 + },
  54 +
  55 + /**
  56 + * 页面上拉触底事件的处理函数
  57 + */
  58 + onReachBottom: function () {
  59 +
  60 + },
  61 +
  62 + /**
  63 + * 用户点击右上角分享
  64 + */
  65 + onShareAppMessage: function () {
  66 +
  67 + }
  68 +})
  1 +{
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTextStyle": "black",
  4 + "usingComponents": {
  5 + "nav":"/components/nav/nav"
  6 + }
  7 +}
  1 +<!--pages/pinglun/success.wxml-->
  2 +<nav>{{sellername}}</nav>
  3 +<view class="view flex flex-direction justify-start align-center padding-top-xl margin-top-xl">
  4 + <view class="view flex align-center">
  5 + <image src="http://nosqn.colorcun.com/pinglun/p%20%288%29.png" style="width: 60rpx;height: 60rpx;"></image>
  6 + <view class="txt-38-h text-bold margin-left-sm">感谢您的评价!</view>
  7 + </view>
  8 + <view class="margin-top-sm margin-bottom-xl txt-30-h">您的评价已提交,我们会尽快进行审核</view>
  9 + <navigator url="./mylist" open-type="redirect" hover-class="other-navigator-hover">
  10 + <view class="margin-top mylist">查看评价</view>
  11 + </navigator>
  12 +</view>
  1 +/* pages/pinglun/success.wxss */
  2 +@import "../../colorui/main.wxss";
  3 +.mylist{
  4 + width: 300rpx;
  5 + height: 80rpx;
  6 + border-radius: 40rpx;
  7 + border: 2rpx solid #5EB2FF;
  8 +
  9 + font-size: 34rpx;
  10 + font-family: PingFangSC-Semibold, PingFang SC;
  11 + font-weight: 600;
  12 + color: #42A5FF;
  13 + line-height: 80rpx;
  14 + text-align: center;
  15 +}
@@ -10,6 +10,10 @@ let getCates=async function(){ @@ -10,6 +10,10 @@ let getCates=async function(){
10 }) 10 })
11 return cates; 11 return cates;
12 } 12 }
  13 +let getLabels=async function(){
  14 + let res=await App.Reserve.GetCustomerConfig();
  15 + return res.data.pub_label;
  16 +}
13 let getCatesID=async function(index){ 17 let getCatesID=async function(index){
14 let res=await App.Reserve.GetCustomerConfig(); 18 let res=await App.Reserve.GetCustomerConfig();
15 return res.data.cate[index].id; 19 return res.data.cate[index].id;
@@ -17,4 +21,5 @@ let getCatesID=async function(index){ @@ -17,4 +21,5 @@ let getCatesID=async function(index){
17 export default { 21 export default {
18 getCates:getCates, 22 getCates:getCates,
19 getCatesID:getCatesID, 23 getCatesID:getCatesID,
  24 + getLabels:getLabels,
20 } 25 }
@@ -601,7 +601,7 @@ @@ -601,7 +601,7 @@
601 { 601 {
602 "name": "pages/reserve/detail", 602 "name": "pages/reserve/detail",
603 "pathName": "pages/reserve/detail", 603 "pathName": "pages/reserve/detail",
604 - "query": "id=1001&_activeTab=reserve&_date=2020-02-16&_pnum=6", 604 + "query": "id=80&_activeTab=reserve&_date=2020-02-16&_pnum=6",
605 "scene": null 605 "scene": null
606 }, 606 },
607 { 607 {
@@ -738,6 +738,12 @@ @@ -738,6 +738,12 @@
738 "pathName": "pages/pinglun/create", 738 "pathName": "pages/pinglun/create",
739 "query": "sid=80&oid=118852&sellername=秦风面庄001", 739 "query": "sid=80&oid=118852&sellername=秦风面庄001",
740 "scene": null 740 "scene": null
  741 + },
  742 + {
  743 + "name": "pages/pinglun/success",
  744 + "pathName": "pages/pinglun/success",
  745 + "query": "",
  746 + "scene": null
741 } 747 }
742 ] 748 ]
743 } 749 }
@@ -521,6 +521,11 @@ export default { @@ -521,6 +521,11 @@ export default {
521 //分享关系记录 521 //分享关系记录
522 'App.Customer.SetShareRel':null, 522 'App.Customer.SetShareRel':null,
523 523
  524 + //预订成功之后用户评价当前预订
  525 + 'App.User.SetComment':{
  526 + openid:'author_openid',
  527 + },
  528 +
524 //获取商家优惠对接人信息 529 //获取商家优惠对接人信息
525 'App.Customer.GetSellerPreferentialDocking':null, 530 'App.Customer.GetSellerPreferentialDocking':null,
526 //接单人,获得商家设置的接单人列表 531 //接单人,获得商家设置的接单人列表