商品详情,购物车
This commit is contained in:
parent
339fada3e1
commit
4901d6c43f
207
app.json
207
app.json
@ -1,104 +1,109 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
|
||||||
"pages/index/index",
|
|
||||||
"pages/travel/travel",
|
|
||||||
"pages/resource/resource",
|
|
||||||
"pages/template/template",
|
|
||||||
"pages/train/train",
|
|
||||||
"pages/cultureMap/cultureMap",
|
|
||||||
"pages/order/order",
|
|
||||||
"pages/venue/venue",
|
|
||||||
"pages/center/center",
|
|
||||||
"pages/myFriendCircle/myFriendCircle",
|
|
||||||
"pages/friendCircle/friendCircle",
|
|
||||||
"pages/orderDetail/orderDetail",
|
|
||||||
"pages/broadcastList/broadcastList",
|
|
||||||
"pages/myVenueOrder/myVenueOrder",
|
|
||||||
"pages/broadcast/broadcast",
|
|
||||||
"pages/activityDialog/activityDialog",
|
|
||||||
"pages/teamDetail/teamDetail",
|
|
||||||
"pages/volunteerRegister/volunteerRegister",
|
|
||||||
"pages/volunteer/volunteer",
|
|
||||||
"pages/heritage/heritage",
|
|
||||||
"pages/broadcastDetail/broadcastDetail",
|
|
||||||
"pages/venueDetail/venueDetail",
|
|
||||||
"pages/book/book",
|
|
||||||
"pages/register/register",
|
|
||||||
"pages/login/login",
|
|
||||||
"pages/newVolunteerActivity/newVolunteerActivity",
|
|
||||||
"pages/newTeam/newTeam",
|
|
||||||
"pages/volunteerTeam/volunteerTeam",
|
|
||||||
"pages/cultureDetail/cultureDetail",
|
|
||||||
"pages/activitySign/activitySign",
|
|
||||||
"pages/activityDetail/activityDetail",
|
|
||||||
"pages/activity/activity",
|
|
||||||
"pages/newsDetail/newsDetail",
|
|
||||||
"pages/newsList/newsList",
|
|
||||||
"pages/myActivity/myActivity",
|
|
||||||
"pages/myVolunteerTeam/myVolunteerTeam",
|
|
||||||
"pages/myVolunteerActivity/myVolunteerActivity",
|
|
||||||
"pages/serviceActivityDetail/serviceActivityDetail",
|
|
||||||
"pages/shop/shopcategory"
|
|
||||||
],
|
|
||||||
"subPackages": [{
|
|
||||||
"root": "subpages/goodslist",
|
|
||||||
"pages": [
|
"pages": [
|
||||||
"goodslist"
|
"pages/index/index",
|
||||||
]
|
"pages/travel/travel",
|
||||||
}],
|
"pages/resource/resource",
|
||||||
"window": {
|
"pages/template/template",
|
||||||
"backgroundTextStyle": "light",
|
"pages/train/train",
|
||||||
"navigationBarBackgroundColor": "#9F1512",
|
"pages/cultureMap/cultureMap",
|
||||||
"navigationBarTitleText": "日喀则市数字文化云",
|
"pages/order/order",
|
||||||
"navigationBarTextStyle": "white"
|
"pages/venue/venue",
|
||||||
},
|
"pages/center/center",
|
||||||
"tabBar": {
|
"pages/myFriendCircle/myFriendCircle",
|
||||||
"color": "#BBBBBB",
|
"pages/friendCircle/friendCircle",
|
||||||
"borderStyle": "black",
|
"pages/orderDetail/orderDetail",
|
||||||
"selectedColor": "#000000",
|
"pages/broadcastList/broadcastList",
|
||||||
"list": [{
|
"pages/myVenueOrder/myVenueOrder",
|
||||||
"pagePath": "pages/index/index",
|
"pages/broadcast/broadcast",
|
||||||
"iconPath": "images/index.png",
|
"pages/activityDialog/activityDialog",
|
||||||
"text": "首页",
|
"pages/teamDetail/teamDetail",
|
||||||
"selectedIconPath": "images/index-on.png"
|
"pages/volunteerRegister/volunteerRegister",
|
||||||
},
|
"pages/volunteer/volunteer",
|
||||||
{
|
"pages/heritage/heritage",
|
||||||
"pagePath": "pages/activity/activity",
|
"pages/broadcastDetail/broadcastDetail",
|
||||||
"iconPath": "images/activity.png",
|
"pages/venueDetail/venueDetail",
|
||||||
"text": "活动",
|
"pages/book/book",
|
||||||
"selectedIconPath": "images/activity-on.png"
|
"pages/register/register",
|
||||||
},
|
"pages/login/login",
|
||||||
{
|
"pages/newVolunteerActivity/newVolunteerActivity",
|
||||||
"pagePath": "pages/venue/venue",
|
"pages/newTeam/newTeam",
|
||||||
"iconPath": "images/venue.png",
|
"pages/volunteerTeam/volunteerTeam",
|
||||||
"text": "场馆",
|
"pages/cultureDetail/cultureDetail",
|
||||||
"selectedIconPath": "images/venue-on.png"
|
"pages/activitySign/activitySign",
|
||||||
},
|
"pages/activityDetail/activityDetail",
|
||||||
{
|
"pages/activity/activity",
|
||||||
"pagePath": "pages/shop/shopcategory",
|
"pages/newsDetail/newsDetail",
|
||||||
"iconPath": "images/culture.png",
|
"pages/newsList/newsList",
|
||||||
"text": "商城",
|
"pages/myActivity/myActivity",
|
||||||
"selectedIconPath": "images/culture-on.png"
|
"pages/myVolunteerTeam/myVolunteerTeam",
|
||||||
},
|
"pages/myVolunteerActivity/myVolunteerActivity",
|
||||||
{
|
"pages/serviceActivityDetail/serviceActivityDetail",
|
||||||
"pagePath": "pages/center/center",
|
"pages/shop/shopcategory",
|
||||||
"iconPath": "images/center.png",
|
"subpages/goodsdetail/goodsdetail",
|
||||||
"text": "我的",
|
"subpages/goodscar/goodscar"
|
||||||
"selectedIconPath": "images/center-on.png"
|
],
|
||||||
}
|
"subPackages": [
|
||||||
]
|
{
|
||||||
},
|
"root": "subpages/goodslist",
|
||||||
"usingComponents": {
|
"pages": [
|
||||||
"page-loading": "/components/loading/pageloading"
|
"goodslist"
|
||||||
},
|
]
|
||||||
"permission": {
|
}
|
||||||
"scope.userLocation": {
|
],
|
||||||
"desc": "你的位置信息将用于您当前所在位置"
|
"window": {
|
||||||
}
|
"backgroundTextStyle": "light",
|
||||||
},
|
"navigationBarBackgroundColor": "#9F1512",
|
||||||
"requiredPrivateInfos": [
|
"navigationBarTitleText": "日喀则市数字文化云",
|
||||||
"getLocation"
|
"navigationBarTextStyle": "white"
|
||||||
],
|
},
|
||||||
"style": "v2",
|
"tabBar": {
|
||||||
"sitemapLocation": "sitemap.json"
|
"color": "#BBBBBB",
|
||||||
|
"borderStyle": "black",
|
||||||
|
"selectedColor": "#000000",
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"pagePath": "pages/index/index",
|
||||||
|
"iconPath": "images/index.png",
|
||||||
|
"text": "首页",
|
||||||
|
"selectedIconPath": "images/index-on.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/activity/activity",
|
||||||
|
"iconPath": "images/activity.png",
|
||||||
|
"text": "活动",
|
||||||
|
"selectedIconPath": "images/activity-on.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/venue/venue",
|
||||||
|
"iconPath": "images/venue.png",
|
||||||
|
"text": "场馆",
|
||||||
|
"selectedIconPath": "images/venue-on.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/shop/shopcategory",
|
||||||
|
"iconPath": "images/culture.png",
|
||||||
|
"text": "商城",
|
||||||
|
"selectedIconPath": "images/culture-on.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/center/center",
|
||||||
|
"iconPath": "images/center.png",
|
||||||
|
"text": "我的",
|
||||||
|
"selectedIconPath": "images/center-on.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"usingComponents": {
|
||||||
|
"page-loading": "/components/loading/pageloading"
|
||||||
|
},
|
||||||
|
"permission": {
|
||||||
|
"scope.userLocation": {
|
||||||
|
"desc": "你的位置信息将用于您当前所在位置"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"requiredPrivateInfos": [
|
||||||
|
"getLocation"
|
||||||
|
],
|
||||||
|
"style": "v2",
|
||||||
|
"sitemapLocation": "sitemap.json"
|
||||||
}
|
}
|
@ -2,332 +2,338 @@
|
|||||||
var app = getApp()
|
var app = getApp()
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
randomName: true,
|
randomName: true,
|
||||||
showPhone: true,
|
showPhone: true,
|
||||||
gotCode: false,
|
gotCode: false,
|
||||||
restTime: 120,
|
restTime: 120,
|
||||||
timer: '',
|
timer: '',
|
||||||
userAvatar: '',
|
userAvatar: '',
|
||||||
token: '',
|
token: '',
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
usercenterUrl: app.usercenterUrl,
|
usercenterUrl: app.usercenterUrl,
|
||||||
sourcePath: '/route/file/download/true/',
|
sourcePath: '/route/file/download/true/',
|
||||||
phone: '',
|
phone: '',
|
||||||
code: '',
|
code: '',
|
||||||
isLoading: false
|
|
||||||
},
|
|
||||||
// 选择头像来源
|
|
||||||
changeAvatar: function () {
|
|
||||||
var self = this
|
|
||||||
wx.showActionSheet({
|
|
||||||
itemList: ['从相册中选择','拍照'],
|
|
||||||
success: function (res) {
|
|
||||||
if (!res.cancel) {
|
|
||||||
if (res.tapIndex == 0) {
|
|
||||||
self.chooseAvatar('album')
|
|
||||||
} else {
|
|
||||||
self.chooseAvatar('camera')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 选择图片
|
|
||||||
chooseAvatar: function (type) {
|
|
||||||
var self = this
|
|
||||||
wx.chooseImage({
|
|
||||||
count: 1,
|
|
||||||
sizeType: ['original', 'compressed'],
|
|
||||||
sourceType: [type],
|
|
||||||
success: function (res) {
|
|
||||||
var avatar = res.tempFilePaths[0];
|
|
||||||
app.restAjax.file(app.restAjax.path('{usercenterUrl}/app/file/uploadimage', [app.usercenterUrl]), avatar, 'image', {
|
|
||||||
headers: {
|
|
||||||
token: self.data.token
|
|
||||||
}
|
|
||||||
}, function (code, data) {
|
|
||||||
var id = JSON.parse(data).data
|
|
||||||
self.uploadAvatar(id)
|
|
||||||
}, function (code, data) {
|
|
||||||
console.log(data)
|
|
||||||
})
|
|
||||||
self.setData({
|
|
||||||
userAvatar: avatar
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 上传
|
|
||||||
uploadAvatar: function (avatarId) {
|
|
||||||
var self = this
|
|
||||||
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateuseravatar', [app.usercenterUrl]), {
|
|
||||||
avatar: avatarId
|
|
||||||
}, {
|
|
||||||
headers: {
|
|
||||||
token: self.data.token
|
|
||||||
}
|
|
||||||
}, function (code, data) {
|
|
||||||
wx.setStorageSync('token', data.data);
|
|
||||||
self.getUserInfo()
|
|
||||||
}, function (code, data) {
|
|
||||||
console.log(data)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 获取token
|
|
||||||
getToken: function () {
|
|
||||||
var self = this
|
|
||||||
wx.getStorage({
|
|
||||||
key: 'token',
|
|
||||||
success: function(res) {
|
|
||||||
self.setData({
|
|
||||||
token: res.data
|
|
||||||
})
|
|
||||||
self.getUserInfo()
|
|
||||||
},
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 跳转到我的活动
|
|
||||||
*/
|
|
||||||
toMyJoinActivity(){
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '/pages/myActivity/myActivity',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 跳转到我的预订列表
|
|
||||||
*/
|
|
||||||
toMyOrder: function() {
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '../order/order',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 跳转到我的志愿团队页面
|
|
||||||
*/
|
|
||||||
toMyTeam: function() {
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '../myVolunteerTeam/myVolunteerTeam',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 跳转到我的志愿活动页面
|
|
||||||
*/
|
|
||||||
toMyVolunteerActivity: function() {
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '../myVolunteerActivity/myVolunteerActivity',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 跳转到我发布的朋友圈页面
|
|
||||||
*/
|
|
||||||
toMyFirend: function () {
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '../myFriendCircle/myFriendCircle',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 跳转到我预定的场馆页面
|
|
||||||
*/
|
|
||||||
toMyOrder: function () {
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '../order/order',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 获取输入的手机号
|
|
||||||
phoneNum: function (res) {
|
|
||||||
this.setData({
|
|
||||||
phone: res.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 校验手机号
|
|
||||||
testPhone: function () {
|
|
||||||
var self = this
|
|
||||||
if (self.data.phone) {
|
|
||||||
if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(self.data.phone)) {
|
|
||||||
wx.showToast({
|
|
||||||
title: '请输入正确的手机号',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 1500
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
self.getCode()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
wx.showToast({
|
|
||||||
title: '手机号不能为空',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 1500
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 提交绑定手机
|
|
||||||
submitPhone: function () {
|
|
||||||
var self = this;
|
|
||||||
self.setData({
|
|
||||||
isConfirm: true
|
|
||||||
})
|
|
||||||
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateminiappdefaultusername', [app.usercenterUrl]), {
|
|
||||||
phone: self.data.phone
|
|
||||||
}, {
|
|
||||||
headers: {
|
|
||||||
token: self.data.token
|
|
||||||
}
|
|
||||||
}, function (code, data) {
|
|
||||||
wx.setStorageSync('token', data.data);
|
|
||||||
wx.setStorageSync('isRandomUsername', 0)
|
|
||||||
clearInterval(self.data.timer)
|
|
||||||
self.setData({
|
|
||||||
showPhone: false
|
|
||||||
})
|
|
||||||
wx.showTabBar();
|
|
||||||
self.getUserInfo()
|
|
||||||
}, function (code, data) {
|
|
||||||
app.dialog.msg(data.msg);
|
|
||||||
self.setData({
|
|
||||||
isConfirm: false
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// // 验证码
|
|
||||||
// inputCode: function (e) {
|
|
||||||
// this.setData({
|
|
||||||
// code: e.detail.value
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
getPhoneNumber: function (e) {
|
|
||||||
var self = this
|
|
||||||
self.setData({
|
|
||||||
isLoading: true
|
|
||||||
})
|
|
||||||
console.log(e)
|
|
||||||
if (e.detail.errMsg == 'getPhoneNumber:ok') {
|
|
||||||
var info = {
|
|
||||||
encryptedData: e.detail.encryptedData,
|
|
||||||
iv: e.detail.iv
|
|
||||||
}
|
|
||||||
// app.dialog.loading('正在加载');
|
|
||||||
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/miniapp/update-phone', [app.usercenterUrl]), info, {
|
|
||||||
headers: {
|
|
||||||
token: self.data.token
|
|
||||||
}
|
|
||||||
}, function (code, data) {
|
|
||||||
// wx.hideLoading();
|
|
||||||
self.setData({
|
|
||||||
isLoading: false
|
|
||||||
})
|
|
||||||
wx.setStorageSync('token', data.data);
|
|
||||||
wx.setStorageSync('isRandomUsername', '0');
|
|
||||||
self.setData({
|
|
||||||
randomName: false,
|
|
||||||
token: data.data
|
|
||||||
})
|
|
||||||
self.getUserInfo()
|
|
||||||
app.dialog.msg('绑定成功');
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
self.setData({
|
|
||||||
isLoading: false
|
isLoading: false
|
||||||
})
|
},
|
||||||
}
|
// 选择头像来源
|
||||||
},
|
changeAvatar: function () {
|
||||||
// 判断用户是否为随机名称
|
var self = this
|
||||||
isRandomName: function () {
|
wx.showActionSheet({
|
||||||
var self = this
|
itemList: ['从相册中选择', '拍照'],
|
||||||
wx.getStorage({
|
success: function (res) {
|
||||||
key: 'isRandomUsername',
|
if (!res.cancel) {
|
||||||
success: function (res) {
|
if (res.tapIndex == 0) {
|
||||||
if (res.data == 1) {
|
self.chooseAvatar('album')
|
||||||
self.setData({
|
} else {
|
||||||
randomName: true
|
self.chooseAvatar('camera')
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 选择图片
|
||||||
|
chooseAvatar: function (type) {
|
||||||
|
var self = this
|
||||||
|
wx.chooseImage({
|
||||||
|
count: 1,
|
||||||
|
sizeType: ['original', 'compressed'],
|
||||||
|
sourceType: [type],
|
||||||
|
success: function (res) {
|
||||||
|
var avatar = res.tempFilePaths[0];
|
||||||
|
app.restAjax.file(app.restAjax.path('{usercenterUrl}/app/file/uploadimage', [app.usercenterUrl]), avatar, 'image', {
|
||||||
|
headers: {
|
||||||
|
token: self.data.token
|
||||||
|
}
|
||||||
|
}, function (code, data) {
|
||||||
|
var id = JSON.parse(data).data
|
||||||
|
self.uploadAvatar(id)
|
||||||
|
}, function (code, data) {
|
||||||
|
console.log(data)
|
||||||
|
})
|
||||||
|
self.setData({
|
||||||
|
userAvatar: avatar
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 上传
|
||||||
|
uploadAvatar: function (avatarId) {
|
||||||
|
var self = this
|
||||||
|
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateuseravatar', [app.usercenterUrl]), {
|
||||||
|
avatar: avatarId
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
token: self.data.token
|
||||||
|
}
|
||||||
|
}, function (code, data) {
|
||||||
|
wx.setStorageSync('token', data.data);
|
||||||
|
self.getUserInfo()
|
||||||
|
}, function (code, data) {
|
||||||
|
console.log(data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取token
|
||||||
|
getToken: function () {
|
||||||
|
var self = this
|
||||||
|
wx.getStorage({
|
||||||
|
key: 'token',
|
||||||
|
success: function (res) {
|
||||||
|
self.setData({
|
||||||
|
token: res.data
|
||||||
|
})
|
||||||
|
self.getUserInfo()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 购物车
|
||||||
|
toShopCar() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/subpages/goodscar/goodscar',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 跳转到我的活动
|
||||||
|
*/
|
||||||
|
toMyJoinActivity() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/myActivity/myActivity',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 跳转到我的预订列表
|
||||||
|
*/
|
||||||
|
toMyOrder: function () {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../order/order',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 跳转到我的志愿团队页面
|
||||||
|
*/
|
||||||
|
toMyTeam: function () {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../myVolunteerTeam/myVolunteerTeam',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 跳转到我的志愿活动页面
|
||||||
|
*/
|
||||||
|
toMyVolunteerActivity: function () {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../myVolunteerActivity/myVolunteerActivity',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 跳转到我发布的朋友圈页面
|
||||||
|
*/
|
||||||
|
toMyFirend: function () {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../myFriendCircle/myFriendCircle',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 跳转到我预定的场馆页面
|
||||||
|
*/
|
||||||
|
toMyOrder: function () {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../order/order',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取输入的手机号
|
||||||
|
phoneNum: function (res) {
|
||||||
|
this.setData({
|
||||||
|
phone: res.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 校验手机号
|
||||||
|
testPhone: function () {
|
||||||
|
var self = this
|
||||||
|
if (self.data.phone) {
|
||||||
|
if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(self.data.phone)) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请输入正确的手机号',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
self.getCode()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.setData({
|
wx.showToast({
|
||||||
randomName: false
|
title: '手机号不能为空',
|
||||||
})
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
})
|
// 提交绑定手机
|
||||||
},
|
submitPhone: function () {
|
||||||
// 获取用户信息
|
var self = this;
|
||||||
getUserInfo: function () {
|
self.setData({
|
||||||
var self = this
|
isConfirm: true
|
||||||
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/user/get-app-user', [app.usercenterUrl]), {}, {
|
})
|
||||||
headers: {
|
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateminiappdefaultusername', [app.usercenterUrl]), {
|
||||||
token: self.data.token
|
phone: self.data.phone
|
||||||
}
|
}, {
|
||||||
}, function (code, data) {
|
headers: {
|
||||||
self.setData({
|
token: self.data.token
|
||||||
userInfo: data
|
}
|
||||||
})
|
}, function (code, data) {
|
||||||
}, function (code, data) {
|
wx.setStorageSync('token', data.data);
|
||||||
app.dialog.msg(data.msg);
|
wx.setStorageSync('isRandomUsername', 0)
|
||||||
})
|
clearInterval(self.data.timer)
|
||||||
},
|
self.setData({
|
||||||
cancelPhone: function () {
|
showPhone: false
|
||||||
this.setData({
|
})
|
||||||
showPhone: false
|
wx.showTabBar();
|
||||||
})
|
self.getUserInfo()
|
||||||
wx.showTabBar()
|
}, function (code, data) {
|
||||||
},
|
app.dialog.msg(data.msg);
|
||||||
/**
|
self.setData({
|
||||||
* 生命周期函数--监听页面加载
|
isConfirm: false
|
||||||
*/
|
})
|
||||||
onLoad: function (options) {
|
})
|
||||||
this.isRandomName();
|
},
|
||||||
this.getToken();
|
// // 验证码
|
||||||
},
|
// inputCode: function (e) {
|
||||||
|
// this.setData({
|
||||||
|
// code: e.detail.value
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
getPhoneNumber: function (e) {
|
||||||
|
var self = this
|
||||||
|
self.setData({
|
||||||
|
isLoading: true
|
||||||
|
})
|
||||||
|
console.log(e)
|
||||||
|
if (e.detail.errMsg == 'getPhoneNumber:ok') {
|
||||||
|
var info = {
|
||||||
|
encryptedData: e.detail.encryptedData,
|
||||||
|
iv: e.detail.iv
|
||||||
|
}
|
||||||
|
// app.dialog.loading('正在加载');
|
||||||
|
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/miniapp/update-phone', [app.usercenterUrl]), info, {
|
||||||
|
headers: {
|
||||||
|
token: self.data.token
|
||||||
|
}
|
||||||
|
}, function (code, data) {
|
||||||
|
// wx.hideLoading();
|
||||||
|
self.setData({
|
||||||
|
isLoading: false
|
||||||
|
})
|
||||||
|
wx.setStorageSync('token', data.data);
|
||||||
|
wx.setStorageSync('isRandomUsername', '0');
|
||||||
|
self.setData({
|
||||||
|
randomName: false,
|
||||||
|
token: data.data
|
||||||
|
})
|
||||||
|
self.getUserInfo()
|
||||||
|
app.dialog.msg('绑定成功');
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
self.setData({
|
||||||
|
isLoading: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 判断用户是否为随机名称
|
||||||
|
isRandomName: function () {
|
||||||
|
var self = this
|
||||||
|
wx.getStorage({
|
||||||
|
key: 'isRandomUsername',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.data == 1) {
|
||||||
|
self.setData({
|
||||||
|
randomName: true
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
self.setData({
|
||||||
|
randomName: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取用户信息
|
||||||
|
getUserInfo: function () {
|
||||||
|
var self = this
|
||||||
|
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/user/get-app-user', [app.usercenterUrl]), {}, {
|
||||||
|
headers: {
|
||||||
|
token: self.data.token
|
||||||
|
}
|
||||||
|
}, function (code, data) {
|
||||||
|
self.setData({
|
||||||
|
userInfo: data
|
||||||
|
})
|
||||||
|
}, function (code, data) {
|
||||||
|
app.dialog.msg(data.msg);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
cancelPhone: function () {
|
||||||
|
this.setData({
|
||||||
|
showPhone: false
|
||||||
|
})
|
||||||
|
wx.showTabBar()
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.isRandomName();
|
||||||
|
this.getToken();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
onReady: function () {
|
onReady: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面隐藏
|
* 生命周期函数--监听页面隐藏
|
||||||
*/
|
*/
|
||||||
onHide: function () {
|
onHide: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面卸载
|
* 生命周期函数--监听页面卸载
|
||||||
*/
|
*/
|
||||||
onUnload: function () {
|
onUnload: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
*/
|
*/
|
||||||
onPullDownRefresh: function () {
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面上拉触底事件的处理函数
|
* 页面上拉触底事件的处理函数
|
||||||
*/
|
*/
|
||||||
onReachBottom: function () {
|
onReachBottom: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户点击右上角分享
|
* 用户点击右上角分享
|
||||||
*/
|
*/
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -41,10 +41,10 @@
|
|||||||
<image src="../../images/team.png"></image>
|
<image src="../../images/team.png"></image>
|
||||||
<view class="title">我的志愿活动</view>
|
<view class="title">我的志愿活动</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="main-box">
|
<view class="main-box" bindtap="toShopCar">
|
||||||
<image src="../../images/share.png"></image>
|
<image src="../../images/share.png"></image>
|
||||||
<view class="title">我的分享</view>
|
<view class="title">购物车</view>
|
||||||
</view> -->
|
</view>
|
||||||
<!-- <view class="main-box">
|
<!-- <view class="main-box">
|
||||||
<image src="../../images/setting.png"></image>
|
<image src="../../images/setting.png"></image>
|
||||||
<view class="title">设置</view>
|
<view class="title">设置</view>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<view class="container-box" wx:if="{{isHidePageLoading}}">
|
<view class="container-box" wx:if="{{isHidePageLoading}}">
|
||||||
<view class="left">
|
<scroll-view class="left" scroll-y="true">
|
||||||
<view bindtap="chooseOne" data-index="{{index}}" class="{{currentIndex==index ? 'category-item-active':'category-item-default'}}" wx:for="{{categoryOneList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
|
<view bindtap="chooseOne" data-index="{{index}}" class="{{currentIndex==index ? 'category-item-active':'category-item-default'}}" wx:for="{{categoryOneList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
|
||||||
<view wx:if="{{currentIndex==index}}" class="line"></view>
|
<view wx:if="{{currentIndex==index}}" class="line"></view>
|
||||||
<view class="category-one-name">{{item.name}}</view>
|
<view class="category-one-name">{{item.name}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</scroll-view>
|
||||||
<view class="right">
|
<scroll-view class="right" scroll-y="true">
|
||||||
<view class="category-card" wx:for="{{categorySeconList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
|
<view class="category-card" wx:for="{{categorySeconList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
|
||||||
<view class="category-two-name" bindtap="goList" data-id="{{item.id}}">
|
<view class="category-two-name" bindtap="goList" data-id="{{item.id}}">
|
||||||
<view>{{item.name}}</view>
|
<view>{{item.name}}</view>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="category-thrid-box" wx:if="{{item.subList.length > 0}}">
|
<view class="category-thrid-box" wx:if="{{item.subList.length > 0}}">
|
||||||
<view class="category-thrid-item" wx:for="{{item.subList}}" wx:for-index="i" wx:for-item="it" wx:key="i" bindtap="goList" data-id="{{it.id}}">
|
<view class="category-thrid-item" wx:for="{{item.subList}}" wx:for-index="i" wx:for-item="it" wx:key="i" bindtap="goList" data-id="{{it.id}}">
|
||||||
<image src="../../images/avatar.png"></image>
|
<image src="{{it.icon==''? '/subpages/images/ic_goods_type_default.png':imgUrl+it.icon}}"></image>
|
||||||
<view>{{it.name}}</view>
|
<view>{{it.name}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -22,6 +22,6 @@
|
|||||||
<text>暂无数据</text>
|
<text>暂无数据</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<page-loading wx:else></page-loading>
|
<page-loading wx:else></page-loading>
|
@ -1,112 +1,122 @@
|
|||||||
/* pages/shop/shopcat.wxss */
|
/* pages/shop/shopcat.wxss */
|
||||||
page {
|
page {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-box {
|
.container-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-box .left {
|
.container-box .left {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 35%;
|
width: 35%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-item-default {
|
.category-item-default {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
padding: 10rpx 0rpx 5rpx 2rpx;
|
padding: 20rpx 0rpx 20rpx 2rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.category-item-active {
|
.category-item-active {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
padding: 10rpx 0rpx 5rpx 2rpx;
|
padding: 20rpx 0rpx 20rpx 2rpx;
|
||||||
background: white;
|
background: white;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-one-name {
|
.category-one-name {
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
padding: 10rpx 0rpx;
|
padding: 10rpx 0rpx;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
background: #e70101;
|
background: #e70101;
|
||||||
width: 10rpx;
|
width: 10rpx;
|
||||||
height: 100%;
|
height: 60rpx;
|
||||||
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-box .right {
|
.container-box .right {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 65%;
|
width: 65%;
|
||||||
|
position: absolute;
|
||||||
|
left: 35%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-card {
|
.category-card {
|
||||||
margin: 10rpx 10rpx 10rpx 0rpx;
|
margin: 10rpx 10rpx 10rpx 0rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
min-height: 300rpx;
|
min-height: 300rpx;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
box-shadow: 5rpx 5rpx 5rpx 5rpx rgba(0, 0, 0, 0, 1);
|
box-shadow: 5rpx 5rpx 5rpx 5rpx rgba(0, 0, 0, 0, 1);
|
||||||
padding: 10rpx;
|
padding: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-two-name {
|
.category-two-name {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 10rpx;
|
padding: 20rpx 5rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-thrid-box {
|
.category-thrid-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-thrid-item {
|
.category-thrid-item {
|
||||||
width: 33%;
|
width: 30%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
|
margin: 10rpx 0rpx;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-thrid-item image {
|
.category-thrid-item image {
|
||||||
width: 96rpx;
|
width: 82rpx;
|
||||||
height: 96rpx;
|
height: 82rpx;
|
||||||
|
margin-bottom: 15rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-empty {
|
.category-empty {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-empty image {
|
.category-empty image {
|
||||||
width: 96rpx;
|
width: 96rpx;
|
||||||
height: 66rpx;
|
height: 66rpx;
|
||||||
}
|
}
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||||
"libVersion": "2.30.0"
|
"libVersion": "2.30.0",
|
||||||
|
"setting": {
|
||||||
|
"urlCheck": false
|
||||||
|
}
|
||||||
}
|
}
|
35
subpages/goodscar/goodscar.js
Normal file
35
subpages/goodscar/goodscar.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// subpages/goodscar/goodscar.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
carList: [],
|
||||||
|
isHidePageloading: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
var _self = this;
|
||||||
|
try {
|
||||||
|
var value = wx.getStorageSync('carlist');
|
||||||
|
console.log(value)
|
||||||
|
if (value) {
|
||||||
|
_self.setData({
|
||||||
|
carList: value,
|
||||||
|
isHidePageloading: true
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
_self.setData({
|
||||||
|
isHidePageloading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
4
subpages/goodscar/goodscar.json
Normal file
4
subpages/goodscar/goodscar.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "购物车"
|
||||||
|
}
|
21
subpages/goodscar/goodscar.wxml
Normal file
21
subpages/goodscar/goodscar.wxml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<!--subpages/goodscar/goodscar.wxml-->
|
||||||
|
<scroll-view wx:if="{{isHidePageloading}}">
|
||||||
|
<view wx:if="{{carList.length>0}}">
|
||||||
|
<block wx:for="{{carList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
|
||||||
|
<view class="goods-item">
|
||||||
|
<image class="check" src="/subpages/images/ic_shop_car_icon.png" mode="aspectFill"></image>
|
||||||
|
<view class="goods">
|
||||||
|
<image class="goods-img"></image>
|
||||||
|
<view class="goods-content">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="category-empty" wx:else>
|
||||||
|
<image src="../../images/ic_empty_data.png" mode="scaleToFill"></image>
|
||||||
|
<text class="hint">暂无数据</text>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<page-loading wx:else></page-loading>
|
43
subpages/goodscar/goodscar.wxss
Normal file
43
subpages/goodscar/goodscar.wxss
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/* subpages/goodscar/goodscar.wxss */
|
||||||
|
|
||||||
|
.category-empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
align-self: center;
|
||||||
|
|
||||||
|
position: fixed;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%)translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.category-empty image {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.category-empty .hint {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-item {}
|
||||||
|
|
||||||
|
.check {
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
|
||||||
|
}
|
||||||
|
.goods .goods-img{}
|
||||||
|
.goods-content{
|
||||||
|
|
||||||
|
}
|
129
subpages/goodsdetail/goodsdetail.js
Normal file
129
subpages/goodsdetail/goodsdetail.js
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
// subpages/goodsdetail/goodsdetail.js
|
||||||
|
var app = getApp();
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
goodsId: "",
|
||||||
|
isHidePageloading: false,
|
||||||
|
detailBean: {},
|
||||||
|
currentStandard: {},
|
||||||
|
standardList: [],
|
||||||
|
curStandardIndex: 0,
|
||||||
|
imgUrl: app.shopImgUrl,
|
||||||
|
carList: [],
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
this.setData({
|
||||||
|
goodsId: options.id
|
||||||
|
})
|
||||||
|
this.getGoodsDetail();
|
||||||
|
|
||||||
|
},
|
||||||
|
//获取商品详情
|
||||||
|
getGoodsDetail() {
|
||||||
|
var _self = this
|
||||||
|
app.restAjax.get(app.restAjax.path('{shopUrl}/app/shopgoods/getrelease/{goodsId}',
|
||||||
|
[app.shopUrl, _self.data.goodsId]),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
function (code, data) {
|
||||||
|
if (data) {
|
||||||
|
if (data.goodsPhotos.length > 0) {
|
||||||
|
var photos = data.goodsPhotos.split(',');
|
||||||
|
data.photoList = photos;
|
||||||
|
} else {
|
||||||
|
data.photoList = []
|
||||||
|
}
|
||||||
|
data.goodsPrice = 0;
|
||||||
|
data.goodsStandarName = "";
|
||||||
|
data.goodsStandarId = "";
|
||||||
|
data.isCheck = false;
|
||||||
|
data.carAmount = 0;
|
||||||
|
_self.setData({
|
||||||
|
detailBean: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (code, data) {
|
||||||
|
app.dialog.msg(data.msg);
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
_self.getGoodsStandardList();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// carAmount;
|
||||||
|
// goodsPrice;
|
||||||
|
// goodsStandarId;
|
||||||
|
// goodsStandarName;
|
||||||
|
// isCheck;
|
||||||
|
//获取商品附加信息
|
||||||
|
getGoodsStandardList() {
|
||||||
|
var _self = this
|
||||||
|
_self.data.detailBean.goodsPrice = 0;
|
||||||
|
_self.data.detailBean.goodsStandarName = "";
|
||||||
|
_self.data.detailBean.goodsStandarId = "";
|
||||||
|
_self.data.detailBean.isCheck = false;
|
||||||
|
_self.data.detailBean.carAmount = 0;
|
||||||
|
|
||||||
|
app.restAjax.get(app.restAjax.path('{shopUrl}/app/shopgoodsitem/listrelease/{goodsId}',
|
||||||
|
[app.shopUrl, _self.data.goodsId]),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
function (code, data) {
|
||||||
|
if (data && data.length > 0) {
|
||||||
|
_self.data.detailBean.goodsPrice = data[0].goodsItemUnitPrice;
|
||||||
|
_self.data.detailBean.goodsStandarName = data[0].goodsItemName;
|
||||||
|
_self.data.detailBean.goodsStandarId = data[0].goodsItemId;
|
||||||
|
_self.setData({
|
||||||
|
standardList: data,
|
||||||
|
currentStandard: data[0],
|
||||||
|
isHidePageloading: true,
|
||||||
|
detailBean: _self.data.detailBean
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
_self.setData({
|
||||||
|
isHidePageloading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (code, data) {
|
||||||
|
app.dialog.msg(data.msg);
|
||||||
|
_self.setData({
|
||||||
|
isHidePageloading: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
_self.setData({
|
||||||
|
isHidePageloading: true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
doSelStandard(e) {
|
||||||
|
var item = e.currentTarget.dataset.item;
|
||||||
|
var index = e.currentTarget.dataset.index;
|
||||||
|
this.data.detailBean.goodsPrice = item.goodsItemUnitPrice;
|
||||||
|
this.data.detailBean.goodsStandarName = item.goodsItemName;
|
||||||
|
this.data.detailBean.goodsStandarId = item.goodsItemId;
|
||||||
|
this.setData({
|
||||||
|
currentStandard: item,
|
||||||
|
curStandardIndex: index,
|
||||||
|
detailBean: this.data.detailBean
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 添加购物车
|
||||||
|
addToCar() {
|
||||||
|
//判断购物车中是否存在该商品
|
||||||
|
var _self = this;
|
||||||
|
for (let i = 0; i < _self.data.carList.length; i++) {
|
||||||
|
var item = _self.data.carList[i];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
3
subpages/goodsdetail/goodsdetail.json
Normal file
3
subpages/goodsdetail/goodsdetail.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
83
subpages/goodsdetail/goodsdetail.wxml
Normal file
83
subpages/goodsdetail/goodsdetail.wxml
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<!--subpages/goodsdetail/goodsdetail.wxml-->
|
||||||
|
<scroll-view wx:if="{{isHidePageloading}}">
|
||||||
|
<view class="container-box">
|
||||||
|
<!-- 轮播图 -->
|
||||||
|
<swiper autoplay="true" class="banner" indicator-dots="true">
|
||||||
|
<block wx:for="{{detailBean.photoList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
|
||||||
|
<swiper-item class="banner">
|
||||||
|
<image src="{{imgUrl+detailBean.photoList[index]}}" mode="aspectFill"></image>
|
||||||
|
</swiper-item>
|
||||||
|
</block>
|
||||||
|
</swiper>
|
||||||
|
<!-- 名称 -->
|
||||||
|
<view class="name-box">
|
||||||
|
<view class="type-box">
|
||||||
|
<view class="type-item">库存:{{currentStandard.goodsItemTotal}}</view>
|
||||||
|
<view class="type-item"> 销量:{{detailBean.goodsSalesVolume}}</view>
|
||||||
|
<view class="type-item">评分:{{detailBean.userEvaluate}}</view>
|
||||||
|
<view class="type-item">{{detailBean.goodsNotFreight==1? '包邮':'不包邮'}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="goods-name">
|
||||||
|
{{detailBean.goodsName}}
|
||||||
|
</view>
|
||||||
|
<view class="shop-name">
|
||||||
|
{{detailBean.shopName}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 规格 -->
|
||||||
|
<view class="standard-box">
|
||||||
|
<view class="title-item">
|
||||||
|
<view class="line"></view>
|
||||||
|
<view class="title-name">规格</view>
|
||||||
|
</view>
|
||||||
|
<view class="standard-content">
|
||||||
|
<block wx:for="{{standardList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
|
||||||
|
<view class="{{index==curStandardIndex? 'standard-item-sel':'standard-item'}}" bindtap="doSelStandard" data-index="{{index}}" data-item="{{item}}">
|
||||||
|
<image src="{{imgUrl+item.goodsItemIcon}}" mode="aspectFill"></image>
|
||||||
|
<view class="name">{{item.goodsItemName}}</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 详情 -->
|
||||||
|
<view class="desc-box">
|
||||||
|
<view class="title-item">
|
||||||
|
<view class="line"></view>
|
||||||
|
<view class="title-name">详情</view>
|
||||||
|
</view>
|
||||||
|
<!-- 参数 -->
|
||||||
|
<view class="params-box">
|
||||||
|
<block wx:for="{{detailBean.shopGoodsParameterList}}" wx:for-item="it" wx:for-index="i" wx:key="i">
|
||||||
|
<view class="params-item">
|
||||||
|
<view class="params-title">{{it.parameterName}}</view>
|
||||||
|
<view class="params-content">{{it.shopGoodsParameterContent}}</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="desc-video" wx:if="{{detailBean.goodsVideo.length>0}}">
|
||||||
|
<video style="width: 100%;" src="{{imgUrl+detailBean.goodsVideo}}" controls></video>
|
||||||
|
</view>
|
||||||
|
<rich-text class="desc-txt" nodes="{{detailBean.goodsSummary}}"></rich-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<page-loading wx:else></page-loading>
|
||||||
|
|
||||||
|
<view class="bottom-box">
|
||||||
|
<view class="bottom-content">
|
||||||
|
<view class="bottom-price">
|
||||||
|
<view class="price-icon">¥</view>
|
||||||
|
<view class="price-content">{{currentStandard.goodsItemUnitPrice}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="icon-btn">
|
||||||
|
<view class="car-icon">
|
||||||
|
<view class="car">
|
||||||
|
<image src="/subpages/images/ic_shop_car_icon.png" mode="aspectFill"></image>
|
||||||
|
<view class="car-num ">{{carList.length}}</view>
|
||||||
|
</view>
|
||||||
|
<view>购物车</view>
|
||||||
|
</view>
|
||||||
|
<view class="car-add">添加购物车</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
296
subpages/goodsdetail/goodsdetail.wxss
Normal file
296
subpages/goodsdetail/goodsdetail.wxss
Normal file
@ -0,0 +1,296 @@
|
|||||||
|
/* subpages/goodsdetail/goodsdetail.wxss */
|
||||||
|
page {
|
||||||
|
background: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-box {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-bottom: 150rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner {
|
||||||
|
height: 500rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner image {
|
||||||
|
width: 100%;
|
||||||
|
height: 500rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.goods-type {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-box {
|
||||||
|
padding: 30rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-shadow: 10rpx 5rpx 10rpx #dfdfdf;
|
||||||
|
background: white;
|
||||||
|
margin: 20rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-item {
|
||||||
|
background: #f2f2f2;
|
||||||
|
color: #e70606;
|
||||||
|
padding: 10rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-item:nth-of-type(n+2) {
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: black;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-name {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-box {
|
||||||
|
padding: 30rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-shadow: 10rpx 5rpx 10rpx #dfdfdf;
|
||||||
|
background: white;
|
||||||
|
margin: 20rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
height: 30rpx;
|
||||||
|
width: 10rpx;
|
||||||
|
background: #e70606;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-name {
|
||||||
|
margin-left: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
border: 1rpx solid #dfdfdf;
|
||||||
|
border-radius: 3rpx;
|
||||||
|
margin: 10rpx;
|
||||||
|
text-align: center;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0rpx 0rpx 0rpx 5rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
text-align: center;
|
||||||
|
margin: 0rpx 20rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-item image {
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-item-sel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
border: 1rpx solid #e70606;
|
||||||
|
border-radius: 3rpx;
|
||||||
|
margin: 10rpx;
|
||||||
|
text-align: center;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0rpx 0rpx 0rpx 5rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-item-sel image {
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin: 20rpx;
|
||||||
|
box-shadow: 10rpx 5rpx 10rpx #dfdfdf;
|
||||||
|
background: white;
|
||||||
|
padding: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc-video {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc-img {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc-txt {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: white;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin: 25rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-price {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: baseline;
|
||||||
|
color: #e70606;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.price-icon {
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.price-content {
|
||||||
|
font-size: 55rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.icon-btn {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-icon {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-icon image {
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
align-items: center;
|
||||||
|
align-self: center;
|
||||||
|
margin-left: 25rpx;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-num {
|
||||||
|
position: relative;
|
||||||
|
right: 10rpx;
|
||||||
|
top: -10rpx;
|
||||||
|
background: #e70606;
|
||||||
|
color: white;
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 25rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-add {
|
||||||
|
background: linear-gradient(to right bottom, rgb(245, 74, 74), rgb(221, 5, 5) 70px);
|
||||||
|
color: white;
|
||||||
|
padding: 15rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-item:first-child {
|
||||||
|
border: 1rpx solid #6e6e6e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-item:nth-of-type(n+2) {
|
||||||
|
border-bottom: 1rpx solid #6e6e6e;
|
||||||
|
border-left: 1rpx solid #6e6e6e;
|
||||||
|
border-right: 1rpx solid #6e6e6e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-title {
|
||||||
|
width: 40%;
|
||||||
|
border-right: 1rpx solid #6e6e6e;
|
||||||
|
padding: 5rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-content {
|
||||||
|
width: 60%;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
padding: 5rpx;
|
||||||
|
}
|
@ -24,6 +24,14 @@ Page({
|
|||||||
})
|
})
|
||||||
this.getGoodsList();
|
this.getGoodsList();
|
||||||
},
|
},
|
||||||
|
inputKeywords(event) {
|
||||||
|
this.setData({
|
||||||
|
keywords: event.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
doSearch() {
|
||||||
|
wx.startPullDownRefresh()
|
||||||
|
},
|
||||||
getGoodsList() {
|
getGoodsList() {
|
||||||
var _self = this
|
var _self = this
|
||||||
var info = {
|
var info = {
|
||||||
@ -69,5 +77,10 @@ Page({
|
|||||||
page: _self.data.page += 1
|
page: _self.data.page += 1
|
||||||
})
|
})
|
||||||
_self.getGoodsList()
|
_self.getGoodsList()
|
||||||
|
},
|
||||||
|
goDetail(e) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/subpages/goodsdetail/goodsdetail?id=' + e.currentTarget.dataset.id,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -1,14 +1,14 @@
|
|||||||
<!--pages/goodslist/goodslist.wxml-->
|
<!--pages/goodslist/goodslist.wxml-->
|
||||||
<view wx:if="{{hidePageLoading}}">
|
<view wx:if="{{hidePageLoading}}">
|
||||||
<view class="search-box">
|
<view class="search-box">
|
||||||
<input placeholder="请输入要查询的关键字" />
|
<input placeholder="请输入要查询的关键字" bindinput="inputKeywords" type="text" bindconfirm="doSearch" />
|
||||||
<view class="btn">搜索</view>
|
<view class="btn" bindtap="doSearch">搜索</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="container-box">
|
<view class="container-box">
|
||||||
<view class="goods-item" wx:for="{{goodsList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
|
<view class="goods-item" wx:for="{{goodsList}}" wx:for-item="item" wx:for-index="index" wx:key="index" bindtap="goDetail" data-id="{{item.goodsId}}">
|
||||||
<image src="{{imgUrl+item.goodsIcon}}"></image>
|
<image src="{{item.goodsIcon=='' ? '/images/address.png' : imgUrl+item.goodsIcon}}"></image>
|
||||||
<view class="goods-content">
|
<view class="goods-content">
|
||||||
<view class="goods-name">{{item.goodsName}}</view>
|
<rich-text class="goods-name" nodes="{{item.goodsName}}"></rich-text>
|
||||||
<view class="goods-price">¥ {{item.goodsPrice}}</view>
|
<view class="goods-price">¥ {{item.goodsPrice}}</view>
|
||||||
<view class="goods-type">
|
<view class="goods-type">
|
||||||
<view class="type-item">销量:{{item.goodsSalesVolume}}</view>
|
<view class="type-item">销量:{{item.goodsSalesVolume}}</view>
|
||||||
|
BIN
subpages/images/ic_goods_type_default.png
Normal file
BIN
subpages/images/ic_goods_type_default.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
subpages/images/ic_shop_car_icon.png
Normal file
BIN
subpages/images/ic_shop_car_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 685 B |
Loading…
Reference in New Issue
Block a user