作者 朱振飞

project init

要显示太多修改。

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

不能预览此文件类型
//app.js
App({
onLaunch: function () {
// 展示本地存储能力
// var logs = wx.getStorageSync('logs') || []
// logs.unshift(Date.now())
// wx.setStorageSync('logs', logs)
// 登录
// wx.login({
// success: res => {
// // 发送 res.code 到后台换取 openId, sessionKey, unionId
// }
// })
// 获取用户信息
// wx.getSetting({
// success: res => {
// if (res.authSetting['scope.userInfo']) {
// // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
// wx.getUserInfo({
// success: res => {
// // 可以将 res 发送给后台解码出 unionId
// this.globalData.userInfo = res.userInfo
// // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// // 所以此处加入 callback 以防止这种情况
// if (this.userInfoReadyCallback) {
// this.userInfoReadyCallback(res)
// }
// }
// })
// }
// }
// })
},
ajax(url, params, successData, errorData, completeData) {
var https = "https://shipin.wx.broteam.cn/index.php/"
wx.request({
url: https + url,
method: "POST",
header: {
'content-type': 'application/x-www-form-urlencoded',
},
data: params,
success: (res) => {
successData(res)
},
error(res) {
errorData(res)
}
})
},
// 多张图片上传
uploadImg: function (data) {
var that = this,
i = data.i ? data.i : 0,
success = data.success ? data.success : 0,
fail = data.fail ? data.fail : 0
wx.uploadFile({
url: data.url,
filePath: data.path[i],
name: 'fileData', // 这里根据自己的实际情况修改
formData: null,
success: function (resp) {
success++
console.log(resp)
console.log(i)
/*
这里肯能有bug,失败也会执行这里,所以这里应该是后台返回过来的状态码为成功时,
这里的succes才+1
*/
},
fail: function (res) {
fail++
console.log('fail: ' + i + 'fail: ' + fail)
},
complete: function (res) {
console.log(i)
i++
if (i == data.path.length) { //当图片传完时,停止调用
console.log('执行完毕');
console.log('成功:' + success + " 失败:" + fail);
} else { //若图片还没有传完,则继续调用函数
console.log(i);
data.i = i;
data.success = success;
data.fail = fail;
that.uploadimg(data);
}
if (i == data.path.length) { // 当图片传完时,停止调用
console.log('执行完毕')
console.log('成功:' + success + '失败:' + fail)
} else { // 若图片还没有传完,则继续调用函数
console.log(i)
data.i = i
data.success = success
data.fail = fail
that.uploadimg(data)
}
}
})
},
getNowDate() {
var now = new Date();
var week = now.getDay()
var str = "星期";
switch (now.getDay()) {
case 0:
str = str + "日";
break;
case 1:
str = str + "一";
break;
case 2:
str = str + "二";
break;
case 3:
str = str + "三";
break;
case 4:
str = str + "四";
break;
case 5:
str = str + "五";
break;
case 6:
str = str + "六";
break;
}
var year = now.getFullYear();
var month = now.getMonth() + 1;
var day = now.getDate();
if (month < 10) {
month = '0' + month;
};
if (day < 10) {
day = '0' + day;
};
// 如果需要时分秒,就放开
// var h = now.getHours();
// var m = now.getMinutes();
// var s = now.getSeconds();
var formatDate = year + '-' + month + '-' + day + '('+str+')';
return formatDate;
},
globalData: {
imgUrlUp: "https://shipin.wx.broteam.cn/index.php/MyComment/upload",
userInfo: null,
// 下导航
tabBar: [{
name: "首页",
state: true,
img: "http://omega.wx.bronet.cn/public/static/images/menu_icon1_select@2x_81.png",
selectImg: "http://omega.wx.bronet.cn/public/static/images/menu_icon1_select@2x.png",
num: null,
url: "../index/index"
},
{
name: "购物车",
state: false,
img: "http://omega.wx.bronet.cn/public/static/images/92@2x.png",
selectImg: "http://omega.wx.bronet.cn/public/static/images/92@2x_55.png",
num: 0,
url: "../shopCart/shopCart"
},
{
name: "我的",
state: false,
img: "http://omega.wx.bronet.cn/public/static/images/menu_icon3_select@2x.png",
selectImg: "http://omega.wx.bronet.cn/public/static/images/menu_icon3_select@2x_57.png",
num: null,
url: "../me/me"
},
],
unique_id: null, //公众号与小程序共有id
shoppingCart: null,
nearest_spot: null,//就近自提地址及id
nearest_store: null,//到店堂食地址及id
orderRemarkValue: null,
btnStart: true //选择的自提还是堂食
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/index/index",
"pages/login/login",
"pages/reenabled/reenabled",
"pages/getGoodsDetails/getGoodsDetails",
"pages/detailsGoods/detailsGoods",
"pages/shopCart/shopCart",
"pages/submitOrder/submitOrder",
"pages/expectLocation/expectLocation",
"pages/allEvaluate/allEvaluate",
"pages/remark/remark",
"pages/me/me",
"pages/myWallet/myWallet",
"pages/Coupon/Coupon",
"pages/recharge/recharge",
"pages/walletDetail/walletDetail",
"pages/order/order",
"pages/orderDetails/orderDetails",
"pages/evaluate/evaluate",
"pages/aboutMe/aboutMe",
"pages/guidance/guidance",
"pages/shopDetails/shopDetails",
"pages/maps/maps"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "乡味乡链",
"navigationBarTextStyle": "black"
}
}
\ No newline at end of file
... ...
/**app.wxss**/
@font-face {
font-family: 'icon'; /* project id 647640 */
src: url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.eot');
src: url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.woff') format('woff'),
url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.ttf') format('truetype'),
url('//at.alicdn.com/t/font_647640_n3cow34ja3gzaor.svg#iconfont') format('svg');
}
.icon {
font-family: "icon" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-jia:before {
content: "\e600";
}
.icon-weixuanzhongyuanquan:before {
content: "\e601";
}
.icon-31daipingjia:before {
content: "\e602";
}
.icon-xuanzhong:before {
content: "\e631";
}
.icon-yizhifu:before {
content: "\e615";
}
.icon-yiwancheng1:before {
content: "\e616";
}
.icon-zelvxuanzefeiyongdaosanjiaoxingfandui:before {
content: "\e665";
}
.icon-erji:before {
content: "\e608";
}
.icon-wallet_icon:before {
content: "\e664";
}
.icon-youhuiquan:before {
content: "\e674";
}
.icon-balance:before {
content: "\e618";
}
.icon-qianbao:before {
content: "\e672";
}
.icon-close:before {
content: "\e606";
}
.icon-icon--:before {
content: "\e71b";
}
.icon-icon--1:before {
content: "\e78f";
}
.icon-fylb_icon_arrow_norm:before {
content: "\e603";
}
.icon-index:before {
content: "\e604";
}
.icon-my_icon:before {
content: "\e614";
}
.icon-hdxq_icon:before {
content: "\e605";
}
.icon-hdxq_icon1:before {
content: "\e617";
}
.icon-icon-test:before {
content: "\e607";
}
.icon-icon-test1:before {
content: "\e609";
}
.icon-gouwuche_select:before {
content: "\e60a";
}
.icon-qianbao1:before {
content: "\e60b";
}
.icon-icon-test2:before {
content: "\e60c";
}
.icon-liwu:before {
content: "\e60d";
}
.icon-icon-test3:before {
content: "\e60e";
}
.icon-yiwancheng:before {
content: "\e60f";
}
.icon-pingjia:before {
content: "\e610";
}
.icon-xingzhuang:before {
content: "\e611";
}
.icon-icon-test4:before {
content: "\e612";
}
.icon-VectorSmartObject:before {
content: "\e613";
}
.tabBar {
position: fixed;
bottom: 0;
height: 98rpx;
background: #fff;
width: 100%;
border-top: 1rpx solid #ccc;
display: flex;
justify-content: space-around;
text-align: center;
}
.tabBar .barList {
position: relative;
}
.tabBar .barList image {
width: 72rpx;
height: 72rpx;
}
.tabBar .barList .font {
font-size: 22rpx;
color: #999;
line-height: 0rpx;
}
.tabBar .barList .num {
/* width:28rpx;
height:28rpx; */
background: #c90103;
border-radius: 100%;
text-align: center;
line-height: 29rpx;
color: #fff;
font-size: 21rpx;
position: absolute;
top: 7rpx;
left: 43rpx;
padding-left: 10rpx;
padding-right: 10rpx;
}
.payment {
padding: 38rpx 40rpx;
border-top: 1rpx solid #e4e4e4;
}
.payment .state {
display: flex;
justify-content: space-between;
}
.payment .state .stateFontNumber {
display: flex;
font-size: 26rpx;
}
.payment .state .stateFontNumber .stateFont {
color: #c90103;
}
.payment .state .stateFontNumber .number {
margin-left: 30rpx;
color: #666;
}
.payment .state .time {
color: #666;
font-size: 26rpx;
}
.payment .spMes {
display: flex;
justify-content: space-between;
margin-top: 41rpx;
}
.payment .spMes image {
width: 96rpx;
height: 96rpx;
}
.payment .spMes .nameHint {
width: 481rpx;
margin-left: 20rpx;
}
.payment .spMes .nameHint .name {
font-size: 30rpx;
color: #222;
}
.payment .spMes .nameHint .hint {
color: #666;
font-size: 26rpx;
height: 70rpx;
overflow: hidden;
}
.payment .spMes .numMon .mon {
color: #222;
font-size: 26rpx;
}
.payment .spMes .numMon .num {
font-size: 24rpx;
color: #999;
margin-top: 27rpx;
text-align: right;
}
.payment .payMes {
margin-top: 37rpx;
display: flex;
justify-content: flex-end;
align-items: center;
}
.payment .payMes .all {
color: #c90103;
font-size: 26rpx;
margin-right: 40rpx;
}
.payment .payMes .cancel {
font-size: 26rpx;
color: #333;
width: 148rpx;
height: 56rpx;
background: #eee;
border-radius: 28rpx;
margin-right: 25rpx;
text-align: center;
line-height: 56rpx;
}
.payment .payMes .pay {
font-size: 26rpx;
color: #fff;
text-align: center;
line-height: 56rpx;
width: 148rpx;
height: 56rpx;
background: #c90103;
border-radius: 28rpx;
}
.shopType {
width: 66rpx;
height: 36rpx;
border: 2rpx solid #fc0;
text-align: center;
line-height: 36rpx;
font-size: 24rpx;
color: #fc0;
margin-left: 30rpx;
}
.shopTypeT {
width: 66rpx;
height: 36rpx;
border: 2rpx solid #67c33e;
text-align: center;
line-height: 36rpx;
font-size: 24rpx;
color: #67c33e;
margin-left: 30rpx;
}
... ...
不能预览此文件类型
// pages/Coupon/Coupon.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
/**
* 页面配置
*/
winWidth: 0,
winHeight: 0,
// tab切换
currentTab: 0,
num:1,
arr1: [],
arr2: [],
arr3: [],
},
// 立即使用
go(){
wx.reLaunch({
url: '../index/index',
})
},
// 循环调用获取订单列表
getOrderList() {
wx.showLoading({
title: '加载中',
})
var num = this.data.num;
var that = this;
function move() {
app.ajax("DiscountCoupon/index", {
unique_id: app.globalData.unique_id,
status: num
}, (res) => {
console.log(res)
console.log(res.data.data)
if (res.data.data) {
console.log(num)
if (num == 1) {
that.setData({
arr1: res.data.data,
freeCard: res.data.data2
})
num++
move()
} else if (num == 2) {
that.setData({
arr2: res.data.data,
freeCard2: res.data.data2
})
num++
move()
} else if (num == 3) {
that.setData({
arr3: res.data.data,
freeCard2: res.data.data2
})
num++
move()
} else {
console.log("结束")
wx.hideLoading()
}
} else {
console.log(num)
if (num == 1) {
that.setData({
arr1: [],
freeCard2: []
})
num++
move()
} else if (num == 2) {
that.setData({
arr2: [],
freeCard2: []
})
num++
move()
} else if (num == 3) {
that.setData({
arr3: [],
freeCard3: []
})
num++
move()
} else {
console.log("结束")
wx.hideLoading()
}
}
}, (res) => { })
}
move()
},
/**
* 滑动切换tab
*/
bindChange: function (e) {
var that = this;
that.setData({ currentTab: e.detail.current });
},
/**
* 点击tab切换
*/
swichNav: function (e) {
var that = this;
if (this.data.currentTab === e.target.dataset.current) {
return false;
} else {
that.setData({
currentTab: e.target.dataset.current
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
/**
* 获取系统信息
*/
wx.getSystemInfo({
success: function (res) {
that.setData({
winWidth: res.windowWidth,
winHeight: res.windowHeight
});
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getOrderList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/Coupon/Coupon.wxml-->
<view class="buttom">
<view class="swiper-tab">
<view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">未使用</view>
<view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">已使用</view>
<view class="swiper-tab-list {{currentTab==2 ? 'on' : ''}}" data-current="2" bindtap="swichNav">已过期</view>
</view>
<swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight - 31}}px" bindchange="bindChange">
<!-- 未使用 -->
<swiper-item >
<view class="List" wx:for="{{arr1}}" wx:key="" data-id='{{item.id}}'>
<view class="couponList">
<view class="plice">{{item.reduce}}
<text style="color:#999999;font-size:26rpx;">元</text>
</view>
<view class="mes">
<view class="name">{{item.discount_coupon_name}}</view>
<view class="time">有效期截止:{{item.deadline}}</view>
</view>
</view>
<view class="go" bindtap='go'>立即使用
<text class="icon icon-icon-test3" style="font-size:18rpx;margin-left:22rpx;"></text>
</view>
</view>
<view class="List" wx:for="{{freeCard}}" wx:key="" data-id='{{item.id}}'>
<view class="couponList">
<view class="plice free_name">{{item.pledge_name}}
<text style="color:#999999;font-size:26rpx;"></text>
</view>
<view class="mes">
<view class="time">有效期截止:{{item.deadline}}</view>
</view>
</view>
<view class="go" bindtap='go'>立即使用
<text class="icon icon-icon-test3" style="font-size:18rpx;margin-left:22rpx;"></text>
</view>
</view>
</swiper-item>
<!-- 已使用 -->
<swiper-item>
<view class="List" wx:for="{{arr2}}" wx:key="" data-id='{{item.id}}'>
<view class="couponList">
<view class="plice">{{item.reduce}}
<text style="color:#999999;font-size:26rpx;margin-left:13rpx;">元</text>
</view>
<view class="mes">
<view class="name">{{item.discount_coupon_name}}</view>
<view class="time">有效期截止:{{item.deadline}}</view>
</view>
</view>
<view class="go" style="color:#666666;">已使用</view>
</view>
<!-- 免费优惠 -->
<view class="List" wx:for="{{freeCard2}}" wx:key="" data-id='{{item.id}}'>
<view class="couponList">
<view class="plice free_name">{{item.pledge_name}}
<text style="color:#999999;font-size:26rpx;"></text>
</view>
<view class="mes">
<view class="time">有效期截止:{{item.deadline}}</view>
</view>
</view>
<view class="go" >已使用</view>
</view>
</swiper-item>
<!-- 已过期 -->
<swiper-item>
<view class="List" wx:for="{{arr3}}" wx:key="" data-id='{{item.id}}'>
<view class="couponList">
<view class="plice">{{item.reduce}}
<text style="color:#999999;font-size:26rpx;margin-left:13rpx;">元</text>
</view>
<view class="mes">
<view class="name">{{item.discount_coupon_name}}</view>
<view class="time">有效期截止:{{item.deadline}}</view>
</view>
</view>
<view class="go" style="color:#666666;">已过期</view>
</view>
<view class="List" wx:for="{{freeCard3}}" wx:key="" data-id='{{item.id}}'>
<view class="couponList">
<view class="plice free_name">{{item.pledge_name}}
<text style="color:#999999;font-size:26rpx;"></text>
</view>
<view class="mes">
<view class="time">有效期截止:{{item.deadline}}</view>
</view>
</view>
<view class="go" bindtap='go'>已过期
<text class="icon icon-icon-test3" style="font-size:18rpx;margin-left:22rpx;"></text>
</view>
</view>
</swiper-item>
</swiper>
</view>
\ No newline at end of file
... ...
/* pages/Coupon/Coupon.wxss */
.buttom {
border-top: 1rpx solid #e4e4e4;
}
.swiper-tab {
width: 100%;
text-align: center;
line-height: 80rpx;
display: flex;
justify-content: space-around;
box-shadow: 1rpx 1rpx 1rpx 2rpx #ccc;
position: relative;
z-index: 36;
}
.swiper-tab-list {
font-size: 30rpx;
display: inline-block;
/* width: 33.33%; */
color: #666;
}
.on {
color: #333;
position: relative;
}
.on::after {
content: "";
border-bottom: 10rpx solid #fc0;
position: absolute;
bottom: 0;
left: 0;
border-radius: 5rpx;
width: 48rpx;
}
.swiper-box {
display: block;
height: 100%;
width: 100%;
overflow: hidden;
}
.swiper-box view {
text-align: center;
}
.List {
background-image: url(http://omega.wx.bronet.cn/public/static/images/32@2x.png);
background-size: 100% 100%;
height: 286rpx;
width: 740rpx;
margin: 0 auto;
margin-top: 25rpx;
}
.couponList {
display: flex;
justify-content: space-around;
/* border-bottom: 1rpx solid #eee; */
margin: 0 40rpx;
height: 180rpx;
}
.couponList .plice {
font-size: 80rpx;
color: #c90103;
margin-top: 53rpx;
margin-left: 31rpx;
height: 115%;
}
.couponList .mes {
margin-top: 61rpx;
margin-right: 38rpx;
height: 114rpx;
}
.couponList .mes .name {
font-size: 30rpx;
color: #333;
}
.couponList .mes .time {
font-size: 26rpx;
color: #999;
margin-top: 21rpx;
text-align: left;
}
.List .go {
font-size: 30rpx;
color: #c90103;
text-align: center;
margin-top:22rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponList .free_name{
font-size: 30rpx;
margin: 0;
display: flex;
align-items: center;
font-weight: 600;
width: 200rpx;
}
swiper-item{
overflow-y: auto;
}
\ No newline at end of file
... ...
// pages/aboutMe/aboutMe.js
var WxParse = require('../../wxParse/wxParse.js');
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
allData:[],
post_content:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 获取信息
app.ajax("News/aboutUs",{},(res)=>{
console.log(res)
if(res.data.status == true){
WxParse.wxParse('article', 'html', res.data.data.post_content, this, 5);
this.setData({
allData:res.data.data,
})
}
},(res)=>{})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/aboutMe/aboutMe.wxml-->
<import src="/wxParse/wxParse.wxml"/>
<view class="img">
<image src="{{allData.thumb}}"></image>
</view>
<view class="title">{{allData.post_title}}</view>
<view class="contant">
<template is="wxParse" data="{{wxParseData:article.nodes}}"/>
</view>
<!-- <view class="wealthy">
富文本区域
</view> -->
\ No newline at end of file
... ...
/* pages/aboutMe/aboutMe.wxss */
@import "/wxParse/wxParse.wxss";
.img image{
width:100%;
height:448rpx;
}
.title{
font-size: 32rpx;
color:#1A1A1A;
text-align: center;
margin-top: 70rpx;
font-weight: 800;
}
.contant{
padding:37rpx 63rpx 56rpx 63rpx;
font-size: 28rpx;
color:#666;
border-bottom: 1rpx solid #E4E4E4;
line-height:64rpx;
}
\ No newline at end of file
... ...
// pages/allEvaluate/allEvaluate.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
allData:[]
},
bouncer(arr){
return arr.filter(function (val) {
return !(!val || val === "");
});
},
priviewImg(event){
console.log(event)
wx.previewImage({
current: event.currentTarget.dataset.src, // 当前显示图片的http链接
urls: event.currentTarget.dataset.arry // 需要预览的图片http链接列表
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.goods_id){
console.log(options.goods_id)
app.ajax("MyComment/commentList",{
goods_id: options.goods_id
},(res)=>{
console.log(res)
var data = res.data.data
for(let n in data){
var comment = [];
let tempArry
if (data[n].comment_photo!= null){
tempArry = data[n].comment_photo.split(",")
tempArry = tempArry.filter(function (val) {
return !(!val || val === "");
});
}
comment.push(tempArry)
data[n].comment = comment
}
console.log(data)
if(res.data.status == true){
this.setData({
allData:data
})
}
},(res)=>{})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/allEvaluate/allEvaluate.wxml-->
<view class="evaluateList" wx:for="{{allData}}" wx:key="">
<view class="img">
<image src="{{item.head_img}}"></image>
</view>
<view class="mes">
<view class="nameTime">
<view class="name">{{item.nickname}}</view>
<view class="time">{{item.comment_date}}</view>
</view>
<view class="content">{{item.comment_content}}</view>
<view class="imgList">
<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>
</view>
</view>
</view>
\ No newline at end of file
... ...
/* pages/allEvaluate/allEvaluate.wxss */
page{
padding-bottom: 20rpx
}
.evaluateList{
display: flex;
justify-content: space-between;
margin-top:1rpx solid #E4E4E4;
}
.evaluateList .img image{
width:45rpx;
height:45rpx;
border-radius: 100%;
margin-top:41rpx;
margin-left:42rpx;
}
.evaluateList .mes{
margin-left:23rpx;
width:656rpx;
}
.evaluateList .mes .nameTime{
display: flex;
justify-content: space-between;
font-size: 26rpx;
color:#999;
margin-top:42rpx;
}
.evaluateList .mes .nameTime .time{
margin-right: 39rpx;
}
.evaluateList .mes .content{
color:#333333;
font-size: 28rpx;
margin-top:32rpx;
}
.evaluateList .mes .imgList{
display: flex;
margin-top:23rpx;
}
.evaluateList .mes .imgList image{
margin-right: 16rpx;
width:132rpx;
height:132rpx;
}
\ No newline at end of file
... ...
// pages/detailsGoods/detailsGoods.js
var WxParse = require('../../wxParse/wxParse.js');
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
indicatorDots: true,
autoplay: true,
interval: 5000,
duration: 1000,
allData: [],
// 商品id
goods_id: "",
num: 0
},
// 跳转购物车
shopCart() {
wx.reLaunch({
url: '../shopCart/shopCart',
})
},
// 商品列表加入购物车
openShopCar(e) {
wx.showLoading({
title: '加载中',
})
app.ajax("Cart/add", {
unique_id: app.globalData.unique_id,
goods_id: this.data.goods_id,
goods_num: 1,
}, (res) => {
console.log(res)
wx.hideLoading()
if (res.data.status == true) {
wx.showToast({
title: res.data.msg,
icon: 'success',
duration: 2000
})
} else {
wx.showModal({
title: '提示',
content: '未知错误,添加失败,请稍后重试!',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
this.getNum()
})
},
// 获取购物车数量
getNum() {
// 获取购物车数量
app.ajax("CountNum/countCart", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
this.setData({
num: res.data.data[0].count
})
}
}, (res) => {})
},
// 全部评价
allEvaluate() {
wx.navigateTo({
url: '../allEvaluate/allEvaluate?goods_id=' + this.data.goods_id,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if (options.id) {
console.log(options.id)
this.setData({
goods_id: options.id
})
// 获取商品详情
app.ajax("Goods/goodsDetail", {
goods_id: options.id
}, (res) => {
console.log("获取商品详情")
console.log(res)
if (res.data.status == true) {
this.setData({
allData: res.data.data
})
WxParse.wxParse('article', 'html', res.data.data.goods_detail, this, 5);
}
}, (res) => {})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
console.log(app.globalData.tabBar[1].num)
this.setData({
num: app.globalData.tabBar[1].num
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/detailsGoods/detailsGoods.wxml-->
<import src="/wxParse/wxParse.wxml" />
<view class="list">
<swiper indicator-dots="{{indicatorDots}}" indicator-color="#fff" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" indicator-active-color="#FBC247">
<block wx:for="{{allData.banner}}" wx:key="">
<swiper-item>
<image src="{{item}}" class="slide-image" width="355" height="150" />
</swiper-item>
</block>
</swiper>
<view class="mes">
<view class="left">
<view class="name">
<text style="font-size:36rpx;color:#111111;">{{allData.goods_name}}</text>
<text style="font-size:26rpx;color:#666666;margin-left:26rpx;">{{allData.goods_description}}</text>
</view>
<view class="price">
<text style="font-size:30rpx;color:#C90103;">¥ </text>
<text style="font-size:40rpx;color:#C90103;">{{allData.goods_price}}</text>
<text style="font-size:26rpx;color:#999999;margin-left:20rpx;">已售 {{allData.month_sales}} 件</text>
</view>
</view>
<view class="right" bindtap='allEvaluate'>
<text class="icon icon-pingjia"></text>
<view class="allSp">全部评价</view>
</view>
</view>
<!-- 商品详情 -->
<view class="shopDetails">
<view class="title">- 商品详情 -</view>
<view>
<template is="wxParse" data="{{wxParseData:article.nodes}}" />
</view>
<view style="height:100rpx;"></view>
</view>
</view>
<view class="navBottom">
<view class="left" bindtap='shopCart'>
<text class="icon icon-icon--1"></text>
<view class="num">{{num == null?'0':num}}</view>
</view>
<view class="right" bindtap='openShopCar'>
加入购物车
</view>
</view>
\ No newline at end of file
... ...
/* pages/detailsGoods/detailsGoods.wxss */
@import "/wxParse/wxParse.wxss";
page {
background: #f7f7f7;
}
.list image {
width: 100%;
height: 672rpx;
}
swiper {
height: 672rpx;
}
.mes {
display: flex;
justify-content: space-between;
padding: 56rpx 40rpx;
background: #fff;
}
.mes .right {
border-left: 1rpx solid #e4e4e4;
text-align: center;
padding-left: 29rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.mes .right .icon {
color: #999;
font-size: 36rpx;
}
.mes .right .allSp {
font-size: 20rpx;
color: #333;
margin-top: 16rpx;
}
.shopDetails {
background: #fff;
margin-top: 16rpx;
overflow: hidden;
}
.shopDetails .title {
font-size: 26rpx;
color: #111;
text-align: center;
margin-top: 38rpx;
}
.navBottom {
position: fixed;
bottom: 0;
width: 100%;
height: 97rpx;
border-top: 1rpx solid #e4e4e4;
background: #fff;
display: flex;
}
.navBottom .left {
width: 154rpx;
height: 97rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.navBottom .left .icon {
font-size: 44rpx;
color: #666;
}
.navBottom .left .num {
position: absolute;
top: 21rpx;
left: 80rpx;
border-radius: 100%;
background: #c90103;
font-size: 24rpx;
color: #fff;
line-height: 28rpx;
text-align: center;
padding:3rpx;
width:28rpx;
height:28rpx;
}
.navBottom .right {
background: #fc0;
text-align: center;
line-height: 97rpx;
color: #333;
font-size: 32rpx;
height: 97rpx;
width:597rpx;
}
... ...
// pages/evaluate/evaluate.js
//获取应用实例
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
noteMaxLen: 50, //备注最多字数
// 输入评论内容
value: "",
orderNote: [],
// 图片上传预览删除
allLength: 3,// 最多上传多少张
getState: true,
imgArray: [],
getImgArr: [],
// 订单id
oid: ""
},
// 提交
submit() {
wx.showLoading({
title: '正在提交',
})
var value = this.data.value;
var getImgArr = this.data.getImgArr;
console.log(getImgArr)
var str = ""
for (let n in getImgArr) {
str = str + getImgArr[n] + ","
}
console.log(value)
console.log(str)
if(value != ""){
app.ajax("MyComment/comment",{
unique_id: app.globalData.unique_id,
oid: this.data.oid,
comment_content:value,
comment_photo:str
},(res)=>{
wx.hideLoading()
console.log(res)
if(res.data.status == true){
wx.showToast({
title: res.data.msg,
icon: 'success',
duration: 2000,
mask:true
})
setTimeout(function () {
wx.navigateBack({})
}, 2000)
}else{
wx.showLoading({
title: res.data.msg
})
}
},(res)=>{})
}else{
wx.showLoading({
title: '填写评论',
mask:true,
duration: 1000
})
}
},
// 选择图片
getImg() {
let that = this
wx.chooseImage({
count: this.data.allLength - this.data.imgArray.length, // 还可以上传几张
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: (res) => {
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
var tempFilePaths = res.tempFilePaths;
var imgArray = Object.assign([],this.data.imgArray);
for (let n in tempFilePaths) {
console.log(tempFilePaths[n])
wx.uploadFile({
url: app.globalData.imgUrlUp,
filePath: tempFilePaths[n],
name: "files",
formData: {},
success: (res) => {
console.log(res)
var getImgArr = this.data.getImgArr
let data = JSON.parse(res.data)
if(data.status){
console.log(data.data)
getImgArr.push(data.data)
console.log(tempFilePaths[n])
imgArray.push(tempFilePaths[n])
console.log(imgArray)
}else{
wx.showToast({
title: data.msg,
icon: 'none'
})
}
console.log()
this.setData({
getImgArr: getImgArr
})
this.setData({
imgArray: imgArray
})
that.detection()
},
complete:(res)=>{
console.log(res)
}
})
}
}
})
},
// 检测图片数量
detection() {
if (this.data.imgArray.length == this.data.allLength) {
this.setData({
getState: false
})
} else {
this.setData({
getState: true
})
}
},
// 删除
del(e) {
var index = e.currentTarget.dataset.index;
var imgArray = this.data.imgArray;
var getImgArr = this.data.getImgArr;
imgArray.splice(index, 1)
getImgArr.splice(index,1)
this.setData({
imgArray: imgArray,
getImgArr: getImgArr
})
console.log(this.data.imgArray)
this.detection()
},
//选择订单备注
bindOrderNote: function (e) {
var index = e.currentTarget.dataset.index, list = this.data.orderNote;
for (var i = 0, len = list.length; i < len; i++) {
if (index == list[i].index) {
list[i].selected = !list[i].selected;
}
}
this.setData({
orderNote: list
});
},
//字数限制
bindWordLimit: function (e) {
var value = e.detail.value, len = parseInt(value.length);
if (len > this.data.noteMaxLen) return;
this.setData({
currentNoteLen: len, //当前字数
value: value
//limitNoteLen: this.data.noteMaxLen - len //剩余字数
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.id) {
console.log(options.id)
this.setData({
oid: options.id
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/evaluate/evaluate.wxml-->
<view class="control">
<view class="area-box">
<textarea style="width:100%;" placeholder="请在这里填写评价" maxlength="{{noteMaxLen}}" bindinput="bindWordLimit" />
<text class="wordLimit ff-hv">{{currentNoteLen|0}}/{{noteMaxLen}}个字</text>
</view>
<view class="hr"></view>
<view class="title">上传照片,最多3张</view>
<view class="imgList_lz">
<view class="forList" wx:for="{{imgArray}}" wx:key="">
<image src="{{item}}"></image>
<view bindtap='del' data-index='{{index}}'>X</view>
</view>
<view class="list" bindtap='getImg' wx:if="{{getState}}">
<image src="../../img/up.png"></image>
</view>
</view>
<view class="submit" bindtap='submit'>提交</view>
</view>
\ No newline at end of file
... ...
/* pages/evaluate/evaluate.wxss */
.control {
border-top: 1rpx solid #e4e4e4;
padding: 56rpx 40rpx;
}
.area-box {
font-size: 28rpx;
color: #999;
}
.wordLimit {
display: block;
float: right;
}
.hr {
border-bottom: 1rpx solid #e4e4e4;
clear: both;
margin-top: 65rpx;
}
.title {
font-size: 26rpx;
color: #999;
margin-top: 36rpx;
}
/* 图片上传预览删除 */
.imgList_lz {
display: flex;
justify-content: space-between;
padding-top: 43rpx;
flex-wrap: wrap;
}
.imgList_lz::after {
content: "";
width: 188rpx;
}
.imgList_lz .forList image {
width: 188rpx;
height: 188rpx;
}
.imgList_lz .forList {
position: relative;
}
.imgList_lz .forList view {
position: absolute;
top: -16rpx;
width: 32rpx;
height: 32rpx;
background: #999;
border-radius: 100%;
text-align: center;
line-height: 32rpx;
left: 100%;
margin-left: -16rpx;
font-size: 17rpx;
color:#fff;
}
.imgList_lz .list image {
width: 188rpx;
height: 188rpx;
}
.submit{
width:200rpx;
height:72rpx;
background:#FFCC00;
text-align: center;
line-height: 72rpx;
border-radius: 36rpx;
color:#333333;
font-size: 30rpx;
margin:0 auto;
margin-top:112rpx;
}
\ No newline at end of file
... ...
// pages/expectLocation/expectLocation.j
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
provinceStr: [],
provinceIndex: 0,
cityStr: ['市'],
cityIndex: 0,
districtStr: ['区县'],
districtIndex: 0,
streetStr: ['街道'],
streetIndex: 0,
detailedAddressVal: ""
},
// 确定提交
confirm() {
wx.showLoading({
title: '加载中',
})
// 三问省一级
var provinceStr = this.data.provinceStr[this.data.provinceIndex];
console.log(provinceStr)
// 三问市一级
var cityStr = this.data.cityStr[this.data.cityIndex];
console.log(cityStr)
// 三问区县一级
var districtStr = this.data.districtStr[this.data.districtIndex];
console.log(districtStr)
// 三问街道一级
var streetStr = this.data.streetStr[this.data.streetIndex];
console.log(streetStr)
// 三问详细地址
var detailedAddressVal = this.data.detailedAddressVal;
console.log(detailedAddressVal)
if (provinceStr != "省") {
if (cityStr != "市") {
if (districtStr != "区县") {
if (streetStr != "街道") {
if (detailedAddressVal != "") {
console.log(this.data.province[this.data.provinceIndex - 1].province_id)
console.log(this.data.city[this.data.cityIndex - 1].city_id)
console.log(this.data.district[this.data.districtIndex - 1].county_id)
console.log(this.data.street[this.data.streetIndex - 1].town_id)
app.ajax("SurveySpot/updateMyHopeSpot", {
unique_id: app.globalData.unique_id,
province: provinceStr,
city: cityStr,
county: districtStr,
town: streetStr,
address: detailedAddressVal,
province_id: this.data.province[this.data.provinceIndex - 1].province_id,
city_id: this.data.city[this.data.cityIndex - 1].city_id,
county_id: this.data.district[this.data.districtIndex - 1].county_id,
town_id: this.data.street[this.data.streetIndex - 1].town_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
wx.showToast({
title: res.data.msg,
icon: 'success',
duration: 2000
})
setTimeout(function () {
wx.navigateBack({})
}, 2000)
} else {
wx.showModal({
title: '提示',
content: res.data.msg,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
})
} else {
wx.showLoading({
title: '填写详细地址',
duration: 1000,
mask: true
})
}
} else {
wx.showLoading({
title: '填写街道信息',
duration: 1000,
mask: true
})
}
} else {
wx.showLoading({
title: '填写县级信息',
duration: 1000,
mask: true
})
}
} else {
wx.showLoading({
title: '填写市级信息',
duration: 1000,
mask: true
})
}
} else {
wx.showLoading({
title: '填写省级信息',
duration: 1000,
mask: true
})
}
},
// 第三问街道
bindPickerChange5(e) {
this.setData({
streetIndex: e.detail.value
})
},
// 第三问区县一级
bindPickerChange4(e) {
this.setData({
districtIndex: e.detail.value
})
var county_id = this.data.district[parseInt(e.detail.value) - 1].county_id
app.ajax("AjaxPosition/town", {
county_id: county_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
var data = res.data.data
var streetStr = ['街道']
for (let n in data) {
streetStr.push(data[n].town_name)
}
this.setData({
streetStr: streetStr,
street: data,
})
}
}, (res) => { })
},
// 第三问市一级
bindPickerChange3(e) {
this.setData({
cityIndex: e.detail.value
})
var province_id = this.data.city[parseInt(e.detail.value) - 1].city_id
app.ajax("AjaxPosition/county", {
city_id: province_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
var data = res.data.data
var districtStr = ['区县']
for (let n in data) {
districtStr.push(data[n].county_name)
}
this.setData({
districtStr: districtStr,
district: data,
// Fordistrict: data
})
}
}, (res) => { })
},
// 第三问省一级
bindPickerChange2(e) {
console.log(parseInt(e.detail.value) - 1)
this.setData({
provinceIndex: e.detail.value
})
var province_id = this.data.province[parseInt(e.detail.value) - 1].province_id
app.ajax("AjaxPosition/city", {
province_id: province_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
var data = res.data.data
var cityStr = ['市']
for (let n in data) {
cityStr.push(data[n].city_name)
}
this.setData({
cityStr: cityStr,
city: data,
})
}
}, (res) => { })
},
// 三问详细地址
detailedAddress(e) {
var val = e.detail.value;
this.setData({
detailedAddressVal: val
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// 省市区列表
app.ajax("AjaxPosition/province", {}, (res) => {
console.log("省一级")
console.log(res)
if (res.data.status == true) {
var province = res.data.data;
var provinceStr = ['省']
for (let n in province) {
provinceStr.push(province[n].province_name)
}
this.setData({
province: res.data.data,
Forprovince: res.data.data,
provinceStr: provinceStr,
})
console.log(provinceStr)
}
}, (res) => { })
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/expectLocation/expectLocation.wxml-->
<view class="bottom">
<view class="hint">
请写出您最方便的提货地点,下一个自提点很快就在您的公司楼下,家门口或你上班路过的十字路口。
</view>
<view class="location">
<picker bindchange="bindPickerChange2" value="{{provinceIndex}}" range="{{provinceStr}}">
<view class="section">
<view class="picker">
{{provinceStr[provinceIndex]}}
</view>
<text class="icon icon-icon-test3"></text>
</view>
</picker>
<picker bindchange="bindPickerChange3" value="{{cityIndex}}" range="{{cityStr}}">
<view class="section">
<view class="picker">
{{cityStr[cityIndex]}}
</view>
<text class="icon icon-icon-test3"></text>
</view>
</picker>
<picker bindchange="bindPickerChange4" value="{{districtIndex}}" range="{{districtStr}}">
<view class="section">
<view class="picker">
{{districtStr[districtIndex]}}
</view>
<text class="icon icon-icon-test3"></text>
</view>
</picker>
</view>
<picker bindchange="bindPickerChange5" value="{{streetIndex}}" range="{{streetStr}}">
<view class="section" style="width:544rpx;margin:0 auto;margin-top:20rpx;">
<view class="picker" style="font-size:28rpx;color:#999;">
{{streetStr[streetIndex]}}
</view>
<text class="icon icon-icon-test3"></text>
</view>
</picker>
<view class="section" style="width:544rpx;margin:0 auto;margin-top:20rpx;">
<input placeholder='详细地址' bindinput='detailedAddress' style="margin-left:21rpx;color:#999;"></input>
</view>
<view class="confirm" bindtap='confirm'>确认</view>
</view>
\ No newline at end of file
... ...
/* pages/expectLocation/expectLocation.wxss */
.bottom {
padding: 71rpx 75rpx;
border-top: 1rpx solid #e4e4e4;
}
.bottom .hint {
font-size: 30rpx;
color: #333;
}
.location {
margin-top: 56rpx;
display: flex;
justify-content: space-between;
}
.location .province {
background: #f7f7f7;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 26rpx;
width: 140rpx;
height: 64rpx;
}
.location .province .name {
font-size: 28rpx;
color: #999;
}
.location .province .icon {
font-size: 19rpx;
color: #999;
}
.street {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
height: 64rpx;
background: #f7f7f7;
padding: 0 26rpx;
}
.street .name {
font-size: 28rpx;
color: #999;
}
.street .icon {
font-size: 19rpx;
color: #999;
}
.street input {
font-size: 28rpx;
color: #999;
}
.confirm {
width: 233rpx;
height: 72rpx;
color: #333;
text-align: center;
line-height: 72rpx;
border-radius: 36rpx;
font-size: 34rpx;
margin: 0 auto;
margin-top: 105rpx;
background: #fc0;
}
.location {
display: flex;
justify-content: space-between;
width: 544rpx;
margin: 0 auto;
}
.location .section {
width: 169rpx;
height: 64rpx;
}
.location .section .picker {
font-size: 28rpx;
color: #999;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.section {
width: 271rpx;
height: 64rpx;
background: #f7f7f7;
margin: 0 auto;
margin-top: 45rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 30rpx;
}
.section .icon {
margin-right: 25rpx;
color: #999;
font-size: 25rpx;
}
.section .picker {
margin-left: 25rpx;
}
... ...
// pages/getGoodsDetails/getGoodsDetails.js
var WxParse = require('../../wxParse/wxParse.js');
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
allData:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.spot_id) {
console.log(options.spot_id)
app.ajax("Spot/detail", {
id: options.spot_id
}, (res) => {
console.log("获取详细地址")
console.log(res)
if (res.data.status == true){
this.setData({
allData:res.data.data
})
WxParse.wxParse('article', 'html', res.data.data.photo, this, 5);
}
}, (res) => { })
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/getGoodsDetails/getGoodsDetails.wxml-->
<import src="/wxParse/wxParse.wxml"/>
<view class="details">
<view class="location">详细地址</view>
<view class="detailsLocation">
{{allData.spot_detail_address}}
</view>
<view class="imglist">
<view class="title">场景图片</view>
</view>
<view class="list">
<template is="wxParse" data="{{wxParseData:article.nodes}}"/>
</view>
</view>
\ No newline at end of file
... ...
/* pages/getGoodsDetails/getGoodsDetails.wxss */
@import "/wxParse/wxParse.wxss";
.details{
border-top:1rpx solid #E4E4E4;
padding:56rpx 38rpx;
}
.details .location{
font-size: 30rpx;
color:#333333;
font-weight: 500;
}
.details .detailsLocation{
font-size: 30rpx;
color:#666666;
margin-top:38rpx;
}
.details .imglist .title{
font-size: 30rpx;
color:#333333;
margin-top:53rpx;
}
.details .list{
margin-top:43rpx;
}
/* .details .list image{
width:670rpx;
height:340rpx;
margin-bottom: 30rpx;
} */
\ No newline at end of file
... ...
// pages/guidance/guidance.js
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
// 第四问弹窗
fourMoudel: false,
// 第四问省一级
fourSheng: "省",
fourcity: "市",
// 第四问区县
fourDistrictStr: ["区县"],
fourDistrictIndex: 0,
// 第四问美食
fourFoodVal:"",
array: ['1', '2', '3', '4','5','6','7'],
index: 0,
province: [],
city: [],
district: [],
street: [],
Forprovince: ['省市'],
ForprovinceIndex: 0,
Fordistrict: ['区县'],
FordistrictIndex: 0,
value: [0, 0],
provinceStr: [],
provinceIndex: 0,
cityStr: ['市'],
cityIndex: 0,
districtStr: ['区县'],
districtIndex: 0,
streetStr: ['街道'],
streetIndex: 0,
// 领取
ok: false,
// 所有数据
allTopic: [],
// 选择问题-第一题答案
issue: "北舞渡",
// 三问详细地址
detailedAddressVal: "",
// 优惠券
discountCoupon:[]
},
// 立即领取
thisGet(e){
var discount_coupon_name = e.currentTarget.dataset.discount_coupon_name
var discount_coupon_price = e.currentTarget.dataset.discount_coupon_price
app.ajax("DiscountCoupon/receiveInquiryDiscountCoupon",{
unique_id: app.globalData.unique_id,
discount_coupon_name: discount_coupon_name,
discount_coupon_price: discount_coupon_price
},(res)=>{
console.log(res)
if(res.data.status == true){
wx.navigateBack({})
}
})
},
// 第四问美食input
fourFood(e) {
var value = e.detail.value;
this.setData({
fourFoodVal: value
})
},
// 第四问区县
bindPickerChange7(e) {
this.setData({
fourDistrictIndex: e.detail.value
})
},
// 第四问空事件
fourMoudelNull() { },
// 第四问弹框
fourMoudel() {
this.setData({
fourMoudel: !this.data.fourMoudel
})
},
// 第四问
bindChange: function (e) {
wx.showLoading({
title: '加载中',
mask: true
})
const val = e.detail.value
console.log(val)
var province_id = this.data.Forprovince[val[0]].province_id
app.ajax("AjaxPosition/city", {
province_id: province_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
var data = res.data.data
this.setData({
Fordistrict: data,
fourSheng: this.data.Forprovince[val[0]].province_name,
})
this.setData({
fourcity: this.data.Fordistrict[val[1]].city_name,
value: val
})
console.log(this.data.Fordistrict[val[1]].city_id)
app.ajax("AjaxPosition/county", {
city_id: this.data.Fordistrict[val[1]].city_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
wx.hideLoading()
var data = res.data.data
var fourDistrictStr = ['区县']
for (let n in data) {
fourDistrictStr.push(data[n].county_name)
}
this.setData({
fourDistrictStr: fourDistrictStr,
})
}
}, (res) => { })
}
}, (res) => { })
},
// 第三问街道
bindPickerChange5(e) {
this.setData({
streetIndex: e.detail.value
})
},
// 第三问区县一级
bindPickerChange4(e) {
this.setData({
districtIndex: e.detail.value
})
var county_id = this.data.district[parseInt(e.detail.value) - 1].county_id
app.ajax("AjaxPosition/town", {
county_id: county_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
var data = res.data.data
var streetStr = ['街道']
for (let n in data) {
streetStr.push(data[n].town_name)
}
this.setData({
streetStr: streetStr,
street: data,
})
}
}, (res) => { })
},
// 第三问市一级
bindPickerChange3(e) {
this.setData({
cityIndex: e.detail.value
})
var province_id = this.data.city[parseInt(e.detail.value) - 1].city_id
app.ajax("AjaxPosition/county", {
city_id: province_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
var data = res.data.data
var districtStr = ['区县']
for (let n in data) {
districtStr.push(data[n].county_name)
}
this.setData({
districtStr: districtStr,
district: data,
// Fordistrict: data
})
}
}, (res) => { })
},
// 第三问省一级
bindPickerChange2(e) {
console.log(parseInt(e.detail.value) - 1)
this.setData({
provinceIndex: e.detail.value
})
var province_id = this.data.province[parseInt(e.detail.value) - 1].province_id
app.ajax("AjaxPosition/city", {
province_id: province_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
var data = res.data.data
var cityStr = ['市']
for (let n in data) {
cityStr.push(data[n].city_name)
}
this.setData({
cityStr: cityStr,
city: data,
})
}
}, (res) => { })
},
// 选择答案
issue(e) {
var issue = e.currentTarget.dataset.id;
this.setData({
issue: issue
})
},
// 挑战完成
ok() {
// this.setData({
// ok: true
// })
// 三问省一级
var provinceStr = this.data.provinceStr[this.data.provinceIndex];
console.log(provinceStr)
// 三问市一级
var cityStr = this.data.cityStr[this.data.cityIndex];
console.log(cityStr)
// 三问区县一级
var districtStr = this.data.districtStr[this.data.districtIndex];
console.log(districtStr)
// 三问街道一级
var streetStr = this.data.streetStr[this.data.streetIndex];
console.log(streetStr)
// 三问详细地址
var detailedAddressVal = this.data.detailedAddressVal;
console.log(detailedAddressVal)
// 第四问省市
var fourShengfourcity = this.data.fourSheng + this.data.fourcity
console.log(fourShengfourcity)
// 第四问区县
var fourDistrictStr = this.data.fourDistrictStr[this.data.fourDistrictIndex];
console.log(fourDistrictStr)
// 第四问美食
var fourFoodVal = this.data.fourFoodVal;
console.log(fourFoodVal)
// 省id(自提点)
if (provinceStr != "省"){
if (cityStr != "市"){
if (districtStr != "区县"){
if (streetStr != "街道"){
if (detailedAddressVal != ""){
if (fourShengfourcity != "省市"){
if (fourDistrictStr != "区县"){
if (fourFoodVal != ""){
console.log(this.data.province[this.data.provinceIndex - 1].province_id)
console.log(this.data.city[this.data.cityIndex - 1].city_id)
console.log(this.data.district[this.data.districtIndex - 1].county_id)
console.log(this.data.street[this.data.streetIndex - 1].town_id)
app.ajax("Inquiry/submitInquiry",{
unique_id: app.globalData.unique_id,
taste: this.data.issue,
frequency:this.data.array[this.data.index],
province: provinceStr,
city: cityStr,
county: districtStr,
town: streetStr,
address: detailedAddressVal,
f_province: fourShengfourcity,
f_city: fourDistrictStr,
food:fourFoodVal,
province_id: this.data.province[this.data.provinceIndex - 1].province_id,
city_id: this.data.city[this.data.cityIndex - 1].city_id,
county_id: this.data.district[this.data.districtIndex - 1].county_id,
town_id: this.data.street[this.data.streetIndex - 1].town_id
},(res)=>{
console.log(res)
if(res.data.status == true){
// wx.navigateBack({})
this.setData({
ok:true
})
}else{
wx.showModal({
title: '提示',
content: res.data.msg,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
})
}else{
wx.showLoading({
title: '填写代言信息',
duration: 1000,
mask: true
})
}
}else{
wx.showLoading({
title: '填写代言信息',
duration: 1000,
mask: true
})
}
}else{
wx.showLoading({
title: '填写代言信息',
duration: 1000,
mask: true
})
}
}else{
wx.showLoading({
title: '填写自提信息',
duration: 1000,
mask: true
})
}
}else{
wx.showLoading({
title: '填写自提信息',
duration: 1000,
mask: true
})
}
}else{
wx.showLoading({
title: '填写自提信息',
duration: 1000,
mask: true
})
}
}else{
wx.showLoading({
title: '填写自提信息',
duration: 1000,
mask: true
})
}
}else{
wx.showLoading({
title: '填写自提信息',
duration: 1000,
mask:true
})
}
},
// 三问详细地址
detailedAddress(e) {
var val = e.detail.value;
this.setData({
detailedAddressVal: val
})
},
bindPickerChange: function (e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({
index: e.detail.value
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// 获取试题
app.ajax("Inquiry/index", {}, (res) => {
console.log("获取试题")
console.log(res)
if (res.data.status == true) {
this.setData({
allTopic: res.data.data
})
}
})
// 省市区列表
app.ajax("AjaxPosition/province", {}, (res) => {
console.log("省一级")
console.log(res)
if (res.data.status == true) {
var province = res.data.data;
var provinceStr = ['省']
for (let n in province) {
provinceStr.push(province[n].province_name)
}
this.setData({
province: res.data.data,
Forprovince: res.data.data,
provinceStr: provinceStr,
})
console.log(provinceStr)
}
}, (res) => { })
// 获取优惠券
app.ajax("Inquiry/getSuccessDiscountCoupon",{},(res)=>{
console.log(res)
if(res.data.status == true){
this.setData({
discountCoupon:res.data.data
})
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/guidance/guidance.wxml-->
<view style="{{ok==true?'overflow: hidden; position: fixed;top:0;width:100%;height: 100%;':''}}">
<view class="rich">
{{allTopic.part1}}
</view>
<view class="topic">
<view class="title">
<view class="num">1</view>
<view class="name">{{allTopic.part2[0].title}}</view>
</view>
<view class="gName">{{allTopic.part2[0].content}}</view>
<view class="List">
<view class="list" style="{{issue == '胡辣汤'?'background:#FFCC00;':''}}" bindtap='issue' data-id='胡辣汤'>胡辣汤</view>
<view class="list" style="{{issue == '豆浆'?'background:#FFCC00;':''}}" bindtap='issue' data-id='豆浆'>豆浆</view>
<view class="list" style="{{issue == '粥类'?'background:#FFCC00;':''}}" bindtap='issue' data-id='粥类'>粥类</view>
</view>
</view>
<view class="topic">
<view class="title">
<view class="num">2</view>
<view class="name">{{allTopic.part2[1].title}}</view>
</view>
<view class="gName">{{allTopic.part2[1].content}}</view>
<picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
<view class="section">
<view class="picker">
{{array[index]}}次
</view>
<text class="icon icon-icon-test3"></text>
</view>
</picker>
</view>
<view class="topic">
<view class="title">
<view class="num">3</view>
<view class="name">{{allTopic.part2[2].title}}</view>
</view>
<view class="gName" style="text-align:left;">{{allTopic.part2[2].content}}</view>
<view class="location">
<picker bindchange="bindPickerChange2" value="{{provinceIndex}}" range="{{provinceStr}}">
<view class="section">
<view class="picker">
{{provinceStr[provinceIndex]}}
</view>
<text class="icon icon-icon-test3"></text>
</view>
</picker>
<picker bindchange="bindPickerChange3" value="{{cityIndex}}" range="{{cityStr}}">
<view class="section">
<view class="picker">
{{cityStr[cityIndex]}}
</view>
<text class="icon icon-icon-test3"></text>
</view>
</picker>
<picker bindchange="bindPickerChange4" value="{{districtIndex}}" range="{{districtStr}}">
<view class="section">
<view class="picker">
{{districtStr[districtIndex]}}
</view>
<text class="icon icon-icon-test3"></text>
</view>
</picker>
</view>
<picker bindchange="bindPickerChange5" value="{{streetIndex}}" range="{{streetStr}}">
<view class="section" style="width:544rpx;margin:0 auto;margin-top:20rpx;">
<view class="picker" style="font-size:28rpx;color:#999;">
{{streetStr[streetIndex]}}
</view>
<text class="icon icon-icon-test3"></text>
</view>
</picker>
<view class="section" style="width:544rpx;margin:0 auto;margin-top:20rpx;">
<input placeholder='详细地址' bindinput='detailedAddress' style="margin-left:21rpx;color:#999;"></input>
</view>
</view>
<view class="topic">
<view class="title">
<view class="num">4</view>
<view class="name">第四问</view>
</view>
<view class="question">
<text>我为故乡</text>
<view bindtap='fourMoudel' style="display: flex;align-items: center;width:169rpx;height:64rpx;background:#F7F7F7; justify-content: space-between;margin-left:22rpx;">
<view class="picker" style="color:#999;margin-left:27rpx;font-size:28rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
{{fourSheng}}{{fourcity}}
</view>
<text class="icon icon-icon-test3" style="color:#999;font-size:28rpx;margin-right:16rpx;margin-right:18rpx;"></text>
</view>
<picker bindchange="bindPickerChange7" value="{{fourDistrictIndex}}" range="{{fourDistrictStr}}">
<view style="display: flex;align-items: center;width:169rpx;height:64rpx;background:#F7F7F7; justify-content: space-between;margin-left:22rpx;">
<view class="picker" style="color:#999;margin-left:27rpx;font-size:28rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
{{fourDistrictStr[fourDistrictIndex]}}
</view>
<text class="icon icon-icon-test3" style="color:#999;font-size:28rpx;margin-right:16rpx;margin-right:18rpx;"></text>
</view>
</picker>
<text style="margin-left:18rpx;">代言</text>
</view>
<view class="question">
<text>我最爱的家乡美味:</text>
<input wx:if="{{fourMoudel == false}}" bindinput='fourFood' style="width:297rpx;height:64rpx;background:#F7F7F7;"></input>
</view>
</view>
<view class="ok" bindtap='ok'>挑战完成</view>
</view>
<!-- -->
<view class="onMoudel" wx:if="{{ok}}">
<view class="moudel">
<view class="title">
• 挑战成功 •
</view>
<view class="hit">{{discountCoupon.textarea}}</view>
<view class="moneyP">
<view class="money">¥
<text>{{discountCoupon.discount_coupon_price}}</text> </view>
<view class="font">{{discountCoupon.discount_coupon_name}}</view>
</view>
<view class="thisGet" bindtap='thisGet' data-discount_coupon_name='{{discountCoupon.discount_coupon_name}}' data-discount_coupon_price="{{discountCoupon.discount_coupon_price}}">立即领取</view>
</view>
</view>
<view class="fourMoudel" bindtap='fourMoudel' wx:if="{{fourMoudel}}">
<view class="fourMoudelC">确定</view>
<picker-view catchtap='fourMoudelNull' class="moudelsss" indicator-style="height: 50px;" style="width: 100%; height: 300px;" value="{{value}}" bindchange="bindChange">
<picker-view-column>
<view wx:for="{{Forprovince}}" style="line-height: 50px;text-align:center;">{{item.province_name}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{Fordistrict}}" style="line-height: 50px;text-align:center;">{{item.city_name}}</view>
</picker-view-column>
</picker-view>
</view>
\ No newline at end of file
... ...
/* pages/guidance/guidance.wxss */
.rich {
padding: 58rpx 0;
border-top: 1rpx solid #e4e4e4;
border-bottom: 1rpx solid #e4e4e4;
}
.topic {
padding: 60rpx 53rpx 65rpx 53rpx;
border-bottom: 1rpx solid #e4e4e4;
}
.topic .title {
display: flex;
align-items: center;
}
.topic .title .num {
width: 32rpx;
height: 32rpx;
border-radius: 32rpx;
text-align: center;
line-height: 32rpx;
color: #fff;
background: #fc0;
font-size: 26rpx;
}
.topic .title .name {
font-size: 32rpx;
color: #fab701;
margin-left: 15rpx;
}
.topic .gName {
font-size: 30rpx;
color: #1a1a1a;
text-align: center;
width: 544rpx;
margin: 0 auto;
margin-top: 35rpx;
}
.topic .List {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
margin-top: 50rpx;
}
.topic .List .list {
font-size: 28rpx;
width: 146rpx;
height: 59rpx;
text-align: center;
line-height: 59rpx;
color: #333;
background: #f7f7f7;
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.topic .List::after {
content: "";
width: 146rpx;
margin-right: 20rpx;
}
.section {
width: 271rpx;
height: 64rpx;
background: #f7f7f7;
margin: 0 auto;
margin-top: 45rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 30rpx;
}
.section .icon {
margin-right: 25rpx;
color: #999;
font-size: 25rpx;
}
.section .picker {
margin-left: 25rpx;
}
.location {
display: flex;
justify-content: space-between;
width: 544rpx;
margin: 0 auto;
}
.location .section {
width: 169rpx;
height: 64rpx;
}
.location .section .picker {
font-size: 28rpx;
color: #999;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.question {
font-size: 30rpx;
color: #1a1a1a;
display: flex;
align-items: center;
width: 577rpx;
margin: 0 auto;
margin-top: 45rpx;
}
.ok {
width: 223rpx;
height: 72rpx;
text-align: center;
line-height: 72rpx;
margin: 0 auto;
color: #333;
font-size: 34rpx;
background: #fc0;
border-radius: 36rpx;
margin-top: 34rpx;
}
.onMoudel {
position: fixed;
top: 0;
width: 100%;
height: 100%;
background: rgba(1, 1, 1, 0.5);
}
.onMoudel .moudel {
width: 636rpx;
height: 587rpx;
margin: 0 auto;
margin-top: 286rpx;
background-image: url(http://omega.wx.bronet.cn/public/static/images/413@2x.png);
background-size: 100% 100%;
overflow: hidden;
}
.onMoudel .moudel .moneyP {
display: flex;
margin-top: 87rpx;
}
.onMoudel .moudel .moneyP .money {
color: #d43d31;
font-size: 36rpx;
margin-left: 131rpx;
}
.onMoudel .moudel .moneyP .money text {
font-size: 60rpx;
font-weight: 800;
}
.onMoudel .moudel .moneyP .font {
font-size: 36rpx;
width: 370rpx;
line-height: 93rpx;
text-align: center;
color: #d43d31;
}
.onMoudel .moudel .title {
color: #fff;
text-align: center;
font-size: 48rpx;
margin-top: 55rpx;
position: relative;
width: 320rpx;
left: 50%;
margin-left: -160rpx;
}
.onMoudel .moudel .title::after {
content: "";
width: 45rpx;
height: 5rpx;
background: #fff;
position: absolute;
top: 50%;
left: 0;
margin-top: -2.5rpx;
}
.onMoudel .moudel .title::before {
content: "";
width: 45rpx;
height: 5rpx;
background: #fff;
position: absolute;
top: 50%;
left: 100%;
margin-top: -2.5rpx;
margin-left: -45rpx;
}
.thisGet {
color: #d43d31;
font-size: 36rpx;
width: 403rpx;
height: 74rpx;
background: #fde03c;
border-radius: 37rpx;
margin: 0 auto;
margin-top: 125rpx;
text-align: center;
line-height: 74rpx;
}
.onMoudel .moudel .hit {
font-size: 24rpx;
color: #fff;
text-align: center;
margin-top: 13rpx;
width: 100%;
}
page {
padding-bottom: 46rpx;
}
.fourMoudel {
position: fixed;
top: 0;
width: 100%;
height: 100%;
background: rgba(1, 1, 1, 0.5);
}
.moudelsss {
position: absolute;
bottom: 0;
width: 100%;
height: 100%;
background: #fff;
}
.fourMoudelC {
color: #fff;
text-align: right;
margin-top: 604rpx;
padding-right: 23rpx;
}
... ...
var app = getApp();
var animation = wx.createAnimation({
duration: 1000,
timingFunction: "ease",
})
Page({
data: {
winHeight: "",//窗口高度
currentTab: 0, //预设当前项的值
scrollLeft: 0, //tab标题的滚动条位置
expertList: [{}],
imgUrls: [],
indicatorDots: true,
autoplay: true,
interval: 3000,
duration: 1000,
// 筛选 ------------
winWidth: 0,
winHeight: 0,
// tab切换
currentTabT: 0,
// 筛选框状态
screenModel: false,
tabBarIndex: [],
// 动画状态
animation: false,
animations: false,
moudelOne: true,
authorization: false,
// 首页数据
allData: [],
// 自提点列表
sinceList: [],
// 堂食店铺列表
hallListh: [],
// 就近自提
nearest_spot: "",
// 到店堂食
nearest_store: "",
stateShop: false,
// 是否开启调研按钮
diaoyan: false,
// 判断设备活动快距离
rpx: 0,
// 递减cart_id
cart_id:null,
menu: false,
canaction: false //阻止快速点击事件
},
// 没有门口
sisi() {
wx.navigateTo({
url: '../expectLocation/expectLocation',
})
},
// 选择到店堂食
arriveShop(e) {
wx.showLoading({
title: '地址切换中。。。',
})
console.log(app.globalData.nearest_store)
var data = e.currentTarget.dataset.data;
var params = new Object;
params.store_id = data.store_id;
params.store_name = data.store_name + data.store_address + ",距您" + data.distance_text
app.globalData.nearest_store = params;
console.log(app.globalData.nearest_store)
this.setData({
moudelOne: true,
stateShop: true,
nearest_store: app.globalData.nearest_store
})
wx.showToast({
title: '切换完成',
icon: 'success',
duration: 2000
})
},
// 选择就近自提
setLocation(e) {
wx.showLoading({
title: '地址切换中。。。',
})
var spot_id = e.currentTarget.dataset.spot_id;
var spot_name = e.currentTarget.dataset.spot_name;
var distance_text = e.currentTarget.dataset.distance_text;
var params = new Object;
params.spot_id = spot_id;
params.spot_name = spot_name + distance_text;
app.globalData.nearest_spot = params;
console.log(app.globalData.nearest_spot)
this.setData({
screenModel: false,
nearest_spot: app.globalData.nearest_spot
})
wx.showToast({
title: '切换完成',
icon: 'success',
duration: 2000
})
},
// 判断是否新人能否领取优惠券
justy(){
app.ajax("Index/isFirst", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log(res)
if (res.statusCode == '200'){
this.setData({
card: res.data.status,
cardInfo: res.data.data
})
}
})
},
// 授权登陆
bindGetUserInfo(e) {
var that = this
console.log(e)
console.log(e.detail.userInfo)
app.globalData.userInfo = e.detail.userInfo
wx.login({
success: (res) => {
if (res.code) {
//发起网络请求
console.log(res)
app.ajax("Index/auth", {
code: res.code,
iv: e.detail.iv,
encryptedData: e.detail.encryptedData,
nickname: app.globalData.userInfo.nickName,
head_img: app.globalData.userInfo.avatarUrl,
}, (res) => {
this.onShow()
if (res.data.data.is_auth == 1) {
app.globalData.unique_id = res.data.data.unique_id
if (that.data.from) {
app.ajax("DiscountCoupon/shareGetCoupon", {
from: that.data.from,
to: app.globalData.unique_id
}, (res) => {
console.log(res)
})
}
this.setData({
authorization: false
})
}
})
} else {
console.log('获取用户登录态失败!' + res.errMsg)
}
}
});
},
hideCard(){
this.setData({
card: false
})
},
getCard(event){
let that = this
let info = this.data.cardInfo
var params = Object.assign({},info)
params.unique_id = app.globalData.unique_id
app.ajax("Index/receivePledge", params, (res) => {
console.log(res)
if(res.data.state == 'success'){
that.hideCard()
wx.showToast({
title: res.data.msg,
icon: 'success'
})
}
})
},
// 递增操作
addCount(e) {
wx.showLoading({
title: '加载中',
mask: true
})
var index = e.currentTarget.dataset.index;
var id = e.currentTarget.dataset.id;
var num = parseInt(e.currentTarget.dataset.num);
num++
app.ajax("Cart/add", {
unique_id: app.globalData.unique_id,
goods_id: id,
goods_num: 1,
}, (res) => {
console.log(res)
wx.hideLoading()
if (res.data.status == true) {
var data = this.data.allData.goods_list;
data[index].chacke = true;
data[index].num = num;
this.setData({
"allData.goods_list": data
})
// 获取购物车数量
app.ajax("CountNum/countCart", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
app.globalData.tabBar[1].num = res.data.data[0].count
this.setData({
tabBarIndex: app.globalData.tabBar
})
}
}, (res) => { })
}else{
wx.showToast({
title: res.data.msg,
icon: 'none'
})
}
})
},
// 递减操作
minusCount(e) {
wx.showLoading({
title: '加载中',
mask:true
})
var index = e.currentTarget.dataset.index;
var id = e.currentTarget.dataset.id;
var num = parseInt(e.currentTarget.dataset.num);
var cart_id = e.currentTarget.dataset.cart_id
if(num<=1){
app.ajax("Cart/del", {
cart_id: cart_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
// this.getShopCar()
var data = this.data.allData.goods_list;
data[index].chacke = false;
this.setData({
"allData.goods_list": data
})
// 获取购物车数量
app.ajax("CountNum/countCart", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log(res)
wx.hideLoading()
if (res.data.status == true) {
app.globalData.tabBar[1].num = res.data.data[0].count
this.setData({
tabBarIndex: app.globalData.tabBar
})
// console.log(res.data.data[0].count)
}
}, (res) => { })
}
}, (res) => { })
}else{
num--
app.ajax("Cart/add", {
unique_id: app.globalData.unique_id,
goods_id: id,
goods_num: -1,
}, (res) => {
console.log(res)
wx.hideLoading()
if (res.data.status == true) {
var data = this.data.allData.goods_list;
data[index].chacke = true;
data[index].num = num;
this.setData({
"allData.goods_list": data,
cart_id: res.data.cart_id
})
// 获取购物车数量
app.ajax("CountNum/countCart", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
app.globalData.tabBar[1].num = res.data.data[0].count
this.setData({
tabBarIndex: app.globalData.tabBar
})
}
}, (res) => { })
}
})
}
// if (num < 1) {
// } else {
// num--
// app.ajax("Cart/editNum", {
// goods_num: -1
// }, (res) => {
// console.log(res)
// if (res.data.status == true) {
// this.getShopCar()
// // 获取购物车数量
// app.ajax("CountNum/countCart", {
// unique_id: app.globalData.unique_id
// }, (res) => {
// console.log(res)
// if (res.data.status == true) {
// if (parseInt(res.data.data[0].count) == 0) {
// wx.showModal({
// title: '提示',
// content: '是否删除该商品',
// success: (res) => {
// if (res.confirm) {
// console.log('用户点击确定')
// app.ajax("Cart/del", {
// cart_id: cart_id
// }, (res) => {
// console.log(res)
// if (res.data.status == true) {
// this.getShopCar()
// // 获取购物车数量
// app.ajax("CountNum/countCart", {
// unique_id: app.globalData.unique_id
// }, (res) => {
// console.log(res)
// if (res.data.status == true) {
// app.globalData.tabBar[1].num = res.data.data[0].count
// this.setData({
// tabBarIndex: app.globalData.tabBar
// })
// }
// }, (res) => { })
// }
// }, (res) => { })
// } else if (res.cancel) {
// console.log('用户点击取消')
// }
// }
// })
// }
// app.globalData.tabBar[1].num = res.data.data[0].count
// this.setData({
// tabBarIndex: app.globalData.tabBar
// })
// }
// }, (res) => { })
// }
// }, (res) => { })
// }
},
// 商品列表加入购物车
openShopCar(e) {
var index = e.currentTarget.dataset.index;
var id = e.currentTarget.dataset.id;
var num = e.currentTarget.dataset.num;
app.ajax("Cart/add", {
unique_id: app.globalData.unique_id,
goods_id: id,
goods_num: num,
}, (res) => {
console.log(res)
if (res.data.status == true) {
var data = this.data.allData.goods_list;
data[index].chacke = true;
data[index].cart_id = res.data.cart_id
this.setData({
"allData.goods_list": data
})
// 获取购物车数量
app.ajax("CountNum/countCart", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
app.globalData.tabBar[1].num = res.data.data[0].count
this.setData({
tabBarIndex: app.globalData.tabBar
})
}
}, (res) => { })
// 获取购物车
app.ajax("Cart/index", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log("获取购物车")
console.log(res)
if (res.data.status == true) {
app.globalData.shoppingCart = res.data.data
console.log(app.globalData.tabBar)
}
}, (res) => { })
}else{
wx.showToast({
title: '库存不足',
icon: 'none'
})
}
})
},
// 引导页
guidance() {
wx.navigateTo({
url: '../guidance/guidance',
})
},
// 门店详情
shopDetails(e) {
var store_id = e.currentTarget.dataset.store_id;
var store_name = e.currentTarget.dataset.store_name;
var open_start = e.currentTarget.dataset.open_start;
var open_end = e.currentTarget.dataset.open_end;
var store_address = e.currentTarget.dataset.store_address;
var distance_text = e.currentTarget.dataset.distance_text;
wx.navigateTo({
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,
})
},
// 下导航
tabBar(e) {
var index = e.currentTarget.dataset.index;
var tabBar = app.globalData.tabBar
for (let n in tabBar) {
tabBar[n].state = false
}
tabBar[index].state = !tabBar[index].state
app.globalData.tabBar = tabBar
wx.reLaunch({
url: tabBar[index].url,
})
},
// 列表详情
detailsGoods(e) {
var id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '../detailsGoods/detailsGoods?id=' + id,
})
},
// 取货点详情
getGoodsDetails(e) {
let spot_id = e.currentTarget.dataset.spot_id;
wx.navigateTo({
url: '../getGoodsDetails/getGoodsDetails?spot_id=' + spot_id,
})
},
// 防止穿透
cat() { },
// 点击收起筛选
model() {
console.log(1)
this.setData({
screenModel: !this.data.screenModel
})
},
// 滚动切换标签样式
switchTab: function (e) {
this.setData({
currentTab: e.detail.current
});
this.checkCor();
},
// 点击标题切换当前页时改变样式
swichNav: function (e) {
console.log(e)
if (!this.data.canaction){
return false
}else{
this.setData({
canaction: false
})
var cur = e.target.dataset.current;
var t_id = e.currentTarget.dataset.t_id;
if (this.data.currentTaB == cur) {
return false;
}else {
this.setData({
currentTab: cur
})
}
wx.showLoading({
title: '加载中',
})
var params = new Object
if (cur == 0){
params.unique_id = app.globalData.unique_id
}else if(cur == '-1'){
params.unique_id = app.globalData.unique_id
app.ajax("Index/newGoodsList", params, (res) => {
wx.hideLoading()
if (res.statusCode == '200') {
var mes = res.data.data
var data = mes;
for (let n in data) {
data[n].chacke = false
data[n].num = 1
}
for (let n in data) {
if (data[n].goods_num != null) {
data[n].chacke = true
data[n].num = parseInt(data[n].goods_num)
}
}
this.setData({
'allData.goods_list': mes,
canaction: true
})
// this.setData({
// allData: res.data.data,
// imgUrls: res.data.data.banner
// })
} else {
wx.showLoading({
title: '暂无商品',
duration: 1000
})
this.setData({
"allData.goods_list": [],
canaction: true
})
}
}, (res) => { })
return false
}else{
params.t_id = t_id
params.unique_id = app.globalData.unique_id
}
app.ajax("Index/index",params, (res) => {
wx.hideLoading()
console.log("获取首页数据")
console.log(res)
if (res.data.status == true) {
var mes = res.data.data
var data = mes.goods_list;
for (let n in data) {
data[n].chacke = false
data[n].num = 1
}
for (let n in data) {
if (data[n].goods_num != null) {
data[n].chacke = true
data[n].num = parseInt(data[n].goods_num)
}
}
app.globalData.nearest_spot = mes.nearest_spot
app.globalData.nearest_store = mes.nearest_store
this.setData({
allData: mes,
menu: true,
imgUrls: res.data.data.banner,
nearest_spot: app.globalData.nearest_spot,
nearest_store: app.globalData.nearest_store,
canaction: true
})
} else {
wx.showLoading({
title: '暂无商品',
duration: 1000
})
this.setData({
"allData.goods_list": [],
canaction: true
})
}
}, (res) => { })
}
},
//判断当前滚动超过一屏时,设置tab标题滚动条。
checkCor: function () {
if (this.data.currentTab > 4) {
this.setData({
scrollLeft: 300
})
} else {
this.setData({
scrollLeft: 0
})
}
},
/**
* 滑动切换tab
*/
bindChangeT: function (e) {
var that = this;
that.setData({ currentTabT: e.detail.current });
},
/**
* 点击tab切换
*/
swichNavT: function (e) {
var that = this;
if (this.data.currentTabT === e.target.dataset.current) {
return false;
} else {
that.setData({
currentTabT: e.target.dataset.current
})
}
var area_id = e.target.dataset.area_id;
app.ajax("Spot/index", {
area_id: area_id,
unique_id: app.globalData.unique_id
}, (res) => {
console.log("获取自提点数据")
console.log(res)
if (res.data.status == true) {
this.setData({
sinceList: res.data.data
})
if (res.data.data.spot == null) {
wx.showLoading({
title: '空空如也',
duration: 1000,
mask: true
})
}
}
}, (res) => { })
},
// 动画
animations(e) {
var state = e.currentTarget.dataset.state;
var type = e.currentTarget.dataset.type
console.log(this.data.animation)
console.log(state)
if (this.data.animations == false && state == false) {
console.log(1)
this.setData({
screenModel: !this.data.screenModel,
})
} else if (this.data.animations == true && state == true) {
if (this.data.moudelOne){
this.setData({
moudelOne: false
})
}else{
this.setData({
moudelOne: true
})
}
// this.setData({
// animation: true,
// stateShop: true
// })
} else if (this.data.animations == false && state == true) {
console.log(3)
console.log(this.data.rpx)
animation.translate((96 * 1.8) * this.data.rpx).step();
app.globalData.btnStart = false
this.setData({
animationData: animation.export(),
animations: true,
moudelOne: false,
stateShop: !this.data.stateShop,
screenModel: false
})
} else if (this.data.animations == true && state == false) {
console.log(4)
animation.translate(0).step();
app.globalData.btnStart = true
this.setData({
animationData: animation.export(),
animations: false,
moudelOne: true,
stateShop: !this.data.stateShop,
screenModel:true
})
}
},
onLoad: function (options) {
if (options.from) {
this.setData({
from: options.from
})
}
var that = this;
// 高度自适应
wx.getSystemInfo({
success: function (res) {
var clientHeight = res.windowHeight,
clientWidth = res.windowWidth,
rpxR = 750 / clientWidth;
var calc = clientHeight * rpxR - 180;
console.log(calc)
that.setData({
winHeight: calc
});
}
});
},
footerTap: app.footerTap,
onShow() {
let that = this
console.log(app.globalData.userInfo)
app.globalData.btnStart = true
wx.showLoading({
title: '加载中',
mask: true
})
// 设备判断滑动距离
wx.getSystemInfo({
success: (res) => {
let rpx = 1 * (res.windowWidth * res.pixelRatio) / (750 * res.pixelRatio);
this.setData({
rpx: rpx
})
}
})
// 获取用户是否需要授权
wx.login({
success: (res) => {
if (res.code) {
//发起网络请求
console.log(res)
app.ajax("Index/auth0", {
code: res.code
}, (res) => {
console.log(res)
wx.hideLoading()
if (res.data.data.is_auth == 1) {
app.globalData.unique_id = res.data.data.unique_id
if (that.data.from){
app.ajax("DiscountCoupon/shareGetCoupon", {
from: that.data.from,
to: app.globalData.unique_id
}, (res) => {
console.log(res)
})
}
wx.getUserInfo({
success: function (res) {
var userInfo = res.userInfo
console.log(userInfo)
app.globalData.userInfo = userInfo
}
})
this.justy()
// 检测该用户是否参与了调研
app.ajax("Inquiry/isInquiry", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log("检测该用户是否参与了调研")
console.log(res)
if (res.data.data.is_inquiry != 1) {
// wx.navigateTo({
// url: '../guidance/guidance',
// })
this.setData({
diaoyan: true
})
} else {
this.setData({
diaoyan: false
})
}
}, (res) => { })
// 获取堂食店铺列表
app.ajax("Store/storeList", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log("堂食店铺列表")
console.log(res)
if (res.data.status == true) {
this.setData({
hallListh: res.data.data
})
}
}, (res) => { })
// 获取自提列表
app.ajax("Spot/index", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log("获取自提列表")
console.log(res)
if (res.data.status == true) {
this.setData({
sinceList: res.data.data
})
if (res.data.data.spot == null) {
wx.showLoading({
title: '空空如也',
duration: 1000,
mask: true
})
}
}
}, (res) => { })
// 自提点列表
app.ajax("Spot/index", {
area_id: "",
unique_id: app.globalData.unique_id
}, (res) => {
console.log("自提点列表")
console.log(res)
}, (res) => { })
// 首页数据
app.ajax("Index/index", {
t_id: "",
unique_id: app.globalData.unique_id
}, (res) => {
console.log("获取首页数据")
console.log(res)
if (res.data.status == true) {
wx.hideLoading()
var mes = res.data.data
var data = mes.goods_list;
for (let n in data) {
data[n].chacke = false
data[n].num = 1
}
for (let n in data) {
if (data[n].goods_num != null) {
data[n].chacke = true
data[n].num = parseInt(data[n].goods_num)
}
}
app.globalData.nearest_spot = mes.nearest_spot
app.globalData.nearest_store = mes.nearest_store
this.setData({
allData: mes,
menu: true,
canaction: true,
imgUrls: res.data.data.banner,
nearest_spot: app.globalData.nearest_spot,
nearest_store: app.globalData.nearest_store
})
}
}, (res) => { })
// 获取购物车数量
app.ajax("CountNum/countCart", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log(res)
if (res.data.status == true) {
app.globalData.tabBar[1].num = res.data.data[0].count
this.setData({
tabBarIndex: app.globalData.tabBar
})
}
}, (res) => { })
// 获取购物车
app.ajax("Cart/index", {
unique_id: app.globalData.unique_id
}, (res) => {
console.log("获取购物车")
console.log(res)
if (res.data.status == true) {
var data = res.data.data
for (let n in data.cartList){
data.cartList[n].checked = true
}
app.globalData.shoppingCart = data
console.log(app.globalData.tabBar)
}
}, (res) => { })
} else if (res.data.data.is_auth == 0) {
this.setData({
authorization: true,
})
}
})
} else {
console.log('获取用户登录态失败!' + res.errMsg)
}
}
});
// 获取经纬度
wx.getLocation({
type: 'wgs84',
success: (res) => {
var latitude = res.latitude
var longitude = res.longitude
app.ajax("Index/updateLatLng", {
unique_id: app.globalData.unique_id,
lat: latitude,
lng: longitude
}, (res) => {
console.log(res)
})
}
})
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--index.wxml-->
<!-- bindtap='model' -->
<view wx:if="{{!authorization}}">
<view style="{{authorization == true?'position:fixed;top:0;width:100%;height:100%':''}}{{screenModel?'position:fixed;top:0;width:100%;height:100%':''}}">
<view class="sinceLoc">
<view class="btn">
<view class="animate" animation="{{animationData}}"></view>
<view class="left" style="{{!moudelOne?'color:#666666;':''}}" data-type='ziti' bindtap='animations' data-state='{{animation}}'>就近自提</view>
<view class="right" style="{{moudelOne?'color:#666666;':''}}" data-type='shitang' bindtap='animations' data-state='{{!animation}}'>到店堂食</view>
</view>
<view class="location" wx:if="{{!stateShop}}">
<!-- <text class="icon icon-hdxq_icon"></text> {{moudelOne&&!stateShop?nearest_spot.spot_name:nearest_store.store_name}} -->
<text class="icon icon-hdxq_icon"></text> {{nearest_spot.spot_name}}
</view>
<view class="location" wx:if="{{stateShop}}">
<text class="icon icon-hdxq_icon"></text> {{nearest_store.store_name}}
</view>
</view>
<view wx:if="{{moudelOne}}">
<!-- 筛选 -->
<view class="screenModel" bindtap='model' wx:if="{{screenModel}}">
<view class="screen" catchtap='cat'>
<view class="screenTitle">
<view class="screenLeft">选择自提点</view>
<view class="screenRight" catchtap='sisi'>没有门口的?点我试试!</view>
</view>
</view>
<view class="screenBj" catchtap='cat'>
<view class="swiper-tab">
<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>
</view>
<swiper class="swiper-box" duration="300" bindchange="bindChangeT">
<swiper-item>
<view class="List">
<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="">
<view class="name">{{item.spot_name}}</view>
<view class="distance">
<view class="distanceLeft">
<text class="icon icon-hdxq_icon"></text>
<text style="font-size:26rpx;color:#999999;margin-left:9rpx;">距您{{item.distance_text}}</text>
</view>
<view class="distanceRight" catchtap='getGoodsDetails' data-spot_id='{{item.spot_id}}'>
取货点详情
</view>
</view>
</view>
</view>
</swiper-item>
</swiper>
</view>
</view>
<view>
<scroll-view scroll-x="true" class="tab-h" scroll-left="{{scrollLeft}}" wx:if='{{menu}}'>
<view class="tab-item new {{currentTab==-1?'active':''}}" data-current="-1" bindtap="swichNav">新品试吃</view>
<view class="tab-item {{currentTab==0?'active':''}}" data-current="0" bindtap="swichNav">全部分类</view>
<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>
</scroll-view>
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" style="height:348rpx;">
<block wx:for="{{imgUrls}}" wx:key="" >
<swiper-item bindtap='detailsGoods' data-id="{{item.bind_goods_id}}">
<image src="{{item.slide_pic}}" class="slide-image" style="width:100%;height:348rpx;" />
</swiper-item>
</block>
</swiper>
<swiper class="tab-content" duration="300" bindchange="switchTab" style="height:{{248*allData.goods_list.length+90}}rpx">
<swiper-item>
<scroll-view scroll-x="true" class="scoll-h">
<block wx:for="{{allData.goods_list}}" wx:key="*this">
<view style="padding:0 34rpx;" bindtap='detailsGoods' data-id="{{item.goods_id}}">
<view class="item-ans">
<view class="avatar">
<image class="img" src="{{item.thumb}}"></image>
</view>
<view class="expertInfo">
<view class="name">{{item.goods_name}}</view>
<view class="tag">{{item.goods_description}}</view>
<view class="answerHistory">
<text style="color:#C90103;font-size:36rpx;">¥{{item.goods_price}}</text>
<text style="color:#999999;font-size:24rpx;margin-left:34rpx;">月销 {{item.month_sales}} 件</text>
</view>
</view>
<view class="askBtn">
<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>
<view class="stepper" wx:if="{{item.chacke == true}}">
<!-- 减号 -->
<text class="{{minusStatus}}" catchtap="minusCount" data-id='{{item.goods_id}}' data-index="{{index}}" data-num='{{item.num}}' data-cart_id="{{item.cart_id}}">-</text>
<!-- 数值 -->
<text style="background:#fff;color:#333333;font-size:36rpx;border:0;line-height:44rpx;">{{item.num}}</text>
<!-- 加号 -->
<text class="normal" catchtap="addCount" data-id='{{item.goods_id}}' data-index="{{index}}" data-num='{{item.num}}'>+</text>
</view>
</view>
</view>
</view>
</block>
</scroll-view>
</swiper-item>
</swiper>
<view class='nodata' wx:if="{{allData.goods_list.length == 0}}">暂无相关数据</view>
</view>
</view>
<view wx:if="{{moudelOne == false}}" wx:for="{{hallListh}}" wx:key="" style="padding-left: 38rpx;padding-right: 40rpx;">
<view class="locationList" bindtap='arriveShop' data-data='{{item}}'>
<view class="left">
<view class="nameNum">
<view class="name">{{item.store_name}}</view>
<view class="num">距您{{item.distance_text}}</view>
</view>
<view class='time'>
<text class="icon icon-hdxq_icon1"></text>
<view class="times">营业时间:{{item.open_start}}-{{item.open_end}}</view>
</view>
<view class="time" style="margin-top:21rpx;">
<text class="icon icon-hdxq_icon"></text>
<view class="times">{{item.store_address}}</view>
</view>
</view>
<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}}'>
<text class="icon icon-icon-test3"></text>
</view>
</view>
</view>
<view class="tabBar">
<view class="barList" bindtap='tabBar' data-index='{{index}}' wx:for="{{tabBarIndex}}" wx:key="">
<image wx:if="{{item.state == false}}" src="{{item.img}}"></image>
<image wx:else src="{{item.selectImg}}"></image>
<view class="font" style="{{item.state == false?'':'color:#FEAD00'}}">{{item.name}}</view>
<view class="num" wx:if="{{item.num != null}}">{{item.num}}</view>
</view>
</view>
<view class="suspend" wx:if="{{diaoyan}}" bindtap='guidance'>
<image src="https://shipin.wx.broteam.cn/public/images/inquire.png"></image>
</view>
</view>
</view>
<view class="page" wx:if="{{authorization}}">
<view class="userAvatarUrl">
<open-data type="userAvatarUrl"></open-data>
</view>
<view class="userNickName">
<open-data type="userNickName"></open-data>
</view>
<view class="btn">
<button open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="bindGetUserInfo">授权登录</button>
</view>
</view>
<!-- 优惠券 -->
<view class='card' wx:if="{{card}}">
<view class='card_box'>
<view class='card_container'>
<image src='/img/card_bg.png'></image>
<view class='card_info'>{{cardInfo.pledge_name}}X{{cardInfo.num}}</view>
<view class='get_btn' bindtap='getCard'>
<image src='/img/get_btn.png'></image>
</view>
<view class='close icon icon-close' bindtap='hideCard'></view>
</view>
</view>
</view>
\ No newline at end of file
... ...