作者 朱振飞

project init

要显示太多修改。

为保证性能只显示 49 of 49+ 个文件。

不能预览此文件类型
  1 +//app.js
  2 +App({
  3 + onLaunch: function () {
  4 + // 展示本地存储能力
  5 + // var logs = wx.getStorageSync('logs') || []
  6 + // logs.unshift(Date.now())
  7 + // wx.setStorageSync('logs', logs)
  8 +
  9 + // 登录
  10 + // wx.login({
  11 + // success: res => {
  12 + // // 发送 res.code 到后台换取 openId, sessionKey, unionId
  13 + // }
  14 + // })
  15 + // 获取用户信息
  16 + // wx.getSetting({
  17 + // success: res => {
  18 + // if (res.authSetting['scope.userInfo']) {
  19 + // // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
  20 + // wx.getUserInfo({
  21 + // success: res => {
  22 + // // 可以将 res 发送给后台解码出 unionId
  23 + // this.globalData.userInfo = res.userInfo
  24 +
  25 + // // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
  26 + // // 所以此处加入 callback 以防止这种情况
  27 + // if (this.userInfoReadyCallback) {
  28 + // this.userInfoReadyCallback(res)
  29 + // }
  30 + // }
  31 + // })
  32 + // }
  33 + // }
  34 + // })
  35 +
  36 +
  37 +
  38 +
  39 +
  40 + },
  41 + ajax(url, params, successData, errorData, completeData) {
  42 + var https = "https://shipin.wx.broteam.cn/index.php/"
  43 + wx.request({
  44 + url: https + url,
  45 + method: "POST",
  46 + header: {
  47 + 'content-type': 'application/x-www-form-urlencoded',
  48 + },
  49 + data: params,
  50 + success: (res) => {
  51 + successData(res)
  52 + },
  53 + error(res) {
  54 + errorData(res)
  55 + }
  56 + })
  57 + },
  58 + // 多张图片上传
  59 + uploadImg: function (data) {
  60 + var that = this,
  61 + i = data.i ? data.i : 0,
  62 + success = data.success ? data.success : 0,
  63 + fail = data.fail ? data.fail : 0
  64 +
  65 + wx.uploadFile({
  66 + url: data.url,
  67 + filePath: data.path[i],
  68 + name: 'fileData', // 这里根据自己的实际情况修改
  69 + formData: null,
  70 + success: function (resp) {
  71 + success++
  72 + console.log(resp)
  73 + console.log(i)
  74 + /*
  75 + 这里肯能有bug,失败也会执行这里,所以这里应该是后台返回过来的状态码为成功时,
  76 + 这里的succes才+1
  77 + */
  78 + },
  79 + fail: function (res) {
  80 + fail++
  81 + console.log('fail: ' + i + 'fail: ' + fail)
  82 + },
  83 + complete: function (res) {
  84 + console.log(i)
  85 + i++
  86 +
  87 +
  88 + if (i == data.path.length) { //当图片传完时,停止调用
  89 + console.log('执行完毕');
  90 + console.log('成功:' + success + " 失败:" + fail);
  91 + } else { //若图片还没有传完,则继续调用函数
  92 + console.log(i);
  93 + data.i = i;
  94 + data.success = success;
  95 + data.fail = fail;
  96 + that.uploadimg(data);
  97 + }
  98 +
  99 +
  100 + if (i == data.path.length) { // 当图片传完时,停止调用
  101 + console.log('执行完毕')
  102 + console.log('成功:' + success + '失败:' + fail)
  103 + } else { // 若图片还没有传完,则继续调用函数
  104 + console.log(i)
  105 + data.i = i
  106 + data.success = success
  107 + data.fail = fail
  108 + that.uploadimg(data)
  109 + }
  110 + }
  111 + })
  112 + },
  113 + getNowDate() {
  114 + var now = new Date();
  115 + var week = now.getDay()
  116 + var str = "星期";
  117 + switch (now.getDay()) {
  118 + case 0:
  119 + str = str + "日";
  120 + break;
  121 + case 1:
  122 + str = str + "一";
  123 + break;
  124 + case 2:
  125 + str = str + "二";
  126 + break;
  127 + case 3:
  128 + str = str + "三";
  129 + break;
  130 + case 4:
  131 + str = str + "四";
  132 + break;
  133 + case 5:
  134 + str = str + "五";
  135 + break;
  136 + case 6:
  137 + str = str + "六";
  138 + break;
  139 + }
  140 + var year = now.getFullYear();
  141 + var month = now.getMonth() + 1;
  142 + var day = now.getDate();
  143 + if (month < 10) {
  144 + month = '0' + month;
  145 + };
  146 + if (day < 10) {
  147 + day = '0' + day;
  148 + };
  149 + // 如果需要时分秒,就放开
  150 + // var h = now.getHours();
  151 + // var m = now.getMinutes();
  152 + // var s = now.getSeconds();
  153 + var formatDate = year + '-' + month + '-' + day + '('+str+')';
  154 + return formatDate;
  155 + },
  156 +
  157 + globalData: {
  158 + imgUrlUp: "https://shipin.wx.broteam.cn/index.php/MyComment/upload",
  159 + userInfo: null,
  160 + // 下导航
  161 + tabBar: [{
  162 + name: "首页",
  163 + state: true,
  164 + img: "http://omega.wx.bronet.cn/public/static/images/menu_icon1_select@2x_81.png",
  165 + selectImg: "http://omega.wx.bronet.cn/public/static/images/menu_icon1_select@2x.png",
  166 + num: null,
  167 + url: "../index/index"
  168 + },
  169 + {
  170 + name: "购物车",
  171 + state: false,
  172 + img: "http://omega.wx.bronet.cn/public/static/images/92@2x.png",
  173 + selectImg: "http://omega.wx.bronet.cn/public/static/images/92@2x_55.png",
  174 + num: 0,
  175 + url: "../shopCart/shopCart"
  176 + },
  177 + {
  178 + name: "我的",
  179 + state: false,
  180 + img: "http://omega.wx.bronet.cn/public/static/images/menu_icon3_select@2x.png",
  181 + selectImg: "http://omega.wx.bronet.cn/public/static/images/menu_icon3_select@2x_57.png",
  182 + num: null,
  183 + url: "../me/me"
  184 + },
  185 + ],
  186 + unique_id: null, //公众号与小程序共有id
  187 + shoppingCart: null,
  188 + nearest_spot: null,//就近自提地址及id
  189 + nearest_store: null,//到店堂食地址及id
  190 + orderRemarkValue: null,
  191 + btnStart: true //选择的自提还是堂食
  192 + }
  193 +})
  1 +{
  2 + "pages": [
  3 + "pages/index/index",
  4 + "pages/login/login",
  5 + "pages/reenabled/reenabled",
  6 + "pages/getGoodsDetails/getGoodsDetails",
  7 + "pages/detailsGoods/detailsGoods",
  8 + "pages/shopCart/shopCart",
  9 + "pages/submitOrder/submitOrder",
  10 + "pages/expectLocation/expectLocation",
  11 + "pages/allEvaluate/allEvaluate",
  12 + "pages/remark/remark",
  13 + "pages/me/me",
  14 + "pages/myWallet/myWallet",
  15 + "pages/Coupon/Coupon",
  16 + "pages/recharge/recharge",
  17 + "pages/walletDetail/walletDetail",
  18 + "pages/order/order",
  19 + "pages/orderDetails/orderDetails",
  20 + "pages/evaluate/evaluate",
  21 + "pages/aboutMe/aboutMe",
  22 + "pages/guidance/guidance",
  23 + "pages/shopDetails/shopDetails",
  24 + "pages/maps/maps"
  25 + ],
  26 + "window": {
  27 + "backgroundTextStyle": "light",
  28 + "navigationBarBackgroundColor": "#fff",
  29 + "navigationBarTitleText": "乡味乡链",
  30 + "navigationBarTextStyle": "black"
  31 + }
  32 +}
  1 +/**app.wxss**/
  2 +
  3 +@font-face {
  4 + font-family: 'icon'; /* project id 647640 */
  5 + src: url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.eot');
  6 + src: url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.eot?#iefix') format('embedded-opentype'),
  7 + url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.woff') format('woff'),
  8 + url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.ttf') format('truetype'),
  9 + url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.svg#iconfont') format('svg');
  10 +}
  11 +.icon {
  12 + font-family: "icon" !important;
  13 + font-size: 16px;
  14 + font-style: normal;
  15 + -webkit-font-smoothing: antialiased;
  16 + -moz-osx-font-smoothing: grayscale;
  17 +}
  18 +
  19 +.icon-jia:before {
  20 + content: "\e600";
  21 +}
  22 +
  23 +.icon-weixuanzhongyuanquan:before {
  24 + content: "\e601";
  25 +}
  26 +
  27 +.icon-31daipingjia:before {
  28 + content: "\e602";
  29 +}
  30 +
  31 +.icon-xuanzhong:before {
  32 + content: "\e631";
  33 +}
  34 +
  35 +.icon-yizhifu:before {
  36 + content: "\e615";
  37 +}
  38 +
  39 +.icon-yiwancheng1:before {
  40 + content: "\e616";
  41 +}
  42 +
  43 +.icon-zelvxuanzefeiyongdaosanjiaoxingfandui:before {
  44 + content: "\e665";
  45 +}
  46 +
  47 +.icon-erji:before {
  48 + content: "\e608";
  49 +}
  50 +
  51 +.icon-wallet_icon:before {
  52 + content: "\e664";
  53 +}
  54 +
  55 +.icon-youhuiquan:before {
  56 + content: "\e674";
  57 +}
  58 +
  59 +.icon-balance:before {
  60 + content: "\e618";
  61 +}
  62 +
  63 +.icon-qianbao:before {
  64 + content: "\e672";
  65 +}
  66 +
  67 +.icon-close:before {
  68 + content: "\e606";
  69 +}
  70 +
  71 +.icon-icon--:before {
  72 + content: "\e71b";
  73 +}
  74 +
  75 +.icon-icon--1:before {
  76 + content: "\e78f";
  77 +}
  78 +
  79 +.icon-fylb_icon_arrow_norm:before {
  80 + content: "\e603";
  81 +}
  82 +
  83 +.icon-index:before {
  84 + content: "\e604";
  85 +}
  86 +
  87 +.icon-my_icon:before {
  88 + content: "\e614";
  89 +}
  90 +
  91 +.icon-hdxq_icon:before {
  92 + content: "\e605";
  93 +}
  94 +
  95 +.icon-hdxq_icon1:before {
  96 + content: "\e617";
  97 +}
  98 +
  99 +.icon-icon-test:before {
  100 + content: "\e607";
  101 +}
  102 +
  103 +.icon-icon-test1:before {
  104 + content: "\e609";
  105 +}
  106 +
  107 +.icon-gouwuche_select:before {
  108 + content: "\e60a";
  109 +}
  110 +
  111 +.icon-qianbao1:before {
  112 + content: "\e60b";
  113 +}
  114 +
  115 +.icon-icon-test2:before {
  116 + content: "\e60c";
  117 +}
  118 +
  119 +.icon-liwu:before {
  120 + content: "\e60d";
  121 +}
  122 +
  123 +.icon-icon-test3:before {
  124 + content: "\e60e";
  125 +}
  126 +
  127 +.icon-yiwancheng:before {
  128 + content: "\e60f";
  129 +}
  130 +
  131 +.icon-pingjia:before {
  132 + content: "\e610";
  133 +}
  134 +
  135 +.icon-xingzhuang:before {
  136 + content: "\e611";
  137 +}
  138 +
  139 +.icon-icon-test4:before {
  140 + content: "\e612";
  141 +}
  142 +
  143 +.icon-VectorSmartObject:before {
  144 + content: "\e613";
  145 +}
  146 +
  147 +.tabBar {
  148 + position: fixed;
  149 + bottom: 0;
  150 + height: 98rpx;
  151 + background: #fff;
  152 + width: 100%;
  153 + border-top: 1rpx solid #ccc;
  154 + display: flex;
  155 + justify-content: space-around;
  156 + text-align: center;
  157 +}
  158 +
  159 +.tabBar .barList {
  160 + position: relative;
  161 +}
  162 +
  163 +.tabBar .barList image {
  164 + width: 72rpx;
  165 + height: 72rpx;
  166 +}
  167 +
  168 +.tabBar .barList .font {
  169 + font-size: 22rpx;
  170 + color: #999;
  171 + line-height: 0rpx;
  172 +}
  173 +
  174 +.tabBar .barList .num {
  175 + /* width:28rpx;
  176 + height:28rpx; */
  177 + background: #c90103;
  178 + border-radius: 100%;
  179 + text-align: center;
  180 + line-height: 29rpx;
  181 + color: #fff;
  182 + font-size: 21rpx;
  183 + position: absolute;
  184 + top: 7rpx;
  185 + left: 43rpx;
  186 + padding-left: 10rpx;
  187 + padding-right: 10rpx;
  188 +}
  189 +
  190 +.payment {
  191 + padding: 38rpx 40rpx;
  192 + border-top: 1rpx solid #e4e4e4;
  193 +}
  194 +
  195 +.payment .state {
  196 + display: flex;
  197 + justify-content: space-between;
  198 +}
  199 +
  200 +.payment .state .stateFontNumber {
  201 + display: flex;
  202 + font-size: 26rpx;
  203 +}
  204 +
  205 +.payment .state .stateFontNumber .stateFont {
  206 + color: #c90103;
  207 +}
  208 +
  209 +.payment .state .stateFontNumber .number {
  210 + margin-left: 30rpx;
  211 + color: #666;
  212 +}
  213 +
  214 +.payment .state .time {
  215 + color: #666;
  216 + font-size: 26rpx;
  217 +}
  218 +
  219 +.payment .spMes {
  220 + display: flex;
  221 + justify-content: space-between;
  222 + margin-top: 41rpx;
  223 +}
  224 +
  225 +.payment .spMes image {
  226 + width: 96rpx;
  227 + height: 96rpx;
  228 +}
  229 +
  230 +.payment .spMes .nameHint {
  231 + width: 481rpx;
  232 + margin-left: 20rpx;
  233 +}
  234 +
  235 +.payment .spMes .nameHint .name {
  236 + font-size: 30rpx;
  237 + color: #222;
  238 +}
  239 +
  240 +.payment .spMes .nameHint .hint {
  241 + color: #666;
  242 + font-size: 26rpx;
  243 + height: 70rpx;
  244 + overflow: hidden;
  245 +}
  246 +
  247 +.payment .spMes .numMon .mon {
  248 + color: #222;
  249 + font-size: 26rpx;
  250 +}
  251 +
  252 +.payment .spMes .numMon .num {
  253 + font-size: 24rpx;
  254 + color: #999;
  255 + margin-top: 27rpx;
  256 + text-align: right;
  257 +}
  258 +
  259 +.payment .payMes {
  260 + margin-top: 37rpx;
  261 + display: flex;
  262 + justify-content: flex-end;
  263 + align-items: center;
  264 +}
  265 +
  266 +.payment .payMes .all {
  267 + color: #c90103;
  268 + font-size: 26rpx;
  269 + margin-right: 40rpx;
  270 +}
  271 +
  272 +.payment .payMes .cancel {
  273 + font-size: 26rpx;
  274 + color: #333;
  275 + width: 148rpx;
  276 + height: 56rpx;
  277 + background: #eee;
  278 + border-radius: 28rpx;
  279 + margin-right: 25rpx;
  280 + text-align: center;
  281 + line-height: 56rpx;
  282 +}
  283 +
  284 +.payment .payMes .pay {
  285 + font-size: 26rpx;
  286 + color: #fff;
  287 + text-align: center;
  288 + line-height: 56rpx;
  289 + width: 148rpx;
  290 + height: 56rpx;
  291 + background: #c90103;
  292 + border-radius: 28rpx;
  293 +}
  294 +
  295 +.shopType {
  296 + width: 66rpx;
  297 + height: 36rpx;
  298 + border: 2rpx solid #fc0;
  299 + text-align: center;
  300 + line-height: 36rpx;
  301 + font-size: 24rpx;
  302 + color: #fc0;
  303 + margin-left: 30rpx;
  304 +}
  305 +
  306 +.shopTypeT {
  307 + width: 66rpx;
  308 + height: 36rpx;
  309 + border: 2rpx solid #67c33e;
  310 + text-align: center;
  311 + line-height: 36rpx;
  312 + font-size: 24rpx;
  313 + color: #67c33e;
  314 + margin-left: 30rpx;
  315 +}
