From 4901d6c43f72b3b1255a9f7b426c8bf692065263 Mon Sep 17 00:00:00 2001 From: itgaojian163 Date: Mon, 13 Feb 2023 17:59:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85,=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 207 +++---- pages/center/center.js | 628 +++++++++++----------- pages/center/center.wxml | 6 +- pages/shop/shopcategory.wxml | 10 +- pages/shop/shopcategory.wxss | 134 ++--- project.private.config.json | 5 +- subpages/goodscar/goodscar.js | 35 ++ subpages/goodscar/goodscar.json | 4 + subpages/goodscar/goodscar.wxml | 21 + subpages/goodscar/goodscar.wxss | 43 ++ subpages/goodsdetail/goodsdetail.js | 129 +++++ subpages/goodsdetail/goodsdetail.json | 3 + subpages/goodsdetail/goodsdetail.wxml | 83 +++ subpages/goodsdetail/goodsdetail.wxss | 296 ++++++++++ subpages/goodslist/goodslist.js | 13 + subpages/goodslist/goodslist.wxml | 10 +- subpages/images/ic_goods_type_default.png | Bin 0 -> 1049 bytes subpages/images/ic_shop_car_icon.png | Bin 0 -> 685 bytes 18 files changed, 1139 insertions(+), 488 deletions(-) create mode 100644 subpages/goodscar/goodscar.js create mode 100644 subpages/goodscar/goodscar.json create mode 100644 subpages/goodscar/goodscar.wxml create mode 100644 subpages/goodscar/goodscar.wxss create mode 100644 subpages/goodsdetail/goodsdetail.js create mode 100644 subpages/goodsdetail/goodsdetail.json create mode 100644 subpages/goodsdetail/goodsdetail.wxml create mode 100644 subpages/goodsdetail/goodsdetail.wxss create mode 100644 subpages/images/ic_goods_type_default.png create mode 100644 subpages/images/ic_shop_car_icon.png diff --git a/app.json b/app.json index 0fbed9d..15169b4 100644 --- a/app.json +++ b/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": [ - "goodslist" - ] - }], - "window": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#9F1512", - "navigationBarTitleText": "日喀则市数字文化云", - "navigationBarTextStyle": "white" - }, - "tabBar": { - "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" + "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", + "subpages/goodsdetail/goodsdetail", + "subpages/goodscar/goodscar" + ], + "subPackages": [ + { + "root": "subpages/goodslist", + "pages": [ + "goodslist" + ] + } + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#9F1512", + "navigationBarTitleText": "日喀则市数字文化云", + "navigationBarTextStyle": "white" + }, + "tabBar": { + "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" } \ No newline at end of file diff --git a/pages/center/center.js b/pages/center/center.js index 8b8ed4a..3a818fd 100644 --- a/pages/center/center.js +++ b/pages/center/center.js @@ -2,332 +2,338 @@ var app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - randomName: true, - showPhone: true, - gotCode: false, - restTime: 120, - timer: '', - userAvatar: '', - token: '', - userInfo: {}, - usercenterUrl: app.usercenterUrl, - sourcePath: '/route/file/download/true/', - phone: '', - 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({ + /** + * 页面的初始数据 + */ + data: { + randomName: true, + showPhone: true, + gotCode: false, + restTime: 120, + timer: '', + userAvatar: '', + token: '', + userInfo: {}, + usercenterUrl: app.usercenterUrl, + sourcePath: '/route/file/download/true/', + phone: '', + code: '', isLoading: false - }) - } - }, - // 判断用户是否为随机名称 - isRandomName: function () { - var self = this - wx.getStorage({ - key: 'isRandomUsername', - success: function (res) { - if (res.data == 1) { - self.setData({ - randomName: true - }) + }, + // 选择头像来源 + 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() + }, + }) + }, + // 购物车 + 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 { - self.setData({ - randomName: false - }) + wx.showToast({ + title: '手机号不能为空', + icon: 'none', + duration: 1500 + }) } - } - }) - }, - // 获取用户信息 - 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(); - }, + }, + // 提交绑定手机 + 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 + }) + } + }, + // 判断用户是否为随机名称 + 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 () { - } + } }) \ No newline at end of file diff --git a/pages/center/center.wxml b/pages/center/center.wxml index 6f9900d..ed6b883 100644 --- a/pages/center/center.wxml +++ b/pages/center/center.wxml @@ -41,10 +41,10 @@ 我的志愿活动 - + 购物车 + + + + + + + + + + + + + + + + + + 暂无数据 + + + \ No newline at end of file diff --git a/subpages/goodscar/goodscar.wxss b/subpages/goodscar/goodscar.wxss new file mode 100644 index 0000000..ecad7d5 --- /dev/null +++ b/subpages/goodscar/goodscar.wxss @@ -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{ + +} \ No newline at end of file diff --git a/subpages/goodsdetail/goodsdetail.js b/subpages/goodsdetail/goodsdetail.js new file mode 100644 index 0000000..311ce03 --- /dev/null +++ b/subpages/goodsdetail/goodsdetail.js @@ -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]; + + } + } +}) \ No newline at end of file diff --git a/subpages/goodsdetail/goodsdetail.json b/subpages/goodsdetail/goodsdetail.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/subpages/goodsdetail/goodsdetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/subpages/goodsdetail/goodsdetail.wxml b/subpages/goodsdetail/goodsdetail.wxml new file mode 100644 index 0000000..6cb7388 --- /dev/null +++ b/subpages/goodsdetail/goodsdetail.wxml @@ -0,0 +1,83 @@ + + + + + + + + + 库存:{{currentStandard.goodsItemTotal}} + 销量:{{detailBean.goodsSalesVolume}} + 评分:{{detailBean.userEvaluate}} + {{detailBean.goodsNotFreight==1? '包邮':'不包邮'}} + + + {{detailBean.goodsName}} + + + {{detailBean.shopName}} + + + + + + + 规格 + + + + + + {{item.goodsItemName}} + + + + + + + + + 详情 + + + + + + {{it.parameterName}} + {{it.shopGoodsParameterContent}} + + + + + + + + + + + + + + + + ¥ + {{currentStandard.goodsItemUnitPrice}} + + + + + + {{carList.length}} + + 购物车 + + 添加购物车 + + + \ No newline at end of file diff --git a/subpages/goodsdetail/goodsdetail.wxss b/subpages/goodsdetail/goodsdetail.wxss new file mode 100644 index 0000000..7771aa2 --- /dev/null +++ b/subpages/goodsdetail/goodsdetail.wxss @@ -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; +} \ No newline at end of file diff --git a/subpages/goodslist/goodslist.js b/subpages/goodslist/goodslist.js index ee5b782..baf6627 100644 --- a/subpages/goodslist/goodslist.js +++ b/subpages/goodslist/goodslist.js @@ -24,6 +24,14 @@ Page({ }) this.getGoodsList(); }, + inputKeywords(event) { + this.setData({ + keywords: event.detail.value + }) + }, + doSearch() { + wx.startPullDownRefresh() + }, getGoodsList() { var _self = this var info = { @@ -69,5 +77,10 @@ Page({ page: _self.data.page += 1 }) _self.getGoodsList() + }, + goDetail(e) { + wx.navigateTo({ + url: '/subpages/goodsdetail/goodsdetail?id=' + e.currentTarget.dataset.id, + }) } }) \ No newline at end of file diff --git a/subpages/goodslist/goodslist.wxml b/subpages/goodslist/goodslist.wxml index c681407..0a2c56f 100644 --- a/subpages/goodslist/goodslist.wxml +++ b/subpages/goodslist/goodslist.wxml @@ -1,14 +1,14 @@ - - 搜索 + + 搜索 - - + + - {{item.goodsName}} + ¥ {{item.goodsPrice}} 销量:{{item.goodsSalesVolume}} diff --git a/subpages/images/ic_goods_type_default.png b/subpages/images/ic_goods_type_default.png new file mode 100644 index 0000000000000000000000000000000000000000..306f9e9de3b4d5be02e4c6390a2e46ea2437ac29 GIT binary patch literal 1049 zcmV+!1m^pRP)Px&(@8`@R9HvtmtSZcRTRd*b9eVnv?5X}XvxlQHOb7TPoiKE3$=(^M5u^;(b|U; z5%EP@3Zl?dEGSBgFIKS?QSm`TMG>qh`XY!A#$ubytm&W3-HKr8lc8pBk~uQFJCoVX z?#_)w`r>_B?tbSxzx(Ihdxvn18+GQtSjJ6%FUf5XydnNC&mtI6^>0jBXKXpT2z~~j z9Z`$`eHSuLR%-RHJ3SJB>PBn`^VVSkKiw-40f!u=$NPbJwj3wmc>p)A&@r8GYxTY9 z{sh3YL6x>oXo86KayO7Ds_4FKPk2LQZgki01gX@`5Mek!duOdf|M z5G?@fGO)bnSs(;_;3&N()&{TQdExB;v597$D@OM|~!8oRB%d>2@f7;Tp5S!Knz_aBH0m+P* z4kpJmv?c&m+j@ully46p-&ML2SHWKZZZIVW@VTq>&SVc1tp|y?ttzs-2zbF!`qc)2 zS1i0iMEkOWmTQ-va@4|yX}w>xj)Qp2&|@+u^*zJqP;UTCm#)86@Zt=Bbp{4MyGq~H zP3PP4698QgsbzRf31HW-($i7j@<}+D-$p{50B~C`2xfeiBe8!(&0pxH$$*&50lVYm zZ2+;MUmDnsFuV^$H^+Sp4)VmOhJ%G)3}z@gS)U}rbIiEAr9VT!$3p6((X^*MR@{ar z2~0I!d7vC=E3@;ny<+}T029!j05e0dVuQ|UGcjg>&J96kd9(p|Me6|~j_&K|A(1{8 zt^hQFkl%7I>0kQ+R7-`uA=3c@Zg0FrT8)4j6W(3As*i5IjJZ^Q^QUiH$Iy7i^l!wp z&#BdqbgHICA@g(Aw+!Ce-+}*R;+>UXF}gjQW$4+~BLw~;D|u2CLTu{XSgSeA2=E-G zM^gauO9CD?1pwi&8|ar}eKh*qoNOzvOfM4K-C+KEVn9@Fxs(}@5)g3OQTmR!%lj91 zK|F{xxeYzLu!lhJuVxS+yypgb?0?nP( z0Z=W;lgxP36oP^AiqeOYvIMAV%g{8w2@q~|)Z!1V2T9`uT=Ch|%P^$;#?jzv+e6kb z$ydO5(GVh;!Q?3Ri}H04_GcO}KkL>Oj&;-dMfnv74`p~<5P}~YnO!)Y97J)zbh)ra zgklWf=q^~FGKxk!0TOS!!TiO334B{dpIuJ?xEH{6DeZZHj=QSPx%XGugsR9HvF*1u~LVHgMS?{n!OIJ9?{x3~yV5Njv>2eh55n^mC>eH(Cah=W@} zP_dhX(n%}5s31DHsL-)-6diOBK`I785Z~N;NmaCJ-bcWG%Q8e+csS5fDAd1ORhDs`~R-z@p=fQVuWE2hiH5 zL4UBcg0=Vw6bjq$W%X}K9RY=|Bb@Y66>iO>MT zCpE(N#+c4`gt}!YXojyA1*S>CK<-EI`5Wq|8;v09Ps9Q`mm*iB3dYl!#NS^XpD(+U1}lDz@>p)n9m0+<9yYz?vrz}5nLSNEJi*ka>k zTmT?oXiED2)84ItTdupWX>nLL995SH;0fn3fP)*MRjKr@Bmhsi6@U-L)g=UU8WHez zTIt=%0G(Y`R9!NF>yEI+3j_$m*2!Y6_AC*=bw^