不能预览此文件类型
  1 +// pages/Coupon/Coupon.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + /**
  10 + * 页面配置
  11 + */
  12 + winWidth: 0,
  13 + winHeight: 0,
  14 + // tab切换
  15 + currentTab: 0,
  16 + num:1,
  17 +
  18 + arr1: [],
  19 + arr2: [],
  20 + arr3: [],
  21 + },
  22 + // 立即使用
  23 + go(){
  24 + wx.reLaunch({
  25 + url: '../index/index',
  26 + })
  27 + },
  28 + // 循环调用获取订单列表
  29 + getOrderList() {
  30 + wx.showLoading({
  31 + title: '加载中',
  32 + })
  33 +
  34 + var num = this.data.num;
  35 + var that = this;
  36 + function move() {
  37 + app.ajax("DiscountCoupon/index", {
  38 + unique_id: app.globalData.unique_id,
  39 + status: num
  40 + }, (res) => {
  41 + console.log(res)
  42 + console.log(res.data.data)
  43 + if (res.data.data) {
  44 + console.log(num)
  45 + if (num == 1) {
  46 + that.setData({
  47 + arr1: res.data.data,
  48 + freeCard: res.data.data2
  49 + })
  50 + num++
  51 + move()
  52 + } else if (num == 2) {
  53 + that.setData({
  54 + arr2: res.data.data,
  55 + freeCard2: res.data.data2
  56 + })
  57 + num++
  58 + move()
  59 + } else if (num == 3) {
  60 + that.setData({
  61 + arr3: res.data.data,
  62 + freeCard2: res.data.data2
  63 + })
  64 + num++
  65 + move()
  66 + } else {
  67 + console.log("结束")
  68 + wx.hideLoading()
  69 + }
  70 + } else {
  71 + console.log(num)
  72 + if (num == 1) {
  73 + that.setData({
  74 + arr1: [],
  75 + freeCard2: []
  76 + })
  77 + num++
  78 + move()
  79 + } else if (num == 2) {
  80 + that.setData({
  81 + arr2: [],
  82 + freeCard2: []
  83 + })
  84 + num++
  85 + move()
  86 + } else if (num == 3) {
  87 + that.setData({
  88 + arr3: [],
  89 + freeCard3: []
  90 + })
  91 + num++
  92 + move()
  93 + } else {
  94 + console.log("结束")
  95 + wx.hideLoading()
  96 + }
  97 + }
  98 + }, (res) => { })
  99 + }
  100 + move()
  101 + },
  102 + /**
  103 + * 滑动切换tab
  104 + */
  105 + bindChange: function (e) {
  106 +
  107 + var that = this;
  108 + that.setData({ currentTab: e.detail.current });
  109 +
  110 + },
  111 + /**
  112 + * 点击tab切换
  113 + */
  114 + swichNav: function (e) {
  115 +
  116 + var that = this;
  117 +
  118 + if (this.data.currentTab === e.target.dataset.current) {
  119 + return false;
  120 + } else {
  121 + that.setData({
  122 + currentTab: e.target.dataset.current
  123 + })
  124 + }
  125 + },
  126 + /**
  127 + * 生命周期函数--监听页面加载
  128 + */
  129 + onLoad: function (options) {
  130 + var that = this;
  131 +
  132 + /**
  133 + * 获取系统信息
  134 + */
  135 + wx.getSystemInfo({
  136 +
  137 + success: function (res) {
  138 + that.setData({
  139 + winWidth: res.windowWidth,
  140 + winHeight: res.windowHeight
  141 + });
  142 + }
  143 +
  144 + });
  145 + },
  146 +
  147 + /**
  148 + * 生命周期函数--监听页面初次渲染完成
  149 + */
  150 + onReady: function () {
  151 +
  152 + },
  153 +
  154 + /**
  155 + * 生命周期函数--监听页面显示
  156 + */
  157 + onShow: function () {
  158 + this.getOrderList()
  159 + },
  160 +
  161 + /**
  162 + * 生命周期函数--监听页面隐藏
  163 + */
  164 + onHide: function () {
  165 +
  166 + },
  167 +
  168 + /**
  169 + * 生命周期函数--监听页面卸载
  170 + */
  171 + onUnload: function () {
  172 +
  173 + },
  174 +
  175 + /**
  176 + * 页面相关事件处理函数--监听用户下拉动作
  177 + */
  178 + onPullDownRefresh: function () {
  179 +
  180 + },
  181 +
  182 + /**
  183 + * 页面上拉触底事件的处理函数
  184 + */
  185 + onReachBottom: function () {
  186 +
  187 + },
  188 +
  189 + /**
  190 + * 用户点击右上角分享
  191 + */
  192 + onShareAppMessage: function () {
  193 +
  194 + }
  195 +})
  1 +<!--pages/Coupon/Coupon.wxml-->
  2 +<view class="buttom">
  3 + <view class="swiper-tab">
  4 + <view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">未使用</view>
  5 + <view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">已使用</view>
  6 + <view class="swiper-tab-list {{currentTab==2 ? 'on' : ''}}" data-current="2" bindtap="swichNav">已过期</view>
  7 + </view>
  8 +
  9 + <swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight - 31}}px" bindchange="bindChange">
  10 + <!-- 未使用 -->
  11 + <swiper-item >
  12 + <view class="List" wx:for="{{arr1}}" wx:key="" data-id='{{item.id}}'>
  13 + <view class="couponList">
  14 + <view class="plice">{{item.reduce}}
  15 + <text style="color:#999999;font-size:26rpx;">元</text>
  16 + </view>
  17 + <view class="mes">
  18 + <view class="name">{{item.discount_coupon_name}}</view>
  19 + <view class="time">有效期截止:{{item.deadline}}</view>
  20 + </view>
  21 + </view>
  22 + <view class="go" bindtap='go'>立即使用
  23 + <text class="icon icon-icon-test3" style="font-size:18rpx;margin-left:22rpx;"></text>
  24 + </view>
  25 + </view>
  26 +
  27 + <view class="List" wx:for="{{freeCard}}" wx:key="" data-id='{{item.id}}'>
  28 + <view class="couponList">
  29 + <view class="plice free_name">{{item.pledge_name}}
  30 + <text style="color:#999999;font-size:26rpx;"></text>
  31 + </view>
  32 + <view class="mes">
  33 + <view class="time">有效期截止:{{item.deadline}}</view>
  34 + </view>
  35 + </view>
  36 + <view class="go" bindtap='go'>立即使用
  37 + <text class="icon icon-icon-test3" style="font-size:18rpx;margin-left:22rpx;"></text>
  38 + </view>
  39 + </view>
  40 +
  41 + </swiper-item>
  42 + <!-- 已使用 -->
  43 + <swiper-item>
  44 + <view class="List" wx:for="{{arr2}}" wx:key="" data-id='{{item.id}}'>
  45 + <view class="couponList">
  46 + <view class="plice">{{item.reduce}}
  47 + <text style="color:#999999;font-size:26rpx;margin-left:13rpx;">元</text>
  48 + </view>
  49 + <view class="mes">
  50 + <view class="name">{{item.discount_coupon_name}}</view>
  51 + <view class="time">有效期截止:{{item.deadline}}</view>
  52 + </view>
  53 + </view>
  54 + <view class="go" style="color:#666666;">已使用</view>
  55 + </view>
  56 + <!-- 免费优惠 -->
  57 + <view class="List" wx:for="{{freeCard2}}" wx:key="" data-id='{{item.id}}'>
  58 + <view class="couponList">
  59 + <view class="plice free_name">{{item.pledge_name}}
  60 + <text style="color:#999999;font-size:26rpx;"></text>
  61 + </view>
  62 + <view class="mes">
  63 + <view class="time">有效期截止:{{item.deadline}}</view>
  64 + </view>
  65 + </view>
  66 + <view class="go" >已使用</view>
  67 + </view>
  68 + </swiper-item>
  69 + <!-- 已过期 -->
  70 + <swiper-item>
  71 + <view class="List" wx:for="{{arr3}}" wx:key="" data-id='{{item.id}}'>
  72 + <view class="couponList">
  73 + <view class="plice">{{item.reduce}}
  74 + <text style="color:#999999;font-size:26rpx;margin-left:13rpx;">元</text>
  75 + </view>
  76 + <view class="mes">
  77 + <view class="name">{{item.discount_coupon_name}}</view>
  78 + <view class="time">有效期截止:{{item.deadline}}</view>
  79 + </view>
  80 + </view>
  81 + <view class="go" style="color:#666666;">已过期</view>
  82 + </view>
  83 + <view class="List" wx:for="{{freeCard3}}" wx:key="" data-id='{{item.id}}'>
  84 + <view class="couponList">
  85 + <view class="plice free_name">{{item.pledge_name}}
  86 + <text style="color:#999999;font-size:26rpx;"></text>
  87 + </view>
  88 + <view class="mes">
  89 + <view class="time">有效期截止:{{item.deadline}}</view>
  90 + </view>
  91 + </view>
  92 + <view class="go" bindtap='go'>已过期
  93 + <text class="icon icon-icon-test3" style="font-size:18rpx;margin-left:22rpx;"></text>
  94 + </view>
  95 + </view>
  96 + </swiper-item>
  97 + </swiper>
  98 +</view>
  1 +/* pages/Coupon/Coupon.wxss */
  2 +
  3 +.buttom {
  4 + border-top: 1rpx solid #e4e4e4;
  5 +}
  6 +
  7 +.swiper-tab {
  8 + width: 100%;
  9 + text-align: center;
  10 + line-height: 80rpx;
  11 + display: flex;
  12 + justify-content: space-around;
  13 + box-shadow: 1rpx 1rpx 1rpx 2rpx #ccc;
  14 + position: relative;
  15 + z-index: 36;
  16 +}
  17 +
  18 +.swiper-tab-list {
  19 + font-size: 30rpx;
  20 + display: inline-block;
  21 + /* width: 33.33%; */
  22 + color: #666;
  23 +}
  24 +
  25 +.on {
  26 + color: #333;
  27 + position: relative;
  28 +}
  29 +
  30 +.on::after {
  31 + content: "";
  32 + border-bottom: 10rpx solid #fc0;
  33 + position: absolute;
  34 + bottom: 0;
  35 + left: 0;
  36 + border-radius: 5rpx;
  37 + width: 48rpx;
  38 +}
  39 +
  40 +.swiper-box {
  41 + display: block;
  42 + height: 100%;
  43 + width: 100%;
  44 + overflow: hidden;
  45 +}
  46 +
  47 +.swiper-box view {
  48 + text-align: center;
  49 +}
  50 +
  51 +.List {
  52 + background-image: url(http://omega.wx.bronet.cn/public/static/images/32@2x.png);
  53 + background-size: 100% 100%;
  54 + height: 286rpx;
  55 + width: 740rpx;
  56 + margin: 0 auto;
  57 + margin-top: 25rpx;
  58 +}
  59 +
  60 +.couponList {
  61 + display: flex;
  62 + justify-content: space-around;
  63 + /* border-bottom: 1rpx solid #eee; */
  64 + margin: 0 40rpx;
  65 + height: 180rpx;
  66 +}
  67 +
  68 +.couponList .plice {
  69 + font-size: 80rpx;
  70 + color: #c90103;
  71 + margin-top: 53rpx;
  72 + margin-left: 31rpx;
  73 + height: 115%;
  74 +}
  75 +
  76 +.couponList .mes {
  77 + margin-top: 61rpx;
  78 + margin-right: 38rpx;
  79 + height: 114rpx;
  80 +}
  81 +
  82 +.couponList .mes .name {
  83 + font-size: 30rpx;
  84 + color: #333;
  85 +}
  86 +
  87 +.couponList .mes .time {
  88 + font-size: 26rpx;
  89 + color: #999;
  90 + margin-top: 21rpx;
  91 + text-align: left;
  92 +}
  93 +
  94 +.List .go {
  95 + font-size: 30rpx;
  96 + color: #c90103;
  97 + text-align: center;
  98 + margin-top:22rpx;
  99 + display: flex;
  100 + align-items: center;
  101 + justify-content: center;
  102 +}
  103 +.couponList .free_name{
  104 + font-size: 30rpx;
  105 + margin: 0;
  106 + display: flex;
  107 + align-items: center;
  108 + font-weight: 600;
  109 + width: 200rpx;
  110 +}
  111 +swiper-item{
  112 + overflow-y: auto;
  113 +}
  1 +// pages/aboutMe/aboutMe.js
  2 +var WxParse = require('../../wxParse/wxParse.js');
  3 +const app = getApp()
  4 +Page({
  5 +
  6 + /**
  7 + * 页面的初始数据
  8 + */
  9 + data: {
  10 + allData:[],
  11 + post_content:""
  12 + },
  13 +
  14 + /**
  15 + * 生命周期函数--监听页面加载
  16 + */
  17 + onLoad: function (options) {
  18 + // 获取信息
  19 + app.ajax("News/aboutUs",{},(res)=>{
  20 + console.log(res)
  21 + if(res.data.status == true){
  22 + WxParse.wxParse('article', 'html', res.data.data.post_content, this, 5);
  23 + this.setData({
  24 + allData:res.data.data,
  25 +
  26 + })
  27 +
  28 + }
  29 + },(res)=>{})
  30 + },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面初次渲染完成
  34 + */
  35 + onReady: function () {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面显示
  41 + */
  42 + onShow: function () {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 生命周期函数--监听页面隐藏
  48 + */
  49 + onHide: function () {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 生命周期函数--监听页面卸载
  55 + */
  56 + onUnload: function () {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 页面相关事件处理函数--监听用户下拉动作
  62 + */
  63 + onPullDownRefresh: function () {
  64 +
  65 + },
  66 +
  67 + /**
  68 + * 页面上拉触底事件的处理函数
  69 + */
  70 + onReachBottom: function () {
  71 +
  72 + },
  73 +
  74 + /**
  75 + * 用户点击右上角分享
  76 + */
  77 + onShareAppMessage: function () {
  78 +
  79 + }
  80 +})
  1 +<!--pages/aboutMe/aboutMe.wxml-->
  2 +<import src="/wxParse/wxParse.wxml"/>
  3 +<view class="img">
  4 + <image src="{{allData.thumb}}"></image>
  5 +</view>
  6 +
  7 +
  8 +
  9 +<view class="title">{{allData.post_title}}</view>
  10 +
  11 +
  12 +<view class="contant">
  13 + <template is="wxParse" data="{{wxParseData:article.nodes}}"/>
  14 +
  15 +
  16 +</view>
  17 +
  18 +
  19 +
  20 +<!-- <view class="wealthy">
  21 + 富文本区域
  22 +
  23 +</view> -->
  1 +/* pages/aboutMe/aboutMe.wxss */
  2 +@import "/wxParse/wxParse.wxss";
  3 +.img image{
  4 + width:100%;
  5 + height:448rpx;
  6 +}
  7 +
  8 +
  9 +.title{
  10 + font-size: 32rpx;
  11 + color:#1A1A1A;
  12 + text-align: center;
  13 + margin-top: 70rpx;
  14 + font-weight: 800;
  15 +}
  16 +.contant{
  17 + padding:37rpx 63rpx 56rpx 63rpx;
  18 + font-size: 28rpx;
  19 + color:#666;
  20 + border-bottom: 1rpx solid #E4E4E4;
  21 + line-height:64rpx;
  22 +
  23 +}
  1 +// pages/allEvaluate/allEvaluate.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + allData:[]
  10 + },
  11 + bouncer(arr){
  12 + return arr.filter(function (val) {
  13 + return !(!val || val === "");
  14 + });
  15 + },
  16 + priviewImg(event){
  17 + console.log(event)
  18 + wx.previewImage({
  19 + current: event.currentTarget.dataset.src, // 当前显示图片的http链接
  20 + urls: event.currentTarget.dataset.arry // 需要预览的图片http链接列表
  21 + })
  22 + },
  23 + /**
  24 + * 生命周期函数--监听页面加载
  25 + */
  26 + onLoad: function (options) {
  27 + if (options.goods_id){
  28 + console.log(options.goods_id)
  29 + app.ajax("MyComment/commentList",{
  30 + goods_id: options.goods_id
  31 + },(res)=>{
  32 + console.log(res)
  33 + var data = res.data.data
  34 +
  35 + for(let n in data){
  36 + var comment = [];
  37 + let tempArry
  38 + if (data[n].comment_photo!= null){
  39 + tempArry = data[n].comment_photo.split(",")
  40 + tempArry = tempArry.filter(function (val) {
  41 + return !(!val || val === "");
  42 + });
  43 + }
  44 + comment.push(tempArry)
  45 + data[n].comment = comment
  46 + }
  47 +
  48 + console.log(data)
  49 + if(res.data.status == true){
  50 + this.setData({
  51 + allData:data
  52 + })
  53 + }
  54 + },(res)=>{})
  55 + }
  56 + },
  57 +
  58 + /**
  59 + * 生命周期函数--监听页面初次渲染完成
  60 + */
  61 + onReady: function () {
  62 +
  63 + },
  64 +
  65 + /**
  66 + * 生命周期函数--监听页面显示
  67 + */
  68 + onShow: function () {
  69 +
  70 + },
  71 +
  72 + /**
  73 + * 生命周期函数--监听页面隐藏
  74 + */
  75 + onHide: function () {
  76 +
  77 + },
  78 +
  79 + /**
  80 + * 生命周期函数--监听页面卸载
  81 + */
  82 + onUnload: function () {
  83 +
  84 + },
  85 +
  86 + /**
  87 + * 页面相关事件处理函数--监听用户下拉动作
  88 + */
  89 + onPullDownRefresh: function () {
  90 +
  91 + },
  92 +
  93 + /**
  94 + * 页面上拉触底事件的处理函数
  95 + */
  96 + onReachBottom: function () {
  97 +
  98 + },
  99 +
  100 + /**
  101 + * 用户点击右上角分享
  102 + */
  103 + onShareAppMessage: function () {
  104 +
  105 + }
  106 +})
  1 +<!--pages/allEvaluate/allEvaluate.wxml-->
  2 +<view class="evaluateList" wx:for="{{allData}}" wx:key="">
  3 + <view class="img">
  4 + <image src="{{item.head_img}}"></image>
  5 + </view>
  6 + <view class="mes">
  7 + <view class="nameTime">
  8 + <view class="name">{{item.nickname}}</view>
  9 + <view class="time">{{item.comment_date}}</view>
  10 + </view>
  11 + <view class="content">{{item.comment_content}}</view>
  12 + <view class="imgList">
  13 + <image wx:for="{{item.comment[0]}}" wx:for-item='obj' wx:key='' src="{{obj}}" data-src='{{obj}}' data-arry='{{item.comment[0]}}' bindtap='priviewImg'></image>
  14 + </view>
  15 + </view>
  16 +
  17 +</view>
  1 +/* pages/allEvaluate/allEvaluate.wxss */
  2 +page{
  3 + padding-bottom: 20rpx
  4 +}
  5 +.evaluateList{
  6 + display: flex;
  7 + justify-content: space-between;
  8 + margin-top:1rpx solid #E4E4E4;
  9 +}
  10 +.evaluateList .img image{
  11 + width:45rpx;
  12 + height:45rpx;
  13 + border-radius: 100%;
  14 + margin-top:41rpx;
  15 + margin-left:42rpx;
  16 +}
  17 +.evaluateList .mes{
  18 + margin-left:23rpx;
  19 + width:656rpx;
  20 +}
  21 +.evaluateList .mes .nameTime{
  22 + display: flex;
  23 + justify-content: space-between;
  24 + font-size: 26rpx;
  25 + color:#999;
  26 + margin-top:42rpx;
  27 +}
  28 +.evaluateList .mes .nameTime .time{
  29 + margin-right: 39rpx;
  30 +}
  31 +.evaluateList .mes .content{
  32 + color:#333333;
  33 + font-size: 28rpx;
  34 + margin-top:32rpx;
  35 +}
  36 +.evaluateList .mes .imgList{
  37 + display: flex;
  38 + margin-top:23rpx;
  39 +}
  40 +.evaluateList .mes .imgList image{
  41 + margin-right: 16rpx;
  42 + width:132rpx;
  43 + height:132rpx;
  44 +}
  1 +// pages/detailsGoods/detailsGoods.js
  2 +var WxParse = require('../../wxParse/wxParse.js');
  3 +var app = getApp()
  4 +Page({
  5 +
  6 + /**
  7 + * 页面的初始数据
  8 + */
  9 + data: {
  10 + indicatorDots: true,
  11 + autoplay: true,
  12 + interval: 5000,
  13 + duration: 1000,
  14 + allData: [],
  15 + // 商品id
  16 + goods_id: "",
  17 + num: 0
  18 + },
  19 + // 跳转购物车
  20 + shopCart() {
  21 + wx.reLaunch({
  22 + url: '../shopCart/shopCart',
  23 + })
  24 + },
  25 + // 商品列表加入购物车
  26 + openShopCar(e) {
  27 + wx.showLoading({
  28 + title: '加载中',
  29 + })
  30 + app.ajax("Cart/add", {
  31 + unique_id: app.globalData.unique_id,
  32 + goods_id: this.data.goods_id,
  33 + goods_num: 1,
  34 + }, (res) => {
  35 + console.log(res)
  36 + wx.hideLoading()
  37 + if (res.data.status == true) {
  38 + wx.showToast({
  39 + title: res.data.msg,
  40 + icon: 'success',
  41 + duration: 2000
  42 + })
  43 + } else {
  44 + wx.showModal({
  45 + title: '提示',
  46 + content: '未知错误,添加失败,请稍后重试!',
  47 + success: function(res) {
  48 + if (res.confirm) {
  49 + console.log('用户点击确定')
  50 + } else if (res.cancel) {
  51 + console.log('用户点击取消')
  52 + }
  53 + }
  54 + })
  55 + }
  56 + this.getNum()
  57 + })
  58 + },
  59 + // 获取购物车数量
  60 + getNum() {
  61 + // 获取购物车数量
  62 + app.ajax("CountNum/countCart", {
  63 + unique_id: app.globalData.unique_id
  64 + }, (res) => {
  65 + console.log(res)
  66 + if (res.data.status == true) {
  67 + this.setData({
  68 + num: res.data.data[0].count
  69 + })
  70 + }
  71 + }, (res) => {})
  72 + },
  73 + // 全部评价
  74 + allEvaluate() {
  75 + wx.navigateTo({
  76 + url: '../allEvaluate/allEvaluate?goods_id=' + this.data.goods_id,
  77 + })
  78 + },
  79 + /**
  80 + * 生命周期函数--监听页面加载
  81 + */
  82 + onLoad: function(options) {
  83 + if (options.id) {
  84 + console.log(options.id)
  85 + this.setData({
  86 + goods_id: options.id
  87 + })
  88 + // 获取商品详情
  89 + app.ajax("Goods/goodsDetail", {
  90 + goods_id: options.id
  91 + }, (res) => {
  92 + console.log("获取商品详情")
  93 + console.log(res)
  94 + if (res.data.status == true) {
  95 + this.setData({
  96 + allData: res.data.data
  97 + })
  98 + WxParse.wxParse('article', 'html', res.data.data.goods_detail, this, 5);
  99 + }
  100 + }, (res) => {})
  101 + }
  102 + },
  103 +
  104 + /**
  105 + * 生命周期函数--监听页面初次渲染完成
  106 + */
  107 + onReady: function() {
  108 +
  109 + },
  110 +
  111 + /**
  112 + * 生命周期函数--监听页面显示
  113 + */
  114 + onShow: function() {
  115 + console.log(app.globalData.tabBar[1].num)
  116 + this.setData({
  117 + num: app.globalData.tabBar[1].num
  118 + })
  119 + },
  120 +
  121 + /**
  122 + * 生命周期函数--监听页面隐藏
  123 + */
  124 + onHide: function() {
  125 +
  126 + },
  127 +
  128 + /**
  129 + * 生命周期函数--监听页面卸载
  130 + */
  131 + onUnload: function() {
  132 +
  133 + },
  134 +
  135 + /**
  136 + * 页面相关事件处理函数--监听用户下拉动作
  137 + */
  138 + onPullDownRefresh: function() {
  139 +
  140 + },
  141 +
  142 + /**
  143 + * 页面上拉触底事件的处理函数
  144 + */
  145 + onReachBottom: function() {
  146 +
  147 + },
  148 +
  149 + /**
  150 + * 用户点击右上角分享
  151 + */
  152 + onShareAppMessage: function() {
  153 +
  154 + }
  155 +})
  1 +<!--pages/detailsGoods/detailsGoods.wxml-->
  2 +<import src="/wxParse/wxParse.wxml" />
  3 +<view class="list">
  4 + <swiper indicator-dots="{{indicatorDots}}" indicator-color="#fff" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" indicator-active-color="#FBC247">
  5 + <block wx:for="{{allData.banner}}" wx:key="">
  6 + <swiper-item>
  7 + <image src="{{item}}" class="slide-image" width="355" height="150" />
  8 + </swiper-item>
  9 + </block>
  10 + </swiper>
  11 + <view class="mes">
  12 + <view class="left">
  13 + <view class="name">
  14 + <text style="font-size:36rpx;color:#111111;">{{allData.goods_name}}</text>
  15 + <text style="font-size:26rpx;color:#666666;margin-left:26rpx;">{{allData.goods_description}}</text>
  16 + </view>
  17 + <view class="price">
  18 + <text style="font-size:30rpx;color:#C90103;">¥ </text>
  19 + <text style="font-size:40rpx;color:#C90103;">{{allData.goods_price}}</text>
  20 + <text style="font-size:26rpx;color:#999999;margin-left:20rpx;">已售 {{allData.month_sales}} 件</text>
  21 + </view>
  22 + </view>
  23 + <view class="right" bindtap='allEvaluate'>
  24 + <text class="icon icon-pingjia"></text>
  25 + <view class="allSp">全部评价</view>
  26 + </view>
  27 + </view>
  28 +
  29 +
  30 + <!-- 商品详情 -->
  31 + <view class="shopDetails">
  32 + <view class="title">- 商品详情 -</view>
  33 + <view>
  34 + <template is="wxParse" data="{{wxParseData:article.nodes}}" />
  35 + </view>
  36 + <view style="height:100rpx;"></view>
  37 + </view>
  38 +</view>
  39 +
  40 +
  41 +
  42 +<view class="navBottom">
  43 + <view class="left" bindtap='shopCart'>
  44 + <text class="icon icon-icon--1"></text>
  45 + <view class="num">{{num == null?'0':num}}</view>
  46 + </view>
  47 + <view class="right" bindtap='openShopCar'>
  48 + 加入购物车
  49 + </view>
  50 +</view>
  1 +/* pages/detailsGoods/detailsGoods.wxss */
  2 +@import "/wxParse/wxParse.wxss";
  3 +page {
  4 + background: #f7f7f7;
  5 +}
  6 +
  7 +.list image {
  8 + width: 100%;
  9 + height: 672rpx;
  10 +}
  11 +
  12 +swiper {
  13 + height: 672rpx;
  14 +}
  15 +
  16 +.mes {
  17 + display: flex;
  18 + justify-content: space-between;
  19 + padding: 56rpx 40rpx;
  20 + background: #fff;
  21 +}
  22 +
  23 +.mes .right {
  24 + border-left: 1rpx solid #e4e4e4;
  25 + text-align: center;
  26 + padding-left: 29rpx;
  27 + display: flex;
  28 + flex-direction: column;
  29 + align-items: center;
  30 + justify-content: center;
  31 +}
  32 +
  33 +.mes .right .icon {
  34 + color: #999;
  35 + font-size: 36rpx;
  36 +}
  37 +
  38 +.mes .right .allSp {
  39 + font-size: 20rpx;
  40 + color: #333;
  41 + margin-top: 16rpx;
  42 +}
  43 +
  44 +.shopDetails {
  45 + background: #fff;
  46 + margin-top: 16rpx;
  47 + overflow: hidden;
  48 +}
  49 +
  50 +.shopDetails .title {
  51 + font-size: 26rpx;
  52 + color: #111;
  53 + text-align: center;
  54 + margin-top: 38rpx;
  55 +}
  56 +
  57 +.navBottom {
  58 + position: fixed;
  59 + bottom: 0;
  60 + width: 100%;
  61 + height: 97rpx;
  62 + border-top: 1rpx solid #e4e4e4;
  63 + background: #fff;
  64 + display: flex;
  65 +}
  66 +
  67 +.navBottom .left {
  68 + width: 154rpx;
  69 + height: 97rpx;
  70 + display: flex;
  71 + align-items: center;
  72 + justify-content: center;
  73 + position: relative;
  74 +}
  75 +
  76 +.navBottom .left .icon {
  77 + font-size: 44rpx;
  78 + color: #666;
  79 +}
  80 +
  81 +.navBottom .left .num {
  82 + position: absolute;
  83 + top: 21rpx;
  84 + left: 80rpx;
  85 + border-radius: 100%;
  86 + background: #c90103;
  87 + font-size: 24rpx;
  88 + color: #fff;
  89 + line-height: 28rpx;
  90 + text-align: center;
  91 + padding:3rpx;
  92 + width:28rpx;
  93 + height:28rpx;
  94 +}
  95 +
  96 +.navBottom .right {
  97 + background: #fc0;
  98 + text-align: center;
  99 + line-height: 97rpx;
  100 + color: #333;
  101 + font-size: 32rpx;
  102 + height: 97rpx;
  103 + width:597rpx;
  104 +}
  1 +// pages/evaluate/evaluate.js
  2 +//获取应用实例
  3 +const app = getApp()
  4 +Page({
  5 +
  6 + /**
  7 + * 页面的初始数据
  8 + */
  9 + data: {
  10 + noteMaxLen: 50, //备注最多字数
  11 + // 输入评论内容
  12 + value: "",
  13 + orderNote: [],
  14 + // 图片上传预览删除
  15 + allLength: 3,// 最多上传多少张
  16 + getState: true,
  17 + imgArray: [],
  18 + getImgArr: [],
  19 + // 订单id
  20 + oid: ""
  21 + },
  22 + // 提交
  23 + submit() {
  24 + wx.showLoading({
  25 + title: '正在提交',
  26 + })
  27 + var value = this.data.value;
  28 + var getImgArr = this.data.getImgArr;
  29 + console.log(getImgArr)
  30 + var str = ""
  31 + for (let n in getImgArr) {
  32 + str = str + getImgArr[n] + ","
  33 + }
  34 + console.log(value)
  35 + console.log(str)
  36 + if(value != ""){
  37 + app.ajax("MyComment/comment",{
  38 + unique_id: app.globalData.unique_id,
  39 + oid: this.data.oid,
  40 + comment_content:value,
  41 + comment_photo:str
  42 + },(res)=>{
  43 + wx.hideLoading()
  44 + console.log(res)
  45 + if(res.data.status == true){
  46 + wx.showToast({
  47 + title: res.data.msg,
  48 + icon: 'success',
  49 + duration: 2000,
  50 + mask:true
  51 + })
  52 + setTimeout(function () {
  53 + wx.navigateBack({})
  54 + }, 2000)
  55 + }else{
  56 + wx.showLoading({
  57 + title: res.data.msg
  58 + })
  59 + }
  60 + },(res)=>{})
  61 + }else{
  62 + wx.showLoading({
  63 + title: '填写评论',
  64 + mask:true,
  65 + duration: 1000
  66 + })
  67 + }
  68 +
  69 + },
  70 + // 选择图片
  71 + getImg() {
  72 + let that = this
  73 + wx.chooseImage({
  74 + count: this.data.allLength - this.data.imgArray.length, // 还可以上传几张
  75 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
  76 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
  77 + success: (res) => {
  78 + // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
  79 + var tempFilePaths = res.tempFilePaths;
  80 + var imgArray = Object.assign([],this.data.imgArray);
  81 +
  82 + for (let n in tempFilePaths) {
  83 + console.log(tempFilePaths[n])
  84 + wx.uploadFile({
  85 + url: app.globalData.imgUrlUp,
  86 + filePath: tempFilePaths[n],
  87 + name: "files",
  88 + formData: {},
  89 + success: (res) => {
  90 + console.log(res)
  91 + var getImgArr = this.data.getImgArr
  92 + let data = JSON.parse(res.data)
  93 + if(data.status){
  94 + console.log(data.data)
  95 + getImgArr.push(data.data)
  96 + console.log(tempFilePaths[n])
  97 + imgArray.push(tempFilePaths[n])
  98 + console.log(imgArray)
  99 +
  100 + }else{
  101 + wx.showToast({
  102 + title: data.msg,
  103 + icon: 'none'
  104 + })
  105 + }
  106 + console.log()
  107 + this.setData({
  108 + getImgArr: getImgArr
  109 + })
  110 + this.setData({
  111 + imgArray: imgArray
  112 + })
  113 + that.detection()
  114 + },
  115 + complete:(res)=>{
  116 + console.log(res)
  117 + }
  118 + })
  119 + }
  120 +
  121 + }
  122 + })
  123 + },
  124 + // 检测图片数量
  125 + detection() {
  126 + if (this.data.imgArray.length == this.data.allLength) {
  127 + this.setData({
  128 + getState: false
  129 + })
  130 + } else {
  131 + this.setData({
  132 + getState: true
  133 + })
  134 + }
  135 + },
  136 + // 删除
  137 + del(e) {
  138 + var index = e.currentTarget.dataset.index;
  139 + var imgArray = this.data.imgArray;
  140 + var getImgArr = this.data.getImgArr;
  141 + imgArray.splice(index, 1)
  142 + getImgArr.splice(index,1)
  143 + this.setData({
  144 + imgArray: imgArray,
  145 + getImgArr: getImgArr
  146 + })
  147 + console.log(this.data.imgArray)
  148 + this.detection()
  149 + },
  150 + //选择订单备注
  151 + bindOrderNote: function (e) {
  152 + var index = e.currentTarget.dataset.index, list = this.data.orderNote;
  153 + for (var i = 0, len = list.length; i < len; i++) {
  154 + if (index == list[i].index) {
  155 + list[i].selected = !list[i].selected;
  156 + }
  157 + }
  158 + this.setData({
  159 + orderNote: list
  160 + });
  161 + },
  162 +
  163 + //字数限制
  164 + bindWordLimit: function (e) {
  165 + var value = e.detail.value, len = parseInt(value.length);
  166 + if (len > this.data.noteMaxLen) return;
  167 +
  168 + this.setData({
  169 + currentNoteLen: len, //当前字数
  170 + value: value
  171 + //limitNoteLen: this.data.noteMaxLen - len //剩余字数
  172 + });
  173 + },
  174 + /**
  175 + * 生命周期函数--监听页面加载
  176 + */
  177 + onLoad: function (options) {
  178 + if (options.id) {
  179 + console.log(options.id)
  180 + this.setData({
  181 + oid: options.id
  182 + })
  183 + }
  184 + },
  185 +
  186 + /**
  187 + * 生命周期函数--监听页面初次渲染完成
  188 + */
  189 + onReady: function () {
  190 +
  191 + },
  192 +
  193 + /**
  194 + * 生命周期函数--监听页面显示
  195 + */
  196 + onShow: function () {
  197 +
  198 + },
  199 +
  200 + /**
  201 + * 生命周期函数--监听页面隐藏
  202 + */
  203 + onHide: function () {
  204 +
  205 + },
  206 +
  207 + /**
  208 + * 生命周期函数--监听页面卸载
  209 + */
  210 + onUnload: function () {
  211 +
  212 + },
  213 +
  214 + /**
  215 + * 页面相关事件处理函数--监听用户下拉动作
  216 + */
  217 + onPullDownRefresh: function () {
  218 +
  219 + },
  220 +
  221 + /**
  222 + * 页面上拉触底事件的处理函数
  223 + */
  224 + onReachBottom: function () {
  225 +
  226 + },
  227 +
  228 + /**
  229 + * 用户点击右上角分享
  230 + */
  231 + onShareAppMessage: function () {
  232 +
  233 + }
  234 +})
  1 +<!--pages/evaluate/evaluate.wxml-->
  2 +<view class="control">
  3 + <view class="area-box">
  4 + <textarea style="width:100%;" placeholder="请在这里填写评价" maxlength="{{noteMaxLen}}" bindinput="bindWordLimit" />
  5 + <text class="wordLimit ff-hv">{{currentNoteLen|0}}/{{noteMaxLen}}个字</text>
  6 + </view>
  7 + <view class="hr"></view>
  8 +
  9 +
  10 +
  11 + <view class="title">上传照片,最多3张</view>
  12 +
  13 + <view class="imgList_lz">
  14 + <view class="forList" wx:for="{{imgArray}}" wx:key="">
  15 + <image src="{{item}}"></image>
  16 + <view bindtap='del' data-index='{{index}}'>X</view>
  17 + </view>
  18 + <view class="list" bindtap='getImg' wx:if="{{getState}}">
  19 + <image src="../../img/up.png"></image>
  20 + </view>
  21 + </view>
  22 +
  23 + <view class="submit" bindtap='submit'>提交</view>
  24 +
  25 +
  26 +
  27 +
  28 +</view>
  1 +/* pages/evaluate/evaluate.wxss */
  2 +
  3 +.control {
  4 + border-top: 1rpx solid #e4e4e4;
  5 + padding: 56rpx 40rpx;
  6 +}
  7 +
  8 +.area-box {
  9 + font-size: 28rpx;
  10 + color: #999;
  11 +}
  12 +
  13 +.wordLimit {
  14 + display: block;
  15 + float: right;
  16 +}
  17 +
  18 +.hr {
  19 + border-bottom: 1rpx solid #e4e4e4;
  20 + clear: both;
  21 + margin-top: 65rpx;
  22 +}
  23 +
  24 +.title {
  25 + font-size: 26rpx;
  26 + color: #999;
  27 + margin-top: 36rpx;
  28 +}
  29 +
  30 +/* 图片上传预览删除 */
  31 +
  32 +.imgList_lz {
  33 + display: flex;
  34 + justify-content: space-between;
  35 + padding-top: 43rpx;
  36 + flex-wrap: wrap;
  37 +}
  38 +
  39 +.imgList_lz::after {
  40 + content: "";
  41 + width: 188rpx;
  42 +}
  43 +
  44 +.imgList_lz .forList image {
  45 + width: 188rpx;
  46 + height: 188rpx;
  47 +}
  48 +.imgList_lz .forList {
  49 + position: relative;
  50 +}
  51 +.imgList_lz .forList view {
  52 + position: absolute;
  53 + top: -16rpx;
  54 + width: 32rpx;
  55 + height: 32rpx;
  56 + background: #999;
  57 + border-radius: 100%;
  58 + text-align: center;
  59 + line-height: 32rpx;
  60 + left: 100%;
  61 + margin-left: -16rpx;
  62 + font-size: 17rpx;
  63 + color:#fff;
  64 +}
  65 +
  66 +
  67 +
  68 +.imgList_lz .list image {
  69 + width: 188rpx;
  70 + height: 188rpx;
  71 +}
  72 +
  73 +
  74 +
  75 +.submit{
  76 + width:200rpx;
  77 + height:72rpx;
  78 + background:#FFCC00;
  79 + text-align: center;
  80 + line-height: 72rpx;
  81 + border-radius: 36rpx;
  82 + color:#333333;
  83 + font-size: 30rpx;
  84 + margin:0 auto;
  85 + margin-top:112rpx;
  86 +}
  1 +// pages/expectLocation/expectLocation.j
  2 +var app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + provinceStr: [],
  10 + provinceIndex: 0,
  11 + cityStr: ['市'],
  12 + cityIndex: 0,
  13 + districtStr: ['区县'],
  14 + districtIndex: 0,
  15 + streetStr: ['街道'],
  16 + streetIndex: 0,
  17 +
  18 + detailedAddressVal: ""
  19 + },
  20 + // 确定提交
  21 + confirm() {
  22 + wx.showLoading({
  23 + title: '加载中',
  24 + })
  25 + // 三问省一级
  26 + var provinceStr = this.data.provinceStr[this.data.provinceIndex];
  27 + console.log(provinceStr)
  28 + // 三问市一级
  29 + var cityStr = this.data.cityStr[this.data.cityIndex];
  30 + console.log(cityStr)
  31 + // 三问区县一级
  32 + var districtStr = this.data.districtStr[this.data.districtIndex];
  33 + console.log(districtStr)
  34 + // 三问街道一级
  35 + var streetStr = this.data.streetStr[this.data.streetIndex];
  36 + console.log(streetStr)
  37 + // 三问详细地址
  38 + var detailedAddressVal = this.data.detailedAddressVal;
  39 + console.log(detailedAddressVal)
  40 + if (provinceStr != "省") {
  41 + if (cityStr != "市") {
  42 + if (districtStr != "区县") {
  43 + if (streetStr != "街道") {
  44 + if (detailedAddressVal != "") {
  45 + console.log(this.data.province[this.data.provinceIndex - 1].province_id)
  46 + console.log(this.data.city[this.data.cityIndex - 1].city_id)
  47 + console.log(this.data.district[this.data.districtIndex - 1].county_id)
  48 + console.log(this.data.street[this.data.streetIndex - 1].town_id)
  49 + app.ajax("SurveySpot/updateMyHopeSpot", {
  50 + unique_id: app.globalData.unique_id,
  51 + province: provinceStr,
  52 + city: cityStr,
  53 + county: districtStr,
  54 + town: streetStr,
  55 + address: detailedAddressVal,
  56 + province_id: this.data.province[this.data.provinceIndex - 1].province_id,
  57 + city_id: this.data.city[this.data.cityIndex - 1].city_id,
  58 + county_id: this.data.district[this.data.districtIndex - 1].county_id,
  59 + town_id: this.data.street[this.data.streetIndex - 1].town_id
  60 + }, (res) => {
  61 + console.log(res)
  62 + if (res.data.status == true) {
  63 +
  64 + wx.showToast({
  65 + title: res.data.msg,
  66 + icon: 'success',
  67 + duration: 2000
  68 + })
  69 + setTimeout(function () {
  70 + wx.navigateBack({})
  71 + }, 2000)
  72 + } else {
  73 + wx.showModal({
  74 + title: '提示',
  75 + content: res.data.msg,
  76 + success: function (res) {
  77 + if (res.confirm) {
  78 + console.log('用户点击确定')
  79 + } else if (res.cancel) {
  80 + console.log('用户点击取消')
  81 + }
  82 + }
  83 + })
  84 + }
  85 + })
  86 + } else {
  87 + wx.showLoading({
  88 + title: '填写详细地址',
  89 + duration: 1000,
  90 + mask: true
  91 + })
  92 + }
  93 + } else {
  94 + wx.showLoading({
  95 + title: '填写街道信息',
  96 + duration: 1000,
  97 + mask: true
  98 + })
  99 + }
  100 + } else {
  101 + wx.showLoading({
  102 + title: '填写县级信息',
  103 + duration: 1000,
  104 + mask: true
  105 + })
  106 + }
  107 + } else {
  108 + wx.showLoading({
  109 + title: '填写市级信息',
  110 + duration: 1000,
  111 + mask: true
  112 + })
  113 + }
  114 + } else {
  115 + wx.showLoading({
  116 + title: '填写省级信息',
  117 + duration: 1000,
  118 + mask: true
  119 + })
  120 + }
  121 + },
  122 + // 第三问街道
  123 + bindPickerChange5(e) {
  124 + this.setData({
  125 + streetIndex: e.detail.value
  126 + })
  127 + },
  128 + // 第三问区县一级
  129 + bindPickerChange4(e) {
  130 + this.setData({
  131 + districtIndex: e.detail.value
  132 + })
  133 + var county_id = this.data.district[parseInt(e.detail.value) - 1].county_id
  134 + app.ajax("AjaxPosition/town", {
  135 + county_id: county_id
  136 + }, (res) => {
  137 + console.log(res)
  138 + if (res.data.status == true) {
  139 + var data = res.data.data
  140 + var streetStr = ['街道']
  141 + for (let n in data) {
  142 + streetStr.push(data[n].town_name)
  143 + }
  144 + this.setData({
  145 + streetStr: streetStr,
  146 + street: data,
  147 + })
  148 + }
  149 + }, (res) => { })
  150 + },
  151 + // 第三问市一级
  152 + bindPickerChange3(e) {
  153 + this.setData({
  154 + cityIndex: e.detail.value
  155 + })
  156 + var province_id = this.data.city[parseInt(e.detail.value) - 1].city_id
  157 + app.ajax("AjaxPosition/county", {
  158 + city_id: province_id
  159 + }, (res) => {
  160 + console.log(res)
  161 + if (res.data.status == true) {
  162 + var data = res.data.data
  163 + var districtStr = ['区县']
  164 + for (let n in data) {
  165 + districtStr.push(data[n].county_name)
  166 + }
  167 + this.setData({
  168 + districtStr: districtStr,
  169 + district: data,
  170 + // Fordistrict: data
  171 + })
  172 + }
  173 + }, (res) => { })
  174 + },
  175 + // 第三问省一级
  176 + bindPickerChange2(e) {
  177 + console.log(parseInt(e.detail.value) - 1)
  178 + this.setData({
  179 + provinceIndex: e.detail.value
  180 + })
  181 + var province_id = this.data.province[parseInt(e.detail.value) - 1].province_id
  182 + app.ajax("AjaxPosition/city", {
  183 + province_id: province_id
  184 + }, (res) => {
  185 + console.log(res)
  186 + if (res.data.status == true) {
  187 + var data = res.data.data
  188 + var cityStr = ['市']
  189 + for (let n in data) {
  190 + cityStr.push(data[n].city_name)
  191 + }
  192 + this.setData({
  193 + cityStr: cityStr,
  194 + city: data,
  195 + })
  196 + }
  197 + }, (res) => { })
  198 + },
  199 + // 三问详细地址
  200 + detailedAddress(e) {
  201 + var val = e.detail.value;
  202 + this.setData({
  203 + detailedAddressVal: val
  204 + })
  205 + },
  206 + /**
  207 + * 生命周期函数--监听页面加载
  208 + */
  209 + onLoad: function (options) {
  210 +
  211 + },
  212 +
  213 + /**
  214 + * 生命周期函数--监听页面初次渲染完成
  215 + */
  216 + onReady: function () {
  217 +
  218 + },
  219 +
  220 + /**
  221 + * 生命周期函数--监听页面显示
  222 + */
  223 + onShow: function () {
  224 + // 省市区列表
  225 + app.ajax("AjaxPosition/province", {}, (res) => {
  226 + console.log("省一级")
  227 + console.log(res)
  228 + if (res.data.status == true) {
  229 + var province = res.data.data;
  230 + var provinceStr = ['省']
  231 +
  232 + for (let n in province) {
  233 + provinceStr.push(province[n].province_name)
  234 + }
  235 + this.setData({
  236 + province: res.data.data,
  237 + Forprovince: res.data.data,
  238 + provinceStr: provinceStr,
  239 + })
  240 + console.log(provinceStr)
  241 + }
  242 +
  243 + }, (res) => { })
  244 + },
  245 +
  246 + /**
  247 + * 生命周期函数--监听页面隐藏
  248 + */
  249 + onHide: function () {
  250 +
  251 + },
  252 +
  253 + /**
  254 + * 生命周期函数--监听页面卸载
  255 + */
  256 + onUnload: function () {
  257 +
  258 + },
  259 +
  260 + /**
  261 + * 页面相关事件处理函数--监听用户下拉动作
  262 + */
  263 + onPullDownRefresh: function () {
  264 +
  265 + },
  266 +
  267 + /**
  268 + * 页面上拉触底事件的处理函数
  269 + */
  270 + onReachBottom: function () {
  271 +
  272 + },
  273 +
  274 + /**
  275 + * 用户点击右上角分享
  276 + */
  277 + onShareAppMessage: function () {
  278 +
  279 + }
  280 +})
  1 +<!--pages/expectLocation/expectLocation.wxml-->
  2 +<view class="bottom">
  3 + <view class="hint">
  4 + 请写出您最方便的提货地点,下一个自提点很快就在您的公司楼下,家门口或你上班路过的十字路口。
  5 + </view>
  6 + <view class="location">
  7 + <picker bindchange="bindPickerChange2" value="{{provinceIndex}}" range="{{provinceStr}}">
  8 + <view class="section">
  9 + <view class="picker">
  10 + {{provinceStr[provinceIndex]}}
  11 + </view>
  12 + <text class="icon icon-icon-test3"></text>
  13 + </view>
  14 + </picker>
  15 + <picker bindchange="bindPickerChange3" value="{{cityIndex}}" range="{{cityStr}}">
  16 + <view class="section">
  17 + <view class="picker">
  18 + {{cityStr[cityIndex]}}
  19 + </view>
  20 + <text class="icon icon-icon-test3"></text>
  21 + </view>
  22 + </picker>
  23 + <picker bindchange="bindPickerChange4" value="{{districtIndex}}" range="{{districtStr}}">
  24 + <view class="section">
  25 + <view class="picker">
  26 + {{districtStr[districtIndex]}}
  27 + </view>
  28 + <text class="icon icon-icon-test3"></text>
  29 + </view>
  30 + </picker>
  31 + </view>
  32 + <picker bindchange="bindPickerChange5" value="{{streetIndex}}" range="{{streetStr}}">
  33 + <view class="section" style="width:544rpx;margin:0 auto;margin-top:20rpx;">
  34 + <view class="picker" style="font-size:28rpx;color:#999;">
  35 + {{streetStr[streetIndex]}}
  36 + </view>
  37 + <text class="icon icon-icon-test3"></text>
  38 + </view>
  39 + </picker>
  40 +
  41 + <view class="section" style="width:544rpx;margin:0 auto;margin-top:20rpx;">
  42 + <input placeholder='详细地址' bindinput='detailedAddress' style="margin-left:21rpx;color:#999;"></input>
  43 + </view>
  44 +
  45 +
  46 + <view class="confirm" bindtap='confirm'>确认</view>
  47 +</view>
  1 +/* pages/expectLocation/expectLocation.wxss */
  2 +
  3 +.bottom {
  4 + padding: 71rpx 75rpx;
  5 + border-top: 1rpx solid #e4e4e4;
  6 +}
  7 +
  8 +.bottom .hint {
  9 + font-size: 30rpx;
  10 + color: #333;
  11 +}
  12 +
  13 +.location {
  14 + margin-top: 56rpx;
  15 + display: flex;
  16 + justify-content: space-between;
  17 +}
  18 +
  19 +.location .province {
  20 + background: #f7f7f7;
  21 + display: flex;
  22 + justify-content: space-between;
  23 + align-items: center;
  24 + padding: 0 26rpx;
  25 + width: 140rpx;
  26 + height: 64rpx;
  27 +}
  28 +
  29 +.location .province .name {
  30 + font-size: 28rpx;
  31 + color: #999;
  32 +}
  33 +
  34 +.location .province .icon {
  35 + font-size: 19rpx;
  36 + color: #999;
  37 +}
  38 +
  39 +.street {
  40 + margin-top: 20rpx;
  41 + display: flex;
  42 + justify-content: space-between;
  43 + align-items: center;
  44 + height: 64rpx;
  45 + background: #f7f7f7;
  46 + padding: 0 26rpx;
  47 +}
  48 +
  49 +.street .name {
  50 + font-size: 28rpx;
  51 + color: #999;
  52 +}
  53 +
  54 +.street .icon {
  55 + font-size: 19rpx;
  56 + color: #999;
  57 +}
  58 +
  59 +.street input {
  60 + font-size: 28rpx;
  61 + color: #999;
  62 +}
  63 +
  64 +.confirm {
  65 + width: 233rpx;
  66 + height: 72rpx;
  67 + color: #333;
  68 + text-align: center;
  69 + line-height: 72rpx;
  70 + border-radius: 36rpx;
  71 + font-size: 34rpx;
  72 + margin: 0 auto;
  73 + margin-top: 105rpx;
  74 + background: #fc0;
  75 +}
  76 +
  77 +.location {
  78 + display: flex;
  79 + justify-content: space-between;
  80 + width: 544rpx;
  81 + margin: 0 auto;
  82 +}
  83 +
  84 +.location .section {
  85 + width: 169rpx;
  86 + height: 64rpx;
  87 +}
  88 +
  89 +.location .section .picker {
  90 + font-size: 28rpx;
  91 + color: #999;
  92 + overflow: hidden;
  93 + text-overflow: ellipsis;
  94 + white-space: nowrap;
  95 +}
  96 +
  97 +.section {
  98 + width: 271rpx;
  99 + height: 64rpx;
  100 + background: #f7f7f7;
  101 + margin: 0 auto;
  102 + margin-top: 45rpx;
  103 + display: flex;
  104 + justify-content: space-between;
  105 + align-items: center;
  106 + font-size: 30rpx;
  107 +}
  108 +
  109 +.section .icon {
  110 + margin-right: 25rpx;
  111 + color: #999;
  112 + font-size: 25rpx;
  113 +}
  114 +
  115 +.section .picker {
  116 + margin-left: 25rpx;
  117 +}
  1 +// pages/getGoodsDetails/getGoodsDetails.js
  2 +var WxParse = require('../../wxParse/wxParse.js');
  3 +var app = getApp()
  4 +Page({
  5 +
  6 + /**
  7 + * 页面的初始数据
  8 + */
  9 + data: {
  10 + allData:[]
  11 + },
  12 +
  13 + /**
  14 + * 生命周期函数--监听页面加载
  15 + */
  16 + onLoad: function (options) {
  17 + if (options.spot_id) {
  18 + console.log(options.spot_id)
  19 + app.ajax("Spot/detail", {
  20 + id: options.spot_id
  21 + }, (res) => {
  22 + console.log("获取详细地址")
  23 + console.log(res)
  24 + if (res.data.status == true){
  25 + this.setData({
  26 + allData:res.data.data
  27 + })
  28 + WxParse.wxParse('article', 'html', res.data.data.photo, this, 5);
  29 + }
  30 + }, (res) => { })
  31 + }
  32 + },
  33 +
  34 + /**
  35 + * 生命周期函数--监听页面初次渲染完成
  36 + */
  37 + onReady: function () {
  38 +
  39 + },
  40 +
  41 + /**
  42 + * 生命周期函数--监听页面显示
  43 + */
  44 + onShow: function () {
  45 +
  46 + },
  47 +
  48 + /**
  49 + * 生命周期函数--监听页面隐藏
  50 + */
  51 + onHide: function () {
  52 +
  53 + },
  54 +
  55 + /**
  56 + * 生命周期函数--监听页面卸载
  57 + */
  58 + onUnload: function () {
  59 +
  60 + },
  61 +
  62 + /**
  63 + * 页面相关事件处理函数--监听用户下拉动作
  64 + */
  65 + onPullDownRefresh: function () {
  66 +
  67 + },
  68 +
  69 + /**
  70 + * 页面上拉触底事件的处理函数
  71 + */
  72 + onReachBottom: function () {
  73 +
  74 + },
  75 +
  76 + /**
  77 + * 用户点击右上角分享
  78 + */
  79 + onShareAppMessage: function () {
  80 +
  81 + }
  82 +})
  1 +<!--pages/getGoodsDetails/getGoodsDetails.wxml-->
  2 +<import src="/wxParse/wxParse.wxml"/>
  3 +<view class="details">
  4 + <view class="location">详细地址</view>
  5 + <view class="detailsLocation">
  6 + {{allData.spot_detail_address}}
  7 + </view>
  8 + <view class="imglist">
  9 + <view class="title">场景图片</view>
  10 + </view>
  11 + <view class="list">
  12 + <template is="wxParse" data="{{wxParseData:article.nodes}}"/>
  13 + </view>
  14 +</view>
  1 +/* pages/getGoodsDetails/getGoodsDetails.wxss */
  2 +@import "/wxParse/wxParse.wxss";
  3 +.details{
  4 + border-top:1rpx solid #E4E4E4;
  5 + padding:56rpx 38rpx;
  6 +}
  7 +.details .location{
  8 + font-size: 30rpx;
  9 + color:#333333;
  10 + font-weight: 500;
  11 +}
  12 +.details .detailsLocation{
  13 + font-size: 30rpx;
  14 + color:#666666;
  15 + margin-top:38rpx;
  16 +}
  17 +.details .imglist .title{
  18 + font-size: 30rpx;
  19 + color:#333333;
  20 + margin-top:53rpx;
  21 +}
  22 +.details .list{
  23 + margin-top:43rpx;
  24 +}
  25 +/* .details .list image{
  26 + width:670rpx;
  27 + height:340rpx;
  28 + margin-bottom: 30rpx;
  29 +} */
  1 +// pages/guidance/guidance.js
  2 +var app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + // 第四问弹窗
  10 + fourMoudel: false,
  11 + // 第四问省一级
  12 + fourSheng: "省",
  13 + fourcity: "市",
  14 + // 第四问区县
  15 + fourDistrictStr: ["区县"],
  16 + fourDistrictIndex: 0,
  17 + // 第四问美食
  18 + fourFoodVal:"",
  19 + array: ['1', '2', '3', '4','5','6','7'],
  20 + index: 0,
  21 + province: [],
  22 +
  23 + city: [],
  24 +
  25 + district: [],
  26 +
  27 + street: [],
  28 +
  29 + Forprovince: ['省市'],
  30 + ForprovinceIndex: 0,
  31 + Fordistrict: ['区县'],
  32 + FordistrictIndex: 0,
  33 + value: [0, 0],
  34 + provinceStr: [],
  35 + provinceIndex: 0,
  36 + cityStr: ['市'],
  37 + cityIndex: 0,
  38 + districtStr: ['区县'],
  39 + districtIndex: 0,
  40 + streetStr: ['街道'],
  41 + streetIndex: 0,
  42 + // 领取
  43 + ok: false,
  44 + // 所有数据
  45 + allTopic: [],
  46 + // 选择问题-第一题答案
  47 + issue: "北舞渡",
  48 + // 三问详细地址
  49 + detailedAddressVal: "",
  50 + // 优惠券
  51 + discountCoupon:[]
  52 + },
  53 + // 立即领取
  54 + thisGet(e){
  55 + var discount_coupon_name = e.currentTarget.dataset.discount_coupon_name
  56 + var discount_coupon_price = e.currentTarget.dataset.discount_coupon_price
  57 + app.ajax("DiscountCoupon/receiveInquiryDiscountCoupon",{
  58 + unique_id: app.globalData.unique_id,
  59 + discount_coupon_name: discount_coupon_name,
  60 + discount_coupon_price: discount_coupon_price
  61 + },(res)=>{
  62 + console.log(res)
  63 + if(res.data.status == true){
  64 + wx.navigateBack({})
  65 + }
  66 + })
  67 + },
  68 + // 第四问美食input
  69 + fourFood(e) {
  70 + var value = e.detail.value;
  71 + this.setData({
  72 + fourFoodVal: value
  73 + })
  74 + },
  75 + // 第四问区县
  76 + bindPickerChange7(e) {
  77 + this.setData({
  78 + fourDistrictIndex: e.detail.value
  79 + })
  80 + },
  81 + // 第四问空事件
  82 + fourMoudelNull() { },
  83 + // 第四问弹框
  84 + fourMoudel() {
  85 + this.setData({
  86 + fourMoudel: !this.data.fourMoudel
  87 + })
  88 + },
  89 + // 第四问
  90 + bindChange: function (e) {
  91 + wx.showLoading({
  92 + title: '加载中',
  93 + mask: true
  94 + })
  95 + const val = e.detail.value
  96 + console.log(val)
  97 + var province_id = this.data.Forprovince[val[0]].province_id
  98 + app.ajax("AjaxPosition/city", {
  99 + province_id: province_id
  100 + }, (res) => {
  101 + console.log(res)
  102 + if (res.data.status == true) {
  103 + var data = res.data.data
  104 + this.setData({
  105 + Fordistrict: data,
  106 + fourSheng: this.data.Forprovince[val[0]].province_name,
  107 + })
  108 + this.setData({
  109 + fourcity: this.data.Fordistrict[val[1]].city_name,
  110 + value: val
  111 + })
  112 + console.log(this.data.Fordistrict[val[1]].city_id)
  113 + app.ajax("AjaxPosition/county", {
  114 + city_id: this.data.Fordistrict[val[1]].city_id
  115 + }, (res) => {
  116 + console.log(res)
  117 + if (res.data.status == true) {
  118 + wx.hideLoading()
  119 + var data = res.data.data
  120 + var fourDistrictStr = ['区县']
  121 + for (let n in data) {
  122 + fourDistrictStr.push(data[n].county_name)
  123 + }
  124 + this.setData({
  125 + fourDistrictStr: fourDistrictStr,
  126 + })
  127 + }
  128 + }, (res) => { })
  129 + }
  130 + }, (res) => { })
  131 +
  132 +
  133 +
  134 + },
  135 + // 第三问街道
  136 + bindPickerChange5(e) {
  137 + this.setData({
  138 + streetIndex: e.detail.value
  139 + })
  140 + },
  141 + // 第三问区县一级
  142 + bindPickerChange4(e) {
  143 + this.setData({
  144 + districtIndex: e.detail.value
  145 + })
  146 + var county_id = this.data.district[parseInt(e.detail.value) - 1].county_id
  147 + app.ajax("AjaxPosition/town", {
  148 + county_id: county_id
  149 + }, (res) => {
  150 + console.log(res)
  151 + if (res.data.status == true) {
  152 + var data = res.data.data
  153 + var streetStr = ['街道']
  154 + for (let n in data) {
  155 + streetStr.push(data[n].town_name)
  156 + }
  157 + this.setData({
  158 + streetStr: streetStr,
  159 + street: data,
  160 + })
  161 + }
  162 + }, (res) => { })
  163 + },
  164 + // 第三问市一级
  165 + bindPickerChange3(e) {
  166 + this.setData({
  167 + cityIndex: e.detail.value
  168 + })
  169 + var province_id = this.data.city[parseInt(e.detail.value) - 1].city_id
  170 + app.ajax("AjaxPosition/county", {
  171 + city_id: province_id
  172 + }, (res) => {
  173 + console.log(res)
  174 + if (res.data.status == true) {
  175 + var data = res.data.data
  176 + var districtStr = ['区县']
  177 + for (let n in data) {
  178 + districtStr.push(data[n].county_name)
  179 + }
  180 + this.setData({
  181 + districtStr: districtStr,
  182 + district: data,
  183 + // Fordistrict: data
  184 + })
  185 + }
  186 + }, (res) => { })
  187 + },
  188 + // 第三问省一级
  189 + bindPickerChange2(e) {
  190 + console.log(parseInt(e.detail.value) - 1)
  191 + this.setData({
  192 + provinceIndex: e.detail.value
  193 + })
  194 + var province_id = this.data.province[parseInt(e.detail.value) - 1].province_id
  195 + app.ajax("AjaxPosition/city", {
  196 + province_id: province_id
  197 + }, (res) => {
  198 + console.log(res)
  199 + if (res.data.status == true) {
  200 + var data = res.data.data
  201 + var cityStr = ['市']
  202 + for (let n in data) {
  203 + cityStr.push(data[n].city_name)
  204 + }
  205 + this.setData({
  206 + cityStr: cityStr,
  207 + city: data,
  208 + })
  209 + }
  210 + }, (res) => { })
  211 + },
  212 + // 选择答案
  213 + issue(e) {
  214 + var issue = e.currentTarget.dataset.id;
  215 + this.setData({
  216 + issue: issue
  217 + })
  218 + },
  219 + // 挑战完成
  220 + ok() {
  221 + // this.setData({
  222 + // ok: true
  223 + // })
  224 + // 三问省一级
  225 + var provinceStr = this.data.provinceStr[this.data.provinceIndex];
  226 + console.log(provinceStr)
  227 + // 三问市一级
  228 + var cityStr = this.data.cityStr[this.data.cityIndex];
  229 + console.log(cityStr)
  230 + // 三问区县一级
  231 + var districtStr = this.data.districtStr[this.data.districtIndex];
  232 + console.log(districtStr)
  233 + // 三问街道一级
  234 + var streetStr = this.data.streetStr[this.data.streetIndex];
  235 + console.log(streetStr)
  236 + // 三问详细地址
  237 + var detailedAddressVal = this.data.detailedAddressVal;
  238 + console.log(detailedAddressVal)
  239 + // 第四问省市
  240 + var fourShengfourcity = this.data.fourSheng + this.data.fourcity
  241 + console.log(fourShengfourcity)
  242 + // 第四问区县
  243 + var fourDistrictStr = this.data.fourDistrictStr[this.data.fourDistrictIndex];
  244 + console.log(fourDistrictStr)
  245 + // 第四问美食
  246 + var fourFoodVal = this.data.fourFoodVal;
  247 + console.log(fourFoodVal)
  248 + // 省id(自提点)
  249 +
  250 +
  251 +
  252 +
  253 +
  254 + if (provinceStr != "省"){
  255 + if (cityStr != "市"){
  256 + if (districtStr != "区县"){
  257 + if (streetStr != "街道"){
  258 + if (detailedAddressVal != ""){
  259 + if (fourShengfourcity != "省市"){
  260 + if (fourDistrictStr != "区县"){
  261 + if (fourFoodVal != ""){
  262 + console.log(this.data.province[this.data.provinceIndex - 1].province_id)
  263 + console.log(this.data.city[this.data.cityIndex - 1].city_id)
  264 + console.log(this.data.district[this.data.districtIndex - 1].county_id)
  265 + console.log(this.data.street[this.data.streetIndex - 1].town_id)
  266 + app.ajax("Inquiry/submitInquiry",{
  267 + unique_id: app.globalData.unique_id,
  268 + taste: this.data.issue,
  269 + frequency:this.data.array[this.data.index],
  270 + province: provinceStr,
  271 + city: cityStr,
  272 + county: districtStr,
  273 + town: streetStr,
  274 + address: detailedAddressVal,
  275 + f_province: fourShengfourcity,
  276 + f_city: fourDistrictStr,
  277 + food:fourFoodVal,
  278 + province_id: this.data.province[this.data.provinceIndex - 1].province_id,
  279 + city_id: this.data.city[this.data.cityIndex - 1].city_id,
  280 + county_id: this.data.district[this.data.districtIndex - 1].county_id,
  281 + town_id: this.data.street[this.data.streetIndex - 1].town_id
  282 + },(res)=>{
  283 + console.log(res)
  284 + if(res.data.status == true){
  285 + // wx.navigateBack({})
  286 + this.setData({
  287 + ok:true
  288 + })
  289 + }else{
  290 + wx.showModal({
  291 + title: '提示',
  292 + content: res.data.msg,
  293 + success: function (res) {
  294 + if (res.confirm) {
  295 + console.log('用户点击确定')
  296 + } else if (res.cancel) {
  297 + console.log('用户点击取消')
  298 + }
  299 + }
  300 + })
  301 + }
  302 + })
  303 + }else{
  304 + wx.showLoading({
  305 + title: '填写代言信息',
  306 + duration: 1000,
  307 + mask: true
  308 + })
  309 + }
  310 + }else{
  311 + wx.showLoading({
  312 + title: '填写代言信息',
  313 + duration: 1000,
  314 + mask: true
  315 + })
  316 + }
  317 + }else{
  318 + wx.showLoading({
  319 + title: '填写代言信息',
  320 + duration: 1000,
  321 + mask: true
  322 + })
  323 + }
  324 + }else{
  325 + wx.showLoading({
  326 + title: '填写自提信息',
  327 + duration: 1000,
  328 + mask: true
  329 + })
  330 + }
  331 + }else{
  332 + wx.showLoading({
  333 + title: '填写自提信息',
  334 + duration: 1000,
  335 + mask: true
  336 + })
  337 + }
  338 + }else{
  339 + wx.showLoading({
  340 + title: '填写自提信息',
  341 + duration: 1000,
  342 + mask: true
  343 + })
  344 + }
  345 + }else{
  346 + wx.showLoading({
  347 + title: '填写自提信息',
  348 + duration: 1000,
  349 + mask: true
  350 + })
  351 + }
  352 + }else{
  353 + wx.showLoading({
  354 + title: '填写自提信息',
  355 + duration: 1000,
  356 + mask:true
  357 + })
  358 + }
  359 + },
  360 + // 三问详细地址
  361 + detailedAddress(e) {
  362 + var val = e.detail.value;
  363 + this.setData({
  364 + detailedAddressVal: val
  365 + })
  366 + },
  367 + bindPickerChange: function (e) {
  368 + console.log('picker发送选择改变,携带值为', e.detail.value)
  369 + this.setData({
  370 + index: e.detail.value
  371 + })
  372 + },
  373 + /**
  374 + * 生命周期函数--监听页面加载
  375 + */
  376 + onLoad: function (options) {
  377 +
  378 + },
  379 +
  380 + /**
  381 + * 生命周期函数--监听页面初次渲染完成
  382 + */
  383 + onReady: function () {
  384 +
  385 + },
  386 +
  387 + /**
  388 + * 生命周期函数--监听页面显示
  389 + */
  390 + onShow: function () {
  391 + // 获取试题
  392 + app.ajax("Inquiry/index", {}, (res) => {
  393 + console.log("获取试题")
  394 + console.log(res)
  395 + if (res.data.status == true) {
  396 + this.setData({
  397 + allTopic: res.data.data
  398 + })
  399 + }
  400 + })
  401 +
  402 +
  403 + // 省市区列表
  404 + app.ajax("AjaxPosition/province", {}, (res) => {
  405 + console.log("省一级")
  406 + console.log(res)
  407 + if (res.data.status == true) {
  408 + var province = res.data.data;
  409 + var provinceStr = ['省']
  410 +
  411 + for (let n in province) {
  412 + provinceStr.push(province[n].province_name)
  413 + }
  414 + this.setData({
  415 + province: res.data.data,
  416 + Forprovince: res.data.data,
  417 + provinceStr: provinceStr,
  418 + })
  419 + console.log(provinceStr)
  420 + }
  421 +
  422 + }, (res) => { })
  423 +
  424 +
  425 +
  426 + // 获取优惠券
  427 + app.ajax("Inquiry/getSuccessDiscountCoupon",{},(res)=>{
  428 + console.log(res)
  429 + if(res.data.status == true){
  430 + this.setData({
  431 + discountCoupon:res.data.data
  432 + })
  433 + }
  434 + })
  435 + },
  436 +
  437 + /**
  438 + * 生命周期函数--监听页面隐藏
  439 + */
  440 + onHide: function () {
  441 +
  442 + },
  443 +
  444 + /**
  445 + * 生命周期函数--监听页面卸载
  446 + */
  447 + onUnload: function () {
  448 +
  449 + },
  450 +
  451 + /**
  452 + * 页面相关事件处理函数--监听用户下拉动作
  453 + */
  454 + onPullDownRefresh: function () {
  455 +
  456 + },
  457 +
  458 + /**
  459 + * 页面上拉触底事件的处理函数
  460 + */
  461 + onReachBottom: function () {
  462 +
  463 + },
  464 +
  465 + /**
  466 + * 用户点击右上角分享
  467 + */
  468 + onShareAppMessage: function () {
  469 +
  470 + }
  471 +})
  1 +<!--pages/guidance/guidance.wxml-->
  2 +<view style="{{ok==true?'overflow: hidden; position: fixed;top:0;width:100%;height: 100%;':''}}">
  3 +
  4 + <view class="rich">
  5 + {{allTopic.part1}}
  6 + </view>
  7 +
  8 + <view class="topic">
  9 + <view class="title">
  10 + <view class="num">1</view>
  11 + <view class="name">{{allTopic.part2[0].title}}</view>
  12 + </view>
  13 + <view class="gName">{{allTopic.part2[0].content}}</view>
  14 + <view class="List">
  15 + <view class="list" style="{{issue == '胡辣汤'?'background:#FFCC00;':''}}" bindtap='issue' data-id='胡辣汤'>胡辣汤</view>
  16 + <view class="list" style="{{issue == '豆浆'?'background:#FFCC00;':''}}" bindtap='issue' data-id='豆浆'>豆浆</view>
  17 + <view class="list" style="{{issue == '粥类'?'background:#FFCC00;':''}}" bindtap='issue' data-id='粥类'>粥类</view>
  18 + </view>
  19 + </view>
  20 + <view class="topic">
  21 + <view class="title">
  22 + <view class="num">2</view>
  23 + <view class="name">{{allTopic.part2[1].title}}</view>
  24 + </view>
  25 + <view class="gName">{{allTopic.part2[1].content}}</view>
  26 + <picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
  27 + <view class="section">
  28 + <view class="picker">
  29 + {{array[index]}}次
  30 + </view>
  31 + <text class="icon icon-icon-test3"></text>
  32 + </view>
  33 + </picker>
  34 + </view>
  35 + <view class="topic">
  36 + <view class="title">
  37 + <view class="num">3</view>
  38 + <view class="name">{{allTopic.part2[2].title}}</view>
  39 + </view>
  40 + <view class="gName" style="text-align:left;">{{allTopic.part2[2].content}}</view>
  41 + <view class="location">
  42 + <picker bindchange="bindPickerChange2" value="{{provinceIndex}}" range="{{provinceStr}}">
  43 + <view class="section">
  44 + <view class="picker">
  45 + {{provinceStr[provinceIndex]}}
  46 + </view>
  47 + <text class="icon icon-icon-test3"></text>
  48 + </view>
  49 + </picker>
  50 + <picker bindchange="bindPickerChange3" value="{{cityIndex}}" range="{{cityStr}}">
  51 + <view class="section">
  52 + <view class="picker">
  53 + {{cityStr[cityIndex]}}
  54 + </view>
  55 + <text class="icon icon-icon-test3"></text>
  56 + </view>
  57 + </picker>
  58 + <picker bindchange="bindPickerChange4" value="{{districtIndex}}" range="{{districtStr}}">
  59 + <view class="section">
  60 + <view class="picker">
  61 + {{districtStr[districtIndex]}}
  62 + </view>
  63 + <text class="icon icon-icon-test3"></text>
  64 + </view>
  65 + </picker>
  66 + </view>
  67 + <picker bindchange="bindPickerChange5" value="{{streetIndex}}" range="{{streetStr}}">
  68 + <view class="section" style="width:544rpx;margin:0 auto;margin-top:20rpx;">
  69 + <view class="picker" style="font-size:28rpx;color:#999;">
  70 + {{streetStr[streetIndex]}}
  71 + </view>
  72 + <text class="icon icon-icon-test3"></text>
  73 + </view>
  74 + </picker>
  75 +
  76 + <view class="section" style="width:544rpx;margin:0 auto;margin-top:20rpx;">
  77 + <input placeholder='详细地址' bindinput='detailedAddress' style="margin-left:21rpx;color:#999;"></input>
  78 + </view>
  79 +
  80 + </view>
  81 +
  82 +
  83 + <view class="topic">
  84 + <view class="title">
  85 + <view class="num">4</view>
  86 + <view class="name">第四问</view>
  87 + </view>
  88 + <view class="question">
  89 + <text>我为故乡</text>
  90 + <view bindtap='fourMoudel' style="display: flex;align-items: center;width:169rpx;height:64rpx;background:#F7F7F7; justify-content: space-between;margin-left:22rpx;">
  91 + <view class="picker" style="color:#999;margin-left:27rpx;font-size:28rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
  92 + {{fourSheng}}{{fourcity}}
  93 + </view>
  94 + <text class="icon icon-icon-test3" style="color:#999;font-size:28rpx;margin-right:16rpx;margin-right:18rpx;"></text>
  95 + </view>
  96 +
  97 + <picker bindchange="bindPickerChange7" value="{{fourDistrictIndex}}" range="{{fourDistrictStr}}">
  98 + <view style="display: flex;align-items: center;width:169rpx;height:64rpx;background:#F7F7F7; justify-content: space-between;margin-left:22rpx;">
  99 + <view class="picker" style="color:#999;margin-left:27rpx;font-size:28rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
  100 + {{fourDistrictStr[fourDistrictIndex]}}
  101 + </view>
  102 + <text class="icon icon-icon-test3" style="color:#999;font-size:28rpx;margin-right:16rpx;margin-right:18rpx;"></text>
  103 + </view>
  104 + </picker>
  105 + <text style="margin-left:18rpx;">代言</text>
  106 + </view>
  107 + <view class="question">
  108 + <text>我最爱的家乡美味:</text>
  109 + <input wx:if="{{fourMoudel == false}}" bindinput='fourFood' style="width:297rpx;height:64rpx;background:#F7F7F7;"></input>
  110 + </view>
  111 + </view>
  112 +
  113 +
  114 + <view class="ok" bindtap='ok'>挑战完成</view>
  115 +
  116 +
  117 +
  118 +</view>
  119 +<!-- -->
  120 +<view class="onMoudel" wx:if="{{ok}}">
  121 + <view class="moudel">
  122 + <view class="title">
  123 + • 挑战成功 •
  124 + </view>
  125 + <view class="hit">{{discountCoupon.textarea}}</view>
  126 + <view class="moneyP">
  127 + <view class="money">¥
  128 + <text>{{discountCoupon.discount_coupon_price}}</text> </view>
  129 + <view class="font">{{discountCoupon.discount_coupon_name}}</view>
  130 + </view>
  131 + <view class="thisGet" bindtap='thisGet' data-discount_coupon_name='{{discountCoupon.discount_coupon_name}}' data-discount_coupon_price="{{discountCoupon.discount_coupon_price}}">立即领取</view>
  132 + </view>
  133 +</view>
  134 +
  135 +
  136 +
  137 +<view class="fourMoudel" bindtap='fourMoudel' wx:if="{{fourMoudel}}">
  138 + <view class="fourMoudelC">确定</view>
  139 + <picker-view catchtap='fourMoudelNull' class="moudelsss" indicator-style="height: 50px;" style="width: 100%; height: 300px;" value="{{value}}" bindchange="bindChange">
  140 + <picker-view-column>
  141 + <view wx:for="{{Forprovince}}" style="line-height: 50px;text-align:center;">{{item.province_name}}</view>
  142 + </picker-view-column>
  143 +
  144 + <picker-view-column>
  145 + <view wx:for="{{Fordistrict}}" style="line-height: 50px;text-align:center;">{{item.city_name}}</view>
  146 + </picker-view-column>
  147 + </picker-view>
  148 +</view>
  1 +/* pages/guidance/guidance.wxss */
  2 +
  3 +.rich {
  4 + padding: 58rpx 0;
  5 + border-top: 1rpx solid #e4e4e4;
  6 + border-bottom: 1rpx solid #e4e4e4;
  7 +}
  8 +
  9 +.topic {
  10 + padding: 60rpx 53rpx 65rpx 53rpx;
  11 + border-bottom: 1rpx solid #e4e4e4;
  12 +}
  13 +
  14 +.topic .title {
  15 + display: flex;
  16 + align-items: center;
  17 +}
  18 +
  19 +.topic .title .num {
  20 + width: 32rpx;
  21 + height: 32rpx;
  22 + border-radius: 32rpx;
  23 + text-align: center;
  24 + line-height: 32rpx;
  25 + color: #fff;
  26 + background: #fc0;
  27 + font-size: 26rpx;
  28 +}
  29 +
  30 +.topic .title .name {
  31 + font-size: 32rpx;
  32 + color: #fab701;
  33 + margin-left: 15rpx;
  34 +}
  35 +
  36 +.topic .gName {
  37 + font-size: 30rpx;
  38 + color: #1a1a1a;
  39 + text-align: center;
  40 + width: 544rpx;
  41 + margin: 0 auto;
  42 + margin-top: 35rpx;
  43 +}
  44 +
  45 +.topic .List {
  46 + display: flex;
  47 + justify-content: space-around;
  48 + flex-wrap: wrap;
  49 + margin-top: 50rpx;
  50 +}
  51 +
  52 +.topic .List .list {
  53 + font-size: 28rpx;
  54 + width: 146rpx;
  55 + height: 59rpx;
  56 + text-align: center;
  57 + line-height: 59rpx;
  58 + color: #333;
  59 + background: #f7f7f7;
  60 + margin-bottom: 20rpx;
  61 + margin-right: 20rpx;
  62 +}
  63 +
  64 +.topic .List::after {
  65 + content: "";
  66 + width: 146rpx;
  67 + margin-right: 20rpx;
  68 +}
  69 +
  70 +.section {
  71 + width: 271rpx;
  72 + height: 64rpx;
  73 + background: #f7f7f7;
  74 + margin: 0 auto;
  75 + margin-top: 45rpx;
  76 + display: flex;
  77 + justify-content: space-between;
  78 + align-items: center;
  79 + font-size: 30rpx;
  80 +}
  81 +
  82 +.section .icon {
  83 + margin-right: 25rpx;
  84 + color: #999;
  85 + font-size: 25rpx;
  86 +}
  87 +
  88 +.section .picker {
  89 + margin-left: 25rpx;
  90 +}
  91 +
  92 +.location {
  93 + display: flex;
  94 + justify-content: space-between;
  95 + width: 544rpx;
  96 + margin: 0 auto;
  97 +}
  98 +
  99 +.location .section {
  100 + width: 169rpx;
  101 + height: 64rpx;
  102 +}
  103 +
  104 +.location .section .picker {
  105 + font-size: 28rpx;
  106 + color: #999;
  107 + overflow: hidden;
  108 + text-overflow: ellipsis;
  109 + white-space: nowrap;
  110 +}
  111 +
  112 +.question {
  113 + font-size: 30rpx;
  114 + color: #1a1a1a;
  115 + display: flex;
  116 + align-items: center;
  117 + width: 577rpx;
  118 + margin: 0 auto;
  119 + margin-top: 45rpx;
  120 +}
  121 +
  122 +.ok {
  123 + width: 223rpx;
  124 + height: 72rpx;
  125 + text-align: center;
  126 + line-height: 72rpx;
  127 + margin: 0 auto;
  128 + color: #333;
  129 + font-size: 34rpx;
  130 + background: #fc0;
  131 + border-radius: 36rpx;
  132 + margin-top: 34rpx;
  133 +}
  134 +
  135 +.onMoudel {
  136 + position: fixed;
  137 + top: 0;
  138 + width: 100%;
  139 + height: 100%;
  140 + background: rgba(1, 1, 1, 0.5);
  141 +}
  142 +
  143 +.onMoudel .moudel {
  144 + width: 636rpx;
  145 + height: 587rpx;
  146 + margin: 0 auto;
  147 + margin-top: 286rpx;
  148 + background-image: url(http://omega.wx.bronet.cn/public/static/images/413@2x.png);
  149 + background-size: 100% 100%;
  150 + overflow: hidden;
  151 +}
  152 +
  153 +.onMoudel .moudel .moneyP {
  154 + display: flex;
  155 + margin-top: 87rpx;
  156 +}
  157 +
  158 +.onMoudel .moudel .moneyP .money {
  159 + color: #d43d31;
  160 + font-size: 36rpx;
  161 + margin-left: 131rpx;
  162 +}
  163 +
  164 +.onMoudel .moudel .moneyP .money text {
  165 + font-size: 60rpx;
  166 + font-weight: 800;
  167 +}
  168 +
  169 +.onMoudel .moudel .moneyP .font {
  170 + font-size: 36rpx;
  171 + width: 370rpx;
  172 + line-height: 93rpx;
  173 + text-align: center;
  174 + color: #d43d31;
  175 +}
  176 +
  177 +.onMoudel .moudel .title {
  178 + color: #fff;
  179 + text-align: center;
  180 + font-size: 48rpx;
  181 + margin-top: 55rpx;
  182 + position: relative;
  183 + width: 320rpx;
  184 + left: 50%;
  185 + margin-left: -160rpx;
  186 +}
  187 +
  188 +.onMoudel .moudel .title::after {
  189 + content: "";
  190 + width: 45rpx;
  191 + height: 5rpx;
  192 + background: #fff;
  193 + position: absolute;
  194 + top: 50%;
  195 + left: 0;
  196 + margin-top: -2.5rpx;
  197 +}
  198 +
  199 +.onMoudel .moudel .title::before {
  200 + content: "";
  201 + width: 45rpx;
  202 + height: 5rpx;
  203 + background: #fff;
  204 + position: absolute;
  205 + top: 50%;
  206 + left: 100%;
  207 + margin-top: -2.5rpx;
  208 + margin-left: -45rpx;
  209 +}
  210 +
  211 +.thisGet {
  212 + color: #d43d31;
  213 + font-size: 36rpx;
  214 + width: 403rpx;
  215 + height: 74rpx;
  216 + background: #fde03c;
  217 + border-radius: 37rpx;
  218 + margin: 0 auto;
  219 + margin-top: 125rpx;
  220 + text-align: center;
  221 + line-height: 74rpx;
  222 +}
  223 +
  224 +.onMoudel .moudel .hit {
  225 + font-size: 24rpx;
  226 + color: #fff;
  227 + text-align: center;
  228 + margin-top: 13rpx;
  229 + width: 100%;
  230 +}
  231 +
  232 +page {
  233 + padding-bottom: 46rpx;
  234 +}
  235 +
  236 +.fourMoudel {
  237 + position: fixed;
  238 + top: 0;
  239 + width: 100%;
  240 + height: 100%;
  241 + background: rgba(1, 1, 1, 0.5);
  242 +}
  243 +
  244 +.moudelsss {
  245 + position: absolute;
  246 + bottom: 0;
  247 + width: 100%;
  248 + height: 100%;
  249 + background: #fff;
  250 +}
  251 +
  252 +.fourMoudelC {
  253 + color: #fff;
  254 + text-align: right;
  255 + margin-top: 604rpx;
  256 + padding-right: 23rpx;
  257 +}
  1 +var app = getApp();
  2 +var animation = wx.createAnimation({
  3 + duration: 1000,
  4 + timingFunction: "ease",
  5 +})
  6 +Page({
  7 + data: {
  8 + winHeight: "",//窗口高度
  9 + currentTab: 0, //预设当前项的值
  10 + scrollLeft: 0, //tab标题的滚动条位置
  11 + expertList: [{}],
  12 + imgUrls: [],
  13 + indicatorDots: true,
  14 + autoplay: true,
  15 + interval: 3000,
  16 + duration: 1000,
  17 + // 筛选 ------------
  18 + winWidth: 0,
  19 + winHeight: 0,
  20 + // tab切换
  21 + currentTabT: 0,
  22 + // 筛选框状态
  23 + screenModel: false,
  24 + tabBarIndex: [],
  25 + // 动画状态
  26 + animation: false,
  27 + animations: false,
  28 + moudelOne: true,
  29 + authorization: false,
  30 +
  31 + // 首页数据
  32 + allData: [],
  33 + // 自提点列表
  34 + sinceList: [],
  35 + // 堂食店铺列表
  36 + hallListh: [],
  37 + // 就近自提
  38 + nearest_spot: "",
  39 + // 到店堂食
  40 + nearest_store: "",
  41 + stateShop: false,
  42 + // 是否开启调研按钮
  43 + diaoyan: false,
  44 +
  45 + // 判断设备活动快距离
  46 + rpx: 0,
  47 + // 递减cart_id
  48 + cart_id:null,
  49 + menu: false,
  50 + canaction: false //阻止快速点击事件
  51 + },
  52 + // 没有门口
  53 + sisi() {
  54 + wx.navigateTo({
  55 + url: '../expectLocation/expectLocation',
  56 + })
  57 + },
  58 + // 选择到店堂食
  59 + arriveShop(e) {
  60 + wx.showLoading({
  61 + title: '地址切换中。。。',
  62 + })
  63 + console.log(app.globalData.nearest_store)
  64 + var data = e.currentTarget.dataset.data;
  65 + var params = new Object;
  66 + params.store_id = data.store_id;
  67 + params.store_name = data.store_name + data.store_address + ",距您" + data.distance_text
  68 + app.globalData.nearest_store = params;
  69 + console.log(app.globalData.nearest_store)
  70 + this.setData({
  71 + moudelOne: true,
  72 + stateShop: true,
  73 + nearest_store: app.globalData.nearest_store
  74 + })
  75 + wx.showToast({
  76 + title: '切换完成',
  77 + icon: 'success',
  78 + duration: 2000
  79 + })
  80 + },
  81 + // 选择就近自提
  82 + setLocation(e) {
  83 + wx.showLoading({
  84 + title: '地址切换中。。。',
  85 + })
  86 + var spot_id = e.currentTarget.dataset.spot_id;
  87 + var spot_name = e.currentTarget.dataset.spot_name;
  88 + var distance_text = e.currentTarget.dataset.distance_text;
  89 + var params = new Object;
  90 + params.spot_id = spot_id;
  91 + params.spot_name = spot_name + distance_text;
  92 + app.globalData.nearest_spot = params;
  93 + console.log(app.globalData.nearest_spot)
  94 + this.setData({
  95 + screenModel: false,
  96 + nearest_spot: app.globalData.nearest_spot
  97 + })
  98 + wx.showToast({
  99 + title: '切换完成',
  100 + icon: 'success',
  101 + duration: 2000
  102 + })
  103 + },
  104 + // 判断是否新人能否领取优惠券
  105 + justy(){
  106 + app.ajax("Index/isFirst", {
  107 + unique_id: app.globalData.unique_id
  108 + }, (res) => {
  109 + console.log(res)
  110 + if (res.statusCode == '200'){
  111 + this.setData({
  112 + card: res.data.status,
  113 + cardInfo: res.data.data
  114 + })
  115 + }
  116 + })
  117 + },
  118 + // 授权登陆
  119 + bindGetUserInfo(e) {
  120 + var that = this
  121 + console.log(e)
  122 + console.log(e.detail.userInfo)
  123 + app.globalData.userInfo = e.detail.userInfo
  124 + wx.login({
  125 + success: (res) => {
  126 + if (res.code) {
  127 + //发起网络请求
  128 + console.log(res)
  129 + app.ajax("Index/auth", {
  130 + code: res.code,
  131 + iv: e.detail.iv,
  132 + encryptedData: e.detail.encryptedData,
  133 + nickname: app.globalData.userInfo.nickName,
  134 + head_img: app.globalData.userInfo.avatarUrl,
  135 + }, (res) => {
  136 + this.onShow()
  137 + if (res.data.data.is_auth == 1) {
  138 + app.globalData.unique_id = res.data.data.unique_id
  139 + if (that.data.from) {
  140 + app.ajax("DiscountCoupon/shareGetCoupon", {
  141 + from: that.data.from,
  142 + to: app.globalData.unique_id
  143 + }, (res) => {
  144 + console.log(res)
  145 + })
  146 + }
  147 + this.setData({
  148 + authorization: false
  149 + })
  150 + }
  151 + })
  152 + } else {
  153 + console.log('获取用户登录态失败!' + res.errMsg)
  154 + }
  155 + }
  156 + });
  157 +
  158 + },
  159 + hideCard(){
  160 + this.setData({
  161 + card: false
  162 + })
  163 + },
  164 + getCard(event){
  165 + let that = this
  166 + let info = this.data.cardInfo
  167 + var params = Object.assign({},info)
  168 + params.unique_id = app.globalData.unique_id
  169 + app.ajax("Index/receivePledge", params, (res) => {
  170 + console.log(res)
  171 + if(res.data.state == 'success'){
  172 + that.hideCard()
  173 + wx.showToast({
  174 + title: res.data.msg,
  175 + icon: 'success'
  176 + })
  177 + }
  178 + })
  179 + },
  180 + // 递增操作
  181 + addCount(e) {
  182 + wx.showLoading({
  183 + title: '加载中',
  184 + mask: true
  185 + })
  186 + var index = e.currentTarget.dataset.index;
  187 + var id = e.currentTarget.dataset.id;
  188 + var num = parseInt(e.currentTarget.dataset.num);
  189 + num++
  190 + app.ajax("Cart/add", {
  191 + unique_id: app.globalData.unique_id,
  192 + goods_id: id,
  193 + goods_num: 1,
  194 + }, (res) => {
  195 + console.log(res)
  196 + wx.hideLoading()
  197 + if (res.data.status == true) {
  198 + var data = this.data.allData.goods_list;
  199 + data[index].chacke = true;
  200 + data[index].num = num;
  201 + this.setData({
  202 + "allData.goods_list": data
  203 + })
  204 + // 获取购物车数量
  205 + app.ajax("CountNum/countCart", {
  206 + unique_id: app.globalData.unique_id
  207 + }, (res) => {
  208 + console.log(res)
  209 + if (res.data.status == true) {
  210 + app.globalData.tabBar[1].num = res.data.data[0].count
  211 + this.setData({
  212 + tabBarIndex: app.globalData.tabBar
  213 + })
  214 + }
  215 + }, (res) => { })
  216 + }else{
  217 + wx.showToast({
  218 + title: res.data.msg,
  219 + icon: 'none'
  220 + })
  221 + }
  222 + })
  223 + },
  224 + // 递减操作
  225 + minusCount(e) {
  226 + wx.showLoading({
  227 + title: '加载中',
  228 + mask:true
  229 + })
  230 + var index = e.currentTarget.dataset.index;
  231 + var id = e.currentTarget.dataset.id;
  232 + var num = parseInt(e.currentTarget.dataset.num);
  233 + var cart_id = e.currentTarget.dataset.cart_id
  234 + if(num<=1){
  235 + app.ajax("Cart/del", {
  236 + cart_id: cart_id
  237 + }, (res) => {
  238 + console.log(res)
  239 + if (res.data.status == true) {
  240 + // this.getShopCar()
  241 + var data = this.data.allData.goods_list;
  242 + data[index].chacke = false;
  243 + this.setData({
  244 + "allData.goods_list": data
  245 + })
  246 + // 获取购物车数量
  247 + app.ajax("CountNum/countCart", {
  248 + unique_id: app.globalData.unique_id
  249 + }, (res) => {
  250 + console.log(res)
  251 + wx.hideLoading()
  252 + if (res.data.status == true) {
  253 + app.globalData.tabBar[1].num = res.data.data[0].count
  254 + this.setData({
  255 + tabBarIndex: app.globalData.tabBar
  256 + })
  257 + // console.log(res.data.data[0].count)
  258 + }
  259 +
  260 + }, (res) => { })
  261 + }
  262 + }, (res) => { })
  263 + }else{
  264 + num--
  265 + app.ajax("Cart/add", {
  266 + unique_id: app.globalData.unique_id,
  267 + goods_id: id,
  268 + goods_num: -1,
  269 + }, (res) => {
  270 + console.log(res)
  271 + wx.hideLoading()
  272 + if (res.data.status == true) {
  273 + var data = this.data.allData.goods_list;
  274 + data[index].chacke = true;
  275 + data[index].num = num;
  276 + this.setData({
  277 + "allData.goods_list": data,
  278 + cart_id: res.data.cart_id
  279 + })
  280 + // 获取购物车数量
  281 + app.ajax("CountNum/countCart", {
  282 + unique_id: app.globalData.unique_id
  283 + }, (res) => {
  284 + console.log(res)
  285 + if (res.data.status == true) {
  286 + app.globalData.tabBar[1].num = res.data.data[0].count
  287 + this.setData({
  288 + tabBarIndex: app.globalData.tabBar
  289 + })
  290 + }
  291 + }, (res) => { })
  292 + }
  293 + })
  294 + }
  295 + // if (num < 1) {
  296 +
  297 + // } else {
  298 + // num--
  299 + // app.ajax("Cart/editNum", {
  300 + // goods_num: -1
  301 + // }, (res) => {
  302 + // console.log(res)
  303 + // if (res.data.status == true) {
  304 + // this.getShopCar()
  305 + // // 获取购物车数量
  306 + // app.ajax("CountNum/countCart", {
  307 + // unique_id: app.globalData.unique_id
  308 + // }, (res) => {
  309 + // console.log(res)
  310 + // if (res.data.status == true) {
  311 + // if (parseInt(res.data.data[0].count) == 0) {
  312 + // wx.showModal({
  313 + // title: '提示',
  314 + // content: '是否删除该商品',
  315 + // success: (res) => {
  316 + // if (res.confirm) {
  317 + // console.log('用户点击确定')
  318 + // app.ajax("Cart/del", {
  319 + // cart_id: cart_id
  320 + // }, (res) => {
  321 + // console.log(res)
  322 + // if (res.data.status == true) {
  323 + // this.getShopCar()
  324 + // // 获取购物车数量
  325 + // app.ajax("CountNum/countCart", {
  326 + // unique_id: app.globalData.unique_id
  327 + // }, (res) => {
  328 + // console.log(res)
  329 + // if (res.data.status == true) {
  330 + // app.globalData.tabBar[1].num = res.data.data[0].count
  331 + // this.setData({
  332 + // tabBarIndex: app.globalData.tabBar
  333 + // })
  334 + // }
  335 + // }, (res) => { })
  336 + // }
  337 + // }, (res) => { })
  338 + // } else if (res.cancel) {
  339 + // console.log('用户点击取消')
  340 + // }
  341 + // }
  342 + // })
  343 + // }
  344 + // app.globalData.tabBar[1].num = res.data.data[0].count
  345 + // this.setData({
  346 + // tabBarIndex: app.globalData.tabBar
  347 + // })
  348 + // }
  349 + // }, (res) => { })
  350 + // }
  351 + // }, (res) => { })
  352 + // }
  353 +
  354 +
  355 + },
  356 + // 商品列表加入购物车
  357 + openShopCar(e) {
  358 + var index = e.currentTarget.dataset.index;
  359 + var id = e.currentTarget.dataset.id;
  360 + var num = e.currentTarget.dataset.num;
  361 + app.ajax("Cart/add", {
  362 + unique_id: app.globalData.unique_id,
  363 + goods_id: id,
  364 + goods_num: num,
  365 + }, (res) => {
  366 + console.log(res)
  367 + if (res.data.status == true) {
  368 + var data = this.data.allData.goods_list;
  369 + data[index].chacke = true;
  370 + data[index].cart_id = res.data.cart_id
  371 + this.setData({
  372 + "allData.goods_list": data
  373 + })
  374 +
  375 + // 获取购物车数量
  376 + app.ajax("CountNum/countCart", {
  377 + unique_id: app.globalData.unique_id
  378 + }, (res) => {
  379 + console.log(res)
  380 + if (res.data.status == true) {
  381 + app.globalData.tabBar[1].num = res.data.data[0].count
  382 + this.setData({
  383 + tabBarIndex: app.globalData.tabBar
  384 + })
  385 + }
  386 + }, (res) => { })
  387 + // 获取购物车
  388 + app.ajax("Cart/index", {
  389 + unique_id: app.globalData.unique_id
  390 + }, (res) => {
  391 + console.log("获取购物车")
  392 + console.log(res)
  393 + if (res.data.status == true) {
  394 + app.globalData.shoppingCart = res.data.data
  395 + console.log(app.globalData.tabBar)
  396 + }
  397 + }, (res) => { })
  398 + }else{
  399 + wx.showToast({
  400 + title: '库存不足',
  401 + icon: 'none'
  402 + })
  403 + }
  404 + })
  405 + },
  406 + // 引导页
  407 + guidance() {
  408 + wx.navigateTo({
  409 + url: '../guidance/guidance',
  410 + })
  411 + },
  412 + // 门店详情
  413 + shopDetails(e) {
  414 + var store_id = e.currentTarget.dataset.store_id;
  415 + var store_name = e.currentTarget.dataset.store_name;
  416 + var open_start = e.currentTarget.dataset.open_start;
  417 + var open_end = e.currentTarget.dataset.open_end;
  418 + var store_address = e.currentTarget.dataset.store_address;
  419 + var distance_text = e.currentTarget.dataset.distance_text;
  420 + wx.navigateTo({
  421 + url: '../shopDetails/shopDetails?store_id=' + store_id + "&store_name=" + store_name + "&open_start=" + open_start + "&open_end=" + open_end + "&store_address=" + store_address + "&distance_text=" + distance_text,
  422 + })
  423 + },
  424 + // 下导航
  425 + tabBar(e) {
  426 + var index = e.currentTarget.dataset.index;
  427 + var tabBar = app.globalData.tabBar
  428 + for (let n in tabBar) {
  429 + tabBar[n].state = false
  430 + }
  431 + tabBar[index].state = !tabBar[index].state
  432 + app.globalData.tabBar = tabBar
  433 + wx.reLaunch({
  434 + url: tabBar[index].url,
  435 + })
  436 + },
  437 + // 列表详情
  438 + detailsGoods(e) {
  439 + var id = e.currentTarget.dataset.id;
  440 + wx.navigateTo({
  441 + url: '../detailsGoods/detailsGoods?id=' + id,
  442 + })
  443 + },
  444 + // 取货点详情
  445 + getGoodsDetails(e) {
  446 + let spot_id = e.currentTarget.dataset.spot_id;
  447 + wx.navigateTo({
  448 + url: '../getGoodsDetails/getGoodsDetails?spot_id=' + spot_id,
  449 + })
  450 + },
  451 + // 防止穿透
  452 + cat() { },
  453 + // 点击收起筛选
  454 + model() {
  455 + console.log(1)
  456 + this.setData({
  457 + screenModel: !this.data.screenModel
  458 + })
  459 + },
  460 + // 滚动切换标签样式
  461 + switchTab: function (e) {
  462 + this.setData({
  463 + currentTab: e.detail.current
  464 + });
  465 + this.checkCor();
  466 + },
  467 + // 点击标题切换当前页时改变样式
  468 + swichNav: function (e) {
  469 + console.log(e)
  470 + if (!this.data.canaction){
  471 + return false
  472 + }else{
  473 + this.setData({
  474 + canaction: false
  475 + })
  476 + var cur = e.target.dataset.current;
  477 + var t_id = e.currentTarget.dataset.t_id;
  478 + if (this.data.currentTaB == cur) {
  479 + return false;
  480 + }else {
  481 + this.setData({
  482 + currentTab: cur
  483 + })
  484 + }
  485 + wx.showLoading({
  486 + title: '加载中',
  487 + })
  488 + var params = new Object
  489 + if (cur == 0){
  490 + params.unique_id = app.globalData.unique_id
  491 + }else if(cur == '-1'){
  492 + params.unique_id = app.globalData.unique_id
  493 + app.ajax("Index/newGoodsList", params, (res) => {
  494 + wx.hideLoading()
  495 + if (res.statusCode == '200') {
  496 + var mes = res.data.data
  497 + var data = mes;
  498 + for (let n in data) {
  499 + data[n].chacke = false
  500 + data[n].num = 1
  501 + }
  502 + for (let n in data) {
  503 + if (data[n].goods_num != null) {
  504 + data[n].chacke = true
  505 + data[n].num = parseInt(data[n].goods_num)
  506 + }
  507 + }
  508 + this.setData({
  509 + 'allData.goods_list': mes,
  510 + canaction: true
  511 + })
  512 + // this.setData({
  513 + // allData: res.data.data,
  514 + // imgUrls: res.data.data.banner
  515 + // })
  516 + } else {
  517 + wx.showLoading({
  518 + title: '暂无商品',
  519 + duration: 1000
  520 + })
  521 + this.setData({
  522 + "allData.goods_list": [],
  523 + canaction: true
  524 + })
  525 + }
  526 + }, (res) => { })
  527 +
  528 + return false
  529 + }else{
  530 + params.t_id = t_id
  531 + params.unique_id = app.globalData.unique_id
  532 + }
  533 + app.ajax("Index/index",params, (res) => {
  534 + wx.hideLoading()
  535 + console.log("获取首页数据")
  536 + console.log(res)
  537 + if (res.data.status == true) {
  538 + var mes = res.data.data
  539 + var data = mes.goods_list;
  540 + for (let n in data) {
  541 + data[n].chacke = false
  542 + data[n].num = 1
  543 + }
  544 + for (let n in data) {
  545 + if (data[n].goods_num != null) {
  546 + data[n].chacke = true
  547 + data[n].num = parseInt(data[n].goods_num)
  548 + }
  549 + }
  550 + app.globalData.nearest_spot = mes.nearest_spot
  551 + app.globalData.nearest_store = mes.nearest_store
  552 + this.setData({
  553 + allData: mes,
  554 + menu: true,
  555 + imgUrls: res.data.data.banner,
  556 + nearest_spot: app.globalData.nearest_spot,
  557 + nearest_store: app.globalData.nearest_store,
  558 + canaction: true
  559 + })
  560 +
  561 + } else {
  562 + wx.showLoading({
  563 + title: '暂无商品',
  564 + duration: 1000
  565 + })
  566 + this.setData({
  567 + "allData.goods_list": [],
  568 + canaction: true
  569 + })
  570 + }
  571 + }, (res) => { })
  572 +
  573 + }
  574 + },
  575 + //判断当前滚动超过一屏时,设置tab标题滚动条。
  576 + checkCor: function () {
  577 + if (this.data.currentTab > 4) {
  578 + this.setData({
  579 + scrollLeft: 300
  580 + })
  581 + } else {
  582 + this.setData({
  583 + scrollLeft: 0
  584 + })
  585 + }
  586 + },
  587 + /**
  588 + * 滑动切换tab
  589 + */
  590 + bindChangeT: function (e) {
  591 +
  592 + var that = this;
  593 + that.setData({ currentTabT: e.detail.current });
  594 +
  595 + },
  596 + /**
  597 + * 点击tab切换
  598 + */
  599 + swichNavT: function (e) {
  600 +
  601 + var that = this;
  602 +
  603 + if (this.data.currentTabT === e.target.dataset.current) {
  604 + return false;
  605 + } else {
  606 + that.setData({
  607 + currentTabT: e.target.dataset.current
  608 + })
  609 + }
  610 + var area_id = e.target.dataset.area_id;
  611 +
  612 + app.ajax("Spot/index", {
  613 + area_id: area_id,
  614 + unique_id: app.globalData.unique_id
  615 + }, (res) => {
  616 + console.log("获取自提点数据")
  617 + console.log(res)
  618 + if (res.data.status == true) {
  619 + this.setData({
  620 + sinceList: res.data.data
  621 + })
  622 + if (res.data.data.spot == null) {
  623 + wx.showLoading({
  624 + title: '空空如也',
  625 + duration: 1000,
  626 + mask: true
  627 + })
  628 +
  629 + }
  630 + }
  631 + }, (res) => { })
  632 + },
  633 + // 动画
  634 + animations(e) {
  635 + var state = e.currentTarget.dataset.state;
  636 + var type = e.currentTarget.dataset.type
  637 + console.log(this.data.animation)
  638 + console.log(state)
  639 + if (this.data.animations == false && state == false) {
  640 + console.log(1)
  641 + this.setData({
  642 + screenModel: !this.data.screenModel,
  643 + })
  644 + } else if (this.data.animations == true && state == true) {
  645 + if (this.data.moudelOne){
  646 + this.setData({
  647 + moudelOne: false
  648 + })
  649 + }else{
  650 + this.setData({
  651 + moudelOne: true
  652 + })
  653 + }
  654 + // this.setData({
  655 + // animation: true,
  656 + // stateShop: true
  657 + // })
  658 + } else if (this.data.animations == false && state == true) {
  659 + console.log(3)
  660 + console.log(this.data.rpx)
  661 + animation.translate((96 * 1.8) * this.data.rpx).step();
  662 + app.globalData.btnStart = false
  663 + this.setData({
  664 + animationData: animation.export(),
  665 + animations: true,
  666 + moudelOne: false,
  667 + stateShop: !this.data.stateShop,
  668 + screenModel: false
  669 + })
  670 + } else if (this.data.animations == true && state == false) {
  671 + console.log(4)
  672 + animation.translate(0).step();
  673 + app.globalData.btnStart = true
  674 + this.setData({
  675 + animationData: animation.export(),
  676 + animations: false,
  677 + moudelOne: true,
  678 + stateShop: !this.data.stateShop,
  679 + screenModel:true
  680 + })
  681 + }
  682 +
  683 + },
  684 +
  685 + onLoad: function (options) {
  686 + if (options.from) {
  687 + this.setData({
  688 + from: options.from
  689 + })
  690 + }
  691 + var that = this;
  692 + // 高度自适应
  693 + wx.getSystemInfo({
  694 + success: function (res) {
  695 + var clientHeight = res.windowHeight,
  696 + clientWidth = res.windowWidth,
  697 + rpxR = 750 / clientWidth;
  698 + var calc = clientHeight * rpxR - 180;
  699 + console.log(calc)
  700 + that.setData({
  701 + winHeight: calc
  702 + });
  703 + }
  704 + });
  705 +
  706 + },
  707 + footerTap: app.footerTap,
  708 + onShow() {
  709 + let that = this
  710 + console.log(app.globalData.userInfo)
  711 + app.globalData.btnStart = true
  712 +
  713 + wx.showLoading({
  714 + title: '加载中',
  715 + mask: true
  716 + })
  717 +
  718 + // 设备判断滑动距离
  719 + wx.getSystemInfo({
  720 + success: (res) => {
  721 + let rpx = 1 * (res.windowWidth * res.pixelRatio) / (750 * res.pixelRatio);
  722 + this.setData({
  723 + rpx: rpx
  724 + })
  725 + }
  726 + })
  727 + // 获取用户是否需要授权
  728 + wx.login({
  729 + success: (res) => {
  730 + if (res.code) {
  731 + //发起网络请求
  732 + console.log(res)
  733 + app.ajax("Index/auth0", {
  734 + code: res.code
  735 + }, (res) => {
  736 + console.log(res)
  737 + wx.hideLoading()
  738 + if (res.data.data.is_auth == 1) {
  739 + app.globalData.unique_id = res.data.data.unique_id
  740 + if (that.data.from){
  741 + app.ajax("DiscountCoupon/shareGetCoupon", {
  742 + from: that.data.from,
  743 + to: app.globalData.unique_id
  744 + }, (res) => {
  745 + console.log(res)
  746 + })
  747 + }
  748 + wx.getUserInfo({
  749 + success: function (res) {
  750 + var userInfo = res.userInfo
  751 + console.log(userInfo)
  752 + app.globalData.userInfo = userInfo
  753 + }
  754 + })
  755 + this.justy()
  756 + // 检测该用户是否参与了调研
  757 + app.ajax("Inquiry/isInquiry", {
  758 + unique_id: app.globalData.unique_id
  759 + }, (res) => {
  760 + console.log("检测该用户是否参与了调研")
  761 + console.log(res)
  762 + if (res.data.data.is_inquiry != 1) {
  763 + // wx.navigateTo({
  764 + // url: '../guidance/guidance',
  765 + // })
  766 + this.setData({
  767 + diaoyan: true
  768 + })
  769 + } else {
  770 + this.setData({
  771 + diaoyan: false
  772 + })
  773 + }
  774 + }, (res) => { })
  775 + // 获取堂食店铺列表
  776 + app.ajax("Store/storeList", {
  777 + unique_id: app.globalData.unique_id
  778 + }, (res) => {
  779 + console.log("堂食店铺列表")
  780 + console.log(res)
  781 + if (res.data.status == true) {
  782 + this.setData({
  783 + hallListh: res.data.data
  784 + })
  785 + }
  786 + }, (res) => { })
  787 + // 获取自提列表
  788 + app.ajax("Spot/index", {
  789 + unique_id: app.globalData.unique_id
  790 + }, (res) => {
  791 + console.log("获取自提列表")
  792 + console.log(res)
  793 + if (res.data.status == true) {
  794 + this.setData({
  795 + sinceList: res.data.data
  796 + })
  797 + if (res.data.data.spot == null) {
  798 + wx.showLoading({
  799 + title: '空空如也',
  800 + duration: 1000,
  801 + mask: true
  802 + })
  803 + }
  804 + }
  805 + }, (res) => { })
  806 + // 自提点列表
  807 + app.ajax("Spot/index", {
  808 + area_id: "",
  809 + unique_id: app.globalData.unique_id
  810 + }, (res) => {
  811 + console.log("自提点列表")
  812 + console.log(res)
  813 + }, (res) => { })
  814 + // 首页数据
  815 + app.ajax("Index/index", {
  816 + t_id: "",
  817 + unique_id: app.globalData.unique_id
  818 + }, (res) => {
  819 + console.log("获取首页数据")
  820 + console.log(res)
  821 + if (res.data.status == true) {
  822 + wx.hideLoading()
  823 + var mes = res.data.data
  824 + var data = mes.goods_list;
  825 + for (let n in data) {
  826 + data[n].chacke = false
  827 + data[n].num = 1
  828 + }
  829 + for (let n in data) {
  830 + if (data[n].goods_num != null) {
  831 + data[n].chacke = true
  832 + data[n].num = parseInt(data[n].goods_num)
  833 + }
  834 + }
  835 + app.globalData.nearest_spot = mes.nearest_spot
  836 + app.globalData.nearest_store = mes.nearest_store
  837 + this.setData({
  838 + allData: mes,
  839 + menu: true,
  840 + canaction: true,
  841 + imgUrls: res.data.data.banner,
  842 + nearest_spot: app.globalData.nearest_spot,
  843 + nearest_store: app.globalData.nearest_store
  844 + })
  845 + }
  846 + }, (res) => { })
  847 + // 获取购物车数量
  848 + app.ajax("CountNum/countCart", {
  849 + unique_id: app.globalData.unique_id
  850 + }, (res) => {
  851 + console.log(res)
  852 + if (res.data.status == true) {
  853 + app.globalData.tabBar[1].num = res.data.data[0].count
  854 + this.setData({
  855 + tabBarIndex: app.globalData.tabBar
  856 + })
  857 + }
  858 + }, (res) => { })
  859 + // 获取购物车
  860 + app.ajax("Cart/index", {
  861 + unique_id: app.globalData.unique_id
  862 + }, (res) => {
  863 + console.log("获取购物车")
  864 + console.log(res)
  865 + if (res.data.status == true) {
  866 + var data = res.data.data
  867 + for (let n in data.cartList){
  868 + data.cartList[n].checked = true
  869 + }
  870 + app.globalData.shoppingCart = data
  871 + console.log(app.globalData.tabBar)
  872 +
  873 + }
  874 + }, (res) => { })
  875 + } else if (res.data.data.is_auth == 0) {
  876 + this.setData({
  877 + authorization: true,
  878 + })
  879 + }
  880 +
  881 + })
  882 + } else {
  883 + console.log('获取用户登录态失败!' + res.errMsg)
  884 + }
  885 + }
  886 + });
  887 +
  888 +
  889 +
  890 + // 获取经纬度
  891 + wx.getLocation({
  892 + type: 'wgs84',
  893 + success: (res) => {
  894 + var latitude = res.latitude
  895 + var longitude = res.longitude
  896 + app.ajax("Index/updateLatLng", {
  897 + unique_id: app.globalData.unique_id,
  898 + lat: latitude,
  899 + lng: longitude
  900 + }, (res) => {
  901 + console.log(res)
  902 + })
  903 + }
  904 + })
  905 + }
  906 +})
  1 +<!--index.wxml-->
  2 +<!-- bindtap='model' -->
  3 +<view wx:if="{{!authorization}}">
  4 +
  5 + <view style="{{authorization == true?'position:fixed;top:0;width:100%;height:100%':''}}{{screenModel?'position:fixed;top:0;width:100%;height:100%':''}}">
  6 +
  7 + <view class="sinceLoc">
  8 + <view class="btn">
  9 + <view class="animate" animation="{{animationData}}"></view>
  10 + <view class="left" style="{{!moudelOne?'color:#666666;':''}}" data-type='ziti' bindtap='animations' data-state='{{animation}}'>就近自提</view>
  11 + <view class="right" style="{{moudelOne?'color:#666666;':''}}" data-type='shitang' bindtap='animations' data-state='{{!animation}}'>到店堂食</view>
  12 + </view>
  13 + <view class="location" wx:if="{{!stateShop}}">
  14 + <!-- <text class="icon icon-hdxq_icon"></text> {{moudelOne&&!stateShop?nearest_spot.spot_name:nearest_store.store_name}} -->
  15 + <text class="icon icon-hdxq_icon"></text> {{nearest_spot.spot_name}}
  16 + </view>
  17 + <view class="location" wx:if="{{stateShop}}">
  18 + <text class="icon icon-hdxq_icon"></text> {{nearest_store.store_name}}
  19 + </view>
  20 + </view>
  21 +
  22 + <view wx:if="{{moudelOne}}">
  23 + <!-- 筛选 -->
  24 + <view class="screenModel" bindtap='model' wx:if="{{screenModel}}">
  25 + <view class="screen" catchtap='cat'>
  26 + <view class="screenTitle">
  27 + <view class="screenLeft">选择自提点</view>
  28 + <view class="screenRight" catchtap='sisi'>没有门口的?点我试试!</view>
  29 + </view>
  30 + </view>
  31 + <view class="screenBj" catchtap='cat'>
  32 + <view class="swiper-tab">
  33 + <view class="swiper-tab-list {{currentTabT==index ? 'on' : ''}}" wx:for="{{sinceList.area}}" data-current="{{index}}" wx:key="" catchtap="swichNavT" data-area_id='{{item.area_id}}'>{{item.area_name}}</view>
  34 + </view>
  35 + <swiper class="swiper-box" duration="300" bindchange="bindChangeT">
  36 + <swiper-item>
  37 + <view class="List">
  38 + <view class="list" wx:for="{{sinceList.spot}}" catchtap='setLocation' data-spot_id='{{item.spot_id}}' data-spot_name='{{item.spot_name}}' data-distance_text="{{item.distance_text}}" wx:key="">
  39 + <view class="name">{{item.spot_name}}</view>
  40 + <view class="distance">
  41 + <view class="distanceLeft">
  42 + <text class="icon icon-hdxq_icon"></text>
  43 + <text style="font-size:26rpx;color:#999999;margin-left:9rpx;">距您{{item.distance_text}}</text>
  44 + </view>
  45 + <view class="distanceRight" catchtap='getGoodsDetails' data-spot_id='{{item.spot_id}}'>
  46 + 取货点详情
  47 + </view>
  48 + </view>
  49 + </view>
  50 + </view>
  51 + </swiper-item>
  52 + </swiper>
  53 + </view>
  54 + </view>
  55 +
  56 + <view>
  57 + <scroll-view scroll-x="true" class="tab-h" scroll-left="{{scrollLeft}}" wx:if='{{menu}}'>
  58 + <view class="tab-item new {{currentTab==-1?'active':''}}" data-current="-1" bindtap="swichNav">新品试吃</view>
  59 + <view class="tab-item {{currentTab==0?'active':''}}" data-current="0" bindtap="swichNav">全部分类</view>
  60 + <view wx:for="{{allData.type}}" wx:key="" data-t_id='{{item.t_id}}' class="tab-item {{currentTab==index+1?'active':''}}" data-current="{{index+1}}" bindtap="swichNav">{{item.type_name}}</view>
  61 + </scroll-view>
  62 + <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" style="height:348rpx;">
  63 + <block wx:for="{{imgUrls}}" wx:key="" >
  64 + <swiper-item bindtap='detailsGoods' data-id="{{item.bind_goods_id}}">
  65 + <image src="{{item.slide_pic}}" class="slide-image" style="width:100%;height:348rpx;" />
  66 + </swiper-item>
  67 + </block>
  68 + </swiper>
  69 + <swiper class="tab-content" duration="300" bindchange="switchTab" style="height:{{248*allData.goods_list.length+90}}rpx">
  70 + <swiper-item>
  71 + <scroll-view scroll-x="true" class="scoll-h">
  72 + <block wx:for="{{allData.goods_list}}" wx:key="*this">
  73 + <view style="padding:0 34rpx;" bindtap='detailsGoods' data-id="{{item.goods_id}}">
  74 + <view class="item-ans">
  75 + <view class="avatar">
  76 + <image class="img" src="{{item.thumb}}"></image>
  77 + </view>
  78 + <view class="expertInfo">
  79 + <view class="name">{{item.goods_name}}</view>
  80 + <view class="tag">{{item.goods_description}}</view>
  81 + <view class="answerHistory">
  82 + <text style="color:#C90103;font-size:36rpx;">¥{{item.goods_price}}</text>
  83 + <text style="color:#999999;font-size:24rpx;margin-left:34rpx;">月销 {{item.month_sales}} 件</text>
  84 + </view>
  85 + </view>
  86 + <view class="askBtn">
  87 + <image catchtap='openShopCar' data-num='{{item.num}}' data-id="{{item.goods_id}}" data-index='{{index}}' wx:if="{{item.chacke == false}}" src="http://omega.wx.bronet.cn/public/static/images/37@2x.png"></image>
  88 + <view class="stepper" wx:if="{{item.chacke == true}}">
  89 + <!-- 减号 -->
  90 + <text class="{{minusStatus}}" catchtap="minusCount" data-id='{{item.goods_id}}' data-index="{{index}}" data-num='{{item.num}}' data-cart_id="{{item.cart_id}}">-</text>
  91 + <!-- 数值 -->
  92 + <text style="background:#fff;color:#333333;font-size:36rpx;border:0;line-height:44rpx;">{{item.num}}</text>
  93 + <!-- 加号 -->
  94 + <text class="normal" catchtap="addCount" data-id='{{item.goods_id}}' data-index="{{index}}" data-num='{{item.num}}'>+</text>
  95 + </view>
  96 + </view>
  97 + </view>
  98 + </view>
  99 + </block>
  100 + </scroll-view>
  101 + </swiper-item>
  102 + </swiper>
  103 + <view class='nodata' wx:if="{{allData.goods_list.length == 0}}">暂无相关数据</view>
  104 +
  105 + </view>
  106 + </view>
  107 +
  108 + <view wx:if="{{moudelOne == false}}" wx:for="{{hallListh}}" wx:key="" style="padding-left: 38rpx;padding-right: 40rpx;">
  109 + <view class="locationList" bindtap='arriveShop' data-data='{{item}}'>
  110 + <view class="left">
  111 + <view class="nameNum">
  112 + <view class="name">{{item.store_name}}</view>
  113 + <view class="num">距您{{item.distance_text}}</view>
  114 + </view>
  115 + <view class='time'>
  116 + <text class="icon icon-hdxq_icon1"></text>
  117 + <view class="times">营业时间:{{item.open_start}}-{{item.open_end}}</view>
  118 + </view>
  119 + <view class="time" style="margin-top:21rpx;">
  120 + <text class="icon icon-hdxq_icon"></text>
  121 + <view class="times">{{item.store_address}}</view>
  122 + </view>
  123 + </view>
  124 + <view class="right" catchtap='shopDetails' data-store_id='{{item.store_id}}' data-store_name='{{item.store_name}}' data-distance_text='{{item.distance_text}}' data-open_start='{{item.open_start}}' data-open_end='{{item.open_end}}' data-store_address='{{item.store_address}}'>
  125 + <text class="icon icon-icon-test3"></text>
  126 + </view>
  127 + </view>
  128 + </view>
  129 +
  130 + <view class="tabBar">
  131 + <view class="barList" bindtap='tabBar' data-index='{{index}}' wx:for="{{tabBarIndex}}" wx:key="">
  132 + <image wx:if="{{item.state == false}}" src="{{item.img}}"></image>
  133 + <image wx:else src="{{item.selectImg}}"></image>
  134 + <view class="font" style="{{item.state == false?'':'color:#FEAD00'}}">{{item.name}}</view>
  135 + <view class="num" wx:if="{{item.num != null}}">{{item.num}}</view>
  136 + </view>
  137 + </view>
  138 +
  139 + <view class="suspend" wx:if="{{diaoyan}}" bindtap='guidance'>
  140 + <image src="https://shipin.wx.broteam.cn/public/images/inquire.png"></image>
  141 + </view>
  142 + </view>
  143 +
  144 +
  145 +
  146 +</view>
  147 +
  148 +
  149 +
  150 +
  151 +<view class="page" wx:if="{{authorization}}">
  152 + <view class="userAvatarUrl">
  153 + <open-data type="userAvatarUrl"></open-data>
  154 + </view>
  155 + <view class="userNickName">
  156 + <open-data type="userNickName"></open-data>
  157 + </view>
  158 + <view class="btn">
  159 + <button open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="bindGetUserInfo">授权登录</button>
  160 + </view>
  161 +</view>
  162 +
  163 +
  164 +<!-- 优惠券 -->
  165 +
  166 +<view class='card' wx:if="{{card}}">
  167 + <view class='card_box'>
  168 + <view class='card_container'>
  169 + <image src='/img/card_bg.png'></image>
  170 + <view class='card_info'>{{cardInfo.pledge_name}}X{{cardInfo.num}}</view>
  171 + <view class='get_btn' bindtap='getCard'>
  172 + <image src='/img/get_btn.png'></image>
  173 + </view>
  174 + <view class='close icon icon-close' bindtap='hideCard'></view>
  175 + </view>
  176 + </view>
  177 +</view>