作者 王旭宇

yyh

要显示太多修改。

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

//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
//自动更新版本
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
// 登录
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
wx.showModal({
title: '更新提示',
content: '新版本下载失败',
showCancel: false
})
})
},
changeToken() {
let url = '/api/user/codeToToken',
t = this;
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
success: function (res) {
t.post(url, {
code: res.code
}).then((r) => {
wx.setStorageSync('token', r.userInfo.token)
})
}
})
// 获取用户信息
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)
upload(filetype, file) {
var promise = new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
wx.showLoading({
title: '上传中',
})
let url = 'https://anleguo.w.brotop.cn/portal/common/upload';
let head = {
'XX-Token': wx.getStorageSync('token'),
'XX-Device-Type': ''
}
let typename = {
filetype: filetype
}
wx.uploadFile({
url: url, //仅为示例,非真实的接口地址
filePath: file,
name: 'file',
header: {},
formData: typename,
success: function (res) {
console.log('上传文件后', res)
let temdata = JSON.parse(res.data);
let urlobj = {
url: temdata.data.preview_url
//url: temdata.data.filepath
}
resolve(urlobj);
wx.hideNavigationBarLoading();
wx.hideLoading();
},
fail: function (res) {
reject('网络出错');
wx.hideNavigationBarLoading()
wx.hideLoading()
},
complete: () => {
wx.hideNavigationBarLoading()
wx.hideLoading()
},
})
});
return promise;
},
post: function (url, data, headerParams, showLoad) {
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data;
let baseUrl = 'http://www.himrhi.com/api';
//网络请求
let header = {
'Content-Type': 'application/x-www-form-urlencoded',
'XX-Device-Type': 'wxapp',
'XX-Token': wx.getStorageSync("token") || ""
}
header = Object.assign(header, headerParams)
//网络请求
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: header,
success: function (res) { //返回取得的数据
if (res.statusCode == '200') {
resolve(res.data);
} else if (res.statusCode == '201') {
resolve(res.data);
} else {
reject(res)
// wx.showModal({
// title: '提示',
// content: res.data.msg,
// showCancel: false
// })
}
// setTimeout(function () {
// wx.hideNavigationBarLoading()
// }, 600)
},
fail: function (e) {
reject('网络出错');
// wx.hideLoading()
wx.hideNavigationBarLoading()
},
complete: function () {
wx.hideNavigationBarLoading()
// wx.hideLoading()
},
})
});
return promise;
},
timeFormate(timestamp, timeType) {
if (timestamp) {
var timeStamp = timestamp.length == 13 ? timestamp : timestamp * 1000
var date = new Date(timeStamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() + ' ';
var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours())+":";
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
var s = date.getSeconds();
if (timeType == 'YYMMDD') {
return Y + M + D;
} else if (timeType == 'YYMMDDHHMM') {
return Y + M + D + " " + h + m;
} else {
return h + m;
}
}
},
globalData: {
userInfo: null
user_id: null,
baseUrl: 'http://www.himrhi.com/api',
imgUrl: 'http://qiniu.himrhi.com/',
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/start/start",
"pages/index/index",
"pages/my/orderDetail/orderDetail",
"pages/my/big/big",
... ... @@ -7,7 +8,9 @@
"pages/my/serach/serach",
"pages/my/selectAddress/selectAddress",
"pages/my/editAddress2/editAddress2",
"pages/my/edit_address/edit_address",
"pages/my/editAddress/editAddress",
"pages/my/myOrder/myOrder",
"pages/index/production_steps/production_steps",
"pages/my/myCollection/myCollection",
"pages/index/goodsDetial2/goodsDetial2",
... ... @@ -19,7 +22,6 @@
"pages/my/invoice/invoice",
"pages/my/commonProblems/commonProblems",
"pages/my/myAddress/myAddress",
"pages/my/invitationPolite/invitationPolite",
"pages/my/comment/comment",
"pages/my/coupons/coupons",
... ... @@ -28,7 +30,44 @@
"pages/my/balance _center/balance _center",
"pages/my/my",
"pages/cart/cart",
"pages/index/selectAddress/selectAddress"
"pages/index/selectAddress/selectAddress",
"pages/my/newAddress/newAddress",
"pages/my/modifyPhone/modifyPhone",
"pages/my/personal_center/personal_center",
"pages/my/showComment/showComment",
"pages/index/replaceDishes/replaceDishes",
"pages/cart/mask/mask",
"pages/my/question_two/question_two",
"pages/my/cancelOrder/cancelOrder",
"pages/my/deliveryTime/deliveryTime",
"pages/my/settle_account/settle_account",
"pages/my/notice_detail/notice_detail",
"pages/index/select_index/select_index",
"pages/my/agreement/agreement/agreement",
"pages/vip/vip_index/vip_index",
"pages/my/suggestion/suggestion",
"pages/index/special_list/special_list",
"pages/my/myCollections/myCollections",
"pages/my/unpayOrderDetail/unpayOrderDetail",
"pages/index/user_comment/user_comment",
"pages/index/safty/safty",
"pages/index/search_result/search_result",
"pages/index/searchResultByScreen/searchResultByScreen",
"pages/my/Aftermarket/Aftermarket",
"pages/my/afterMarketList/afterMarketList",
"pages/my/aftermarketDetail/aftermarketDetail",
"pages/my/unship/unship",
"pages/my/uncomment/uncomment",
"pages/index/search_select_result/search_select_result",
"pages/my/wait_receite/wait_receite",
"pages/index/pay_ensure/pay_ensure",
"pages/index/select_source/select_source",
"pages/index/safetyDetail/safetyDetail",
"pages/index/foodPackageDetial/foodPackageDetial",
"pages/my/invoiceList/invoiceList",
"pages/vip/detail_vip/detail_vip",
"pages/index/goodsDetials/goodsDetials",
"pages/navigate/navigate"
],
"window": {
"backgroundTextStyle": "dark",
... ...
/**app.wxss**/
@font-face {
/* @font-face {
font-family: 'pingfang';
src: url('pages/src/fonts/PingFangLight.ttf');
font-family: 'pingfanglight';
src: url('pages/src/fonts/PingFangLight.ttf');
}
} */
@font-face {
font-family: 'iconfont'; /* project id 636259 */
src: url('//at.alicdn.com/t/font_636259_poikis0x03j.eot');
src: url('//at.alicdn.com/t/font_636259_poikis0x03j.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_636259_poikis0x03j.woff2') format('woff2'),
url('//at.alicdn.com/t/font_636259_poikis0x03j.woff') format('woff'),
url('//at.alicdn.com/t/font_636259_poikis0x03j.ttf') format('truetype'),
url('//at.alicdn.com/t/font_636259_poikis0x03j.svg#iconfont') format('svg');
}
/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
... ... @@ -110,9 +119,6 @@ input, textarea {
background: none;
}
.rmb {
font-size: 22rpx;
color: #222;
... ... @@ -127,6 +133,8 @@ input, textarea {
padding: 29rpx 23rpx;
border-bottom: 1rpx solid #f2f2f2;
background-color: #fff;
/*另加的*/
margin-top:40rpx;
}
.nav_type_left {
... ... @@ -179,14 +187,18 @@ input, textarea {
}
.good_right {
height: 217rpx;
flex: 2;
margin-left: 20rpx;
padding-top:14rpx;
box-sizing: border-box;
}
.good_name {
color: #222;
font-size: 30rpx;
padding: 0 0 10rpx 0;
font-size: 32rpx;
line-height: 32rpx;
/* padding: 0 0 10rpx 0; */
}
.good_stand {
... ... @@ -195,10 +207,13 @@ input, textarea {
}
.rmb {
font-size: 22rpx;
font-size: 20rpx;
}
.good_pprice {
height: 20rpx;
line-height: 20rpx;
font-size: 26rpx;
color: #222;
font-weight: bold;
... ... @@ -208,6 +223,7 @@ input, textarea {
.good_oprice {
font-size: 22rpx;
color: #888;
text-decoration: line-through;
}
.good_vip {
... ... @@ -216,10 +232,16 @@ input, textarea {
font-weight: bold;
}
.red_rmb{
color: red;
font-weight: bold;
}
.good_vipbox {
display: flex;
align-items: center;
justify-content: space-between;
margin-top:-20rpx;
}
.good_vipbox_left {
... ... @@ -229,15 +251,7 @@ input, textarea {
}
.good_vip_spec {
font-size: 18rpx;
height: 25rpx;
background-color: #f44;
padding: 3rpx;
text-align: center;
color: #fff;
line-height: 100%;
margin-left: 5rpx;
/* background-image: url('../imgs/') */
}
.good_btn {
... ... @@ -254,6 +268,7 @@ input, textarea {
.icon-gouwuche {
font-size: 29rpx;
color: #444;
}
/* 头部信息 */
... ... @@ -302,135 +317,292 @@ input, textarea {
}
.iconfont {
font-family:"iconfont" !important;
font-size:16px;
font-style:normal;
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-vip:before { content: "\e62f"; }
.icon-vip:before {
content: "\e62f";
}
.icon-jia:before { content: "\e65b"; }
.icon-jia:before {
content: "\e65b";
}
.icon-jiantouarrow486:before { content: "\e6aa"; }
.icon-jiantouarrow486:before {
content: "\e6aa";
}
.icon-quan:before { content: "\e741"; }
.icon-quan:before {
content: "\e741";
}
.icon-gouwuche:before { content: "\e6be"; }
.icon-gouwuche:before {
content: "\e6be";
}
.icon-cuowu:before { content: "\e657"; }
.icon-cuowu:before {
content: "\e657";
}
.icon-icondayu:before { content: "\e632"; }
.icon-icondayu:before {
content: "\e632";
}
.icon-huangguan:before { content: "\e640"; }
.icon-huangguan:before {
content: "\e640";
}
.icon-3:before { content: "\e62c"; }
.icon-3:before {
content: "\e62c";
}
.icon-one-off:before { content: "\e62d"; }
.icon-one-off:before {
content: "\e62d";
}
.icon-two-off:before { content: "\e62e"; }
.icon-two-off:before {
content: "\e62e";
}
.icon-shangyinhao:before { content: "\e63f"; }
.icon-shangyinhao:before {
content: "\e63f";
}
.icon-xiaoyu:before { content: "\e74c"; }
.icon-xiaoyu:before {
content: "\e74c";
}
.icon-diandian:before { content: "\e631"; }
.icon-diandian:before {
content: "\e631";
}
.icon-location:before { content: "\e601"; }
.icon-location:before {
content: "\e601";
}
.icon-search:before { content: "\e602"; }
.icon-search:before {
content: "\e602";
}
.icon-message:before { content: "\e603"; }
.icon-message:before {
content: "\e603";
}
.icon-fenlei:before { content: "\e604"; }
.icon-fenlei:before {
content: "\e604";
}
.icon-jiance:before { content: "\e605"; }
.icon-jiance:before {
content: "\e605";
}
.icon-xingzhuang:before { content: "\e606"; }
.icon-xingzhuang:before {
content: "\e606";
}
.icon-xingzhuang1:before { content: "\e607"; }
.icon-xingzhuang1:before {
content: "\e607";
}
.icon-datu:before { content: "\e608"; }
.icon-datu:before {
content: "\e608";
}
.icon-wangge:before { content: "\e609"; }
.icon-wangge:before {
content: "\e609";
}
.icon-liebiao:before { content: "\e60a"; }
.icon-liebiao:before {
content: "\e60a";
}
.icon-shaixuan:before { content: "\e60b"; }
.icon-shaixuan:before {
content: "\e60b";
}
.icon-chakanguize:before { content: "\e600"; }
.icon-chakanguize:before {
content: "\e600";
}
.icon-tianxie:before { content: "\e60c"; }
.icon-tianxie:before {
content: "\e60c";
}
.icon-xingzhuang2:before { content: "\e60d"; }
.icon-xingzhuang2:before {
content: "\e60d";
}
.icon-fanhui:before { content: "\e60e"; }
.icon-fanhui:before {
content: "\e60e";
}
.icon-dingwei:before { content: "\e60f"; }
.icon-dingwei:before {
content: "\e60f";
}
.icon-lishisousuo:before { content: "\e610"; }
.icon-lishisousuo:before {
content: "\e610";
}
.icon-remensousuo:before { content: "\e611"; }
.icon-remensousuo:before {
content: "\e611";
}
.icon-quxiao:before {
content: "\e612";
}
.icon-shanchu:before {
content: "\e613";
}
.icon-zhankai:before {
content: "\e614";
}
.icon-meipingfen:before {
content: "\e615";
}
.icon-maishoutuijian:before {
content: "\e616";
}
.icon-shoucang:before {
content: "\e617";
}
.icon-jinru:before {
content: "\e618";
}
.icon-pingfen:before {
content: "\e619";
}
.icon-genghuan:before {
content: "\e630";
}
.icon-location1:before {
content: "\e61a";
}
.icon-quxiao:before { content: "\e612"; }
.icon-weixuanzhong:before {
content: "\e61b";
}
.icon-shanchu:before { content: "\e613"; }
.icon-time:before {
content: "\e61c";
}
.icon-zhankai:before { content: "\e614"; }
.icon-xuanzhong:before {
content: "\e61d";
}
.icon-meipingfen:before { content: "\e615"; }
.icon-fenxiangyouli:before {
content: "\e61e";
}
.icon-maishoutuijian:before { content: "\e616"; }
.icon-wodeshoucang:before {
content: "\e61f";
}
.icon-shoucang:before { content: "\e617"; }
.icon-location2:before {
content: "\e620";
}
.icon-jinru:before { content: "\e618"; }
.icon-yonghuzhinan:before {
content: "\e621";
}
.icon-pingfen:before { content: "\e619"; }
.icon-yijianfankui:before {
content: "\e622";
}
.icon-genghuan:before { content: "\e630"; }
.icon-qiandao:before {
content: "\e623";
}
.icon-location1:before { content: "\e61a"; }
.icon-zhangdanmingxi:before {
content: "\e624";
}
.icon-weixuanzhong:before { content: "\e61b"; }
.icon-chuxuyouli:before {
content: "\e625";
}
.icon-time:before { content: "\e61c"; }
.icon-saoma:before {
content: "\e626";
}
.icon-xuanzhong:before { content: "\e61d"; }
.icon-pingjia:before {
content: "\e627";
}
.icon-fenxiangyouli:before { content: "\e61e"; }
.icon-cai:before {
content: "\e628";
}
.icon-wodeshoucang:before { content: "\e61f"; }
.icon-zan:before {
content: "\e629";
}
.icon-location2:before { content: "\e620"; }
.icon-kefu:before {
content: "\e62a";
}
.icon-yonghuzhinan:before { content: "\e621"; }
.icon-quxiao1:before {
content: "\e62b";
}
.icon-yijianfankui:before { content: "\e622"; }
.icon-dangqian:before {
content: "\e64a";
}
.icon-qiandao:before { content: "\e623"; }
.icon-meipingfen-copy:before {
content: "\e6bf";
}
.icon-zhangdanmingxi:before { content: "\e624"; }
.icon-collection:before{
content: "\e607"
}
.icon-chuxuyouli:before { content: "\e625"; }
.icon-position:before{
content: "\e634"
}
.icon-saoma:before { content: "\e626"; }
.icon-suggest:before{
content: "\e635"
}
.icon-pingjia:before { content: "\e627"; }
.icon-xiangxia:before{
content: "\e636"
}
.icon-cai:before { content: "\e628"; }
.icon-xiangshang:before{
content: "\e637"
}
.icon-zan:before { content: "\e629"; }
.icon-duigou:before{
content: "\e638"
}
.icon-kefu:before { content: "\e62a"; }
.icon-fanhuidingbu:before{
content: "\e639"
}
.icon-quxiao1:before { content: "\e62b"; }
.icon-weixin:before{
content: "\e63b"
}
.icon-dangqian:before { content: "\e64a"; }
.icon-meipingfen-copy:before { content: "\e6bf"; }
... ...
// pages/cart/cart.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
choose: false,
choose2: true,
chooseAll2: false,
number: 1,
goodsList: [],
goodsId: 0,
totalPrice: 0,
promotion: [],
goods_Price: 0,
shipment: {},
shipPrice: 0,
ship_balance: 0,
is_vip: 0,
cartId: 1,
listlist: [],
all_both_choose: false,
chuandi: 0,
},
//跳转至详情页
goDetail(e) {
wx.navigateTo({
url: '../index/goodsDetial/goodsDetial?id=' + e.currentTarget.dataset.id,
})
},
goDetail2(e) {
wx.navigateTo({
url: '../index/goodsDetial2/goodsDetial2?id=' + e.currentTarget.dataset.id,
})
},
//获取购物车数量
fetchCartNum() {
let url = '/wxapp/cart/index'
app.post(url).then(r => {
if (r.code == 1) {
if (r.data.cartNum > 0) {
wx.showTabBarRedDot({
index: 1,
success: function(red) {
wx.setTabBarBadge({
index: 1,
text: r.data.cartNum.toString(),
})
}
})
} else {
wx.hideTabBarRedDot({
index: 1
})
}
}
})
},
//最下面的全选
allBothChoose() {
let that = this
let goodsList = that.data.goodsList
let promotion = that.data.promotion
let all_both_choose = that.data.all_both_choose
if (all_both_choose) {
all_both_choose = false
} else {
all_both_choose = true
}
goodsList.forEach(function(ele, index) {
if (all_both_choose) {
ele.chooseAll = true
for (let i = 0; i < ele.list.length; i++) {
ele.list[i].flag = true
}
that.setData({
goodsList: goodsList
})
} else {
ele.chooseAll = false
for (let i = 0; i < ele.list.length; i++) {
ele.list[i].flag = false
}
that.setData({
goodsList: goodsList
})
}
})
promotion.forEach(function (ele, index) {
if (all_both_choose) {
ele.chooseAll = true
for (let i = 0; i < ele.list.length; i++) {
ele.list[i].flag = true
}
that.setData({
promotion: promotion
})
} else {
ele.chooseAll = false
for (let i = 0; i < ele.list.length; i++) {
ele.list[i].flag = false
}
that.setData({
promotion: promotion
})
}
})
that.setData({
all_both_choose: all_both_choose
})
this.totalPrice();
},
//fetchUser
fetchUser() {
let url = '/wxapp/user/index'
app.post(url).then(r => {
if (r.code == 1) {
console.log(r)
this.setData({
is_vip: r.data.user.is_vip
})
this.fetchCartList();
this.amount();
}
})
},
//fetchCartList
fetchCartList() {
let that = this;
let url = '/wxapp/cart/index'
var list = {};
var number = 1;
var g_price = 0;
var vip = that.data.is_vip
app.post(url).then(r => {
r.data.list.forEach(function(ele, index) {
ele.chooseAll = false
for (let v in ele.list) {
ele.list[v].flag = false
if (vip == 1) {
var price = ele.list[v].vip_price
price = price.substring(0, price.length - 3) * 1
ele.list[v].goods_price = ele.list[v].number * price
} else {
var price = ele.list[v].price
price = price.substring(0, price.length - 3) * 1
ele.list[v].goods_price = ele.list[v].number * price
}
}
})
r.data.promotion.forEach(function(ele, index) {
ele.chooseAll=false
for (let v in ele.list) {
ele.list[v].t = false
if (vip == 1) {
var price = ele.list[v].vip_price
price = price.substring(0, price.length - 3) * 1
ele.list[v].goods_price = ele.list[v].number * price
} else {
var price = ele.list[v].price
price = price.substring(0, price.length - 3) * 1
ele.list[v].goods_price = ele.list[v].number * price
}
}
})
that.setData({
listlist: r.data,
goodsList: r.data.list,
promotion: r.data.promotion,
number: number,
shipment: r.data.shipment,
shipPrice: r.data.shipment.price
});
});
},
//每个商品总价
amount() {
var that = this
var goodsList = that.data.goodsList
var promotion = that.data.promotion
var vip = that.data.is_vip * 1
goodsList.forEach(function(ele, index) {
for (let v in ele.list) {
console.log("进来了goodsList")
if (vip == 1) {
var price = ele.list[v].vip_price
price = price.substring(0, price.length - 3) * 1
ele.list[v].goods_price = ele.list[v].number * price
} else {
var price = ele.list[v].price
price = price.substring(0, price.length - 3) * 1
ele.list[v].goods_price = ele.list[v].number * price
}
}
})
promotion.forEach(function(ele, index) {
for (let v in ele.list) {
if (vip == 1) {
var price = ele.list[v].vip_price
price = price.substring(0, price.length - 3) * 1
ele.list[v].goods_price = ele.list[v].number * price
} else {
var price = ele.list[v].price
price = price.substring(0, price.length - 3) * 1
ele.list[v].goods_price = ele.list[v].number * price
}
}
})
},
//totalPrice
totalPrice() {
var that = this;
var goodsList = that.data.goodsList;
var promotion = that.data.promotion;
var price = 0;
var price2 = 0;
var price3 = 0;
var shipPrice = 0;
var str_price = 0;
goodsList.forEach(function(ele, index) {
for (var i in ele.list) {
if (ele.list[i].flag) {
if (that.data.is_vip == 1) {
str_price = ele.list[i].vip_price;
} else {
str_price = ele.list[i].price;
}
str_price = str_price.substring(0, str_price.length - 3);
str_price = str_price * 1 * ele.list[i].number
price = price + str_price;
}
}
});
promotion.forEach(function(ele, index) {
for (var i in ele.list) {
if (ele.list[i].flag) {
if (that.data.is_vip == 1) {
str_price = ele.list[i].vip_price;
} else {
str_price = ele.list[i].price;
}
str_price = str_price.substring(0, str_price.length - 3);
str_price = str_price * 1 * ele.list[i].number
price2 = price2 + str_price;
}
}
});
price3 = price + price2;
if (price3 > that.data.shipment.free) {
shipPrice = 0
} else {
shipPrice = this.data.shipment.price
}
var ship_balance = that.data.shipment.free * 1 - price3
if (ship_balance <= 0) {
ship_balance = 0
}
let price4 = price3
let price5 = price3 * 1 + shipPrice * 1
that.setData({
totalPrice: price5,
chuandi: price5,
shipPrice: shipPrice,
ship_balance: ship_balance
});
},
//del_btn删除购物车
del_btn() {
let that = this
let url = '/wxapp/cart/delCart '
let goodsList = that.data.goodsList;
let promotion = that.data.promotion;
let ids = [];
let new_ids = []
goodsList.forEach(function(ele, index) {
for (let i = 0; i < ele.list.length; i++) {
if (ele.list[i].flag) {
let id = ele.list[i].id
new_ids = ids.push(id)
}
}
})
promotion.forEach(function(ele, index) {
for (let i = 0; i < ele.list.length; i++) {
if (ele.list[i].flag) {
let id = ele.list[i].id
new_ids = ids.push(id)
}
}
})
let params = {
ids: ids
}
app.post(url, params).then(r => {
if (r.code == 1) {
wx.showToast({
title: '删除成功',
icon: 'none'
})
this.totalPrice();
let a=this.data.shipment.free
this.setData({
ship_balance:a,
all_both_choose:false,
totalPrice:0
})
} else {
wx.showToast({
title: '请先选择要删除的商品',
icon: 'none'
})
}
});
this.fetchCartList();
this.choose();
this.choose2();
this.totalPrice();
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
this.fetchUser();
},
// 再逛逛
get_return(){
get_return() {
wx.switchTab({
url: '../../pages/index/index'
});
},
//购物车结算
settleAccountGoods() {
var id_arr = [];
var id_arr2 = [];
var id_arr1 = [];
var goodsList = this.data.goodsList;
var promotion = this.data.promotion;
var listlist = this.data.listlist
goodsList.forEach(function(ele, index) {
for (var i in ele.list) {
if (ele.list[i].flag) {
id_arr1.push(ele.list[i].id);
}
}
});
promotion.forEach(function(ele, index) {
for (var i in ele.list) {
if (ele.list[i].flag) {
id_arr2.push(ele.list[i].id);
}
}
});
if (id_arr1.length == 0 && id_arr2.length != 0) {
id_arr = id_arr2
}
if (id_arr2.length == 0 && id_arr1.length != 0) {
id_arr = id_arr1
}
if (id_arr1.length != 0 && id_arr2.length != 0) {
id_arr = id_arr1.concat(id_arr2);
}
if (id_arr1.length == 0 && id_arr2.length == 0) {
wx.showToast({
title: '请选择商品',
icon: 'none'
})
return;
}
if (id_arr2.length != 0 && id_arr2.length < 2) {
wx.showToast({
title: '促销商品至少选择两个商品',
icon: 'none'
})
return;
}
var id_str = id_arr.join(',');
var jiesuanjia=''
var jianjia=listlist.minimum_price - this.data.chuandi
var yunfeijia = this.data.shipPrice
if (jianjia >= yunfeijia){
wx.navigateTo({
url: '../my/settle_account/settle_account?id=' + id_str + '&price=' + this.data.chuandi,
})
}else{
wx.showToast({
title: '商品实满'+listlist.minimum_price+'元起送',
icon:'none'
})
}
},
//选中商品
choose(e) {
var that = this;
var id = e.currentTarget.dataset.id;
var indexs = e.currentTarget.dataset.index;
var cellindex=e.currentTarget.dataset.cell
var goodsList = this.data.goodsList
var promotion = this.data.promotion
var all_both_choose=that.data.all_both_choose
var n = 0
goodsList.forEach(function(ele, index) {
if(cellindex==index){
for (let i = 0; i < ele.list.length; i++) {
if (indexs == i) {
ele.list[indexs].flag = !ele.list[indexs].flag
}
if (ele.list[i].flag) {
n++
}
if (n == ele.list.length) {
ele.chooseAll = true
} else{
ele.chooseAll = false
}
that.last_both_choose()
}
}
})
that.setData({
goodsId: id,
goodsList: goodsList,
});
that.totalPrice();
},
choose2(e) {
var that = this;
var id = e.currentTarget.dataset.id;
var indexs = e.currentTarget.dataset.index;
var cellindex=e.currentTarget.dataset.cell
var promotion = this.data.promotion
var goodsList=that.data.goodsList
var all_both_choose=that.data.all_both_choose
var n = 0
promotion.forEach(function (ele, index) {
if(cellindex==index){
for (let i = 0; i < ele.list.length; i++) {
if (indexs == i) {
ele.list[indexs].flag = !ele.list[indexs].flag
}
if (ele.list[i].flag) {
n++
}
if (n == ele.list.length) {
ele.chooseAll = true
} else {
ele.chooseAll = false
}
that.last_both_choose();
}
}
})
that.setData({
goodsId: id,
promotion: promotion,
});
that.totalPrice();
},
//减少对应的数量
dec(e) {
var indexs = e.currentTarget.dataset.index
var cellindex = e.currentTarget.dataset.cellindex
var goodsList = this.data.goodsList
var number = goodsList[cellindex].list[indexs].number
if (number <= 1) {
wx.showToast({
title: '已经是最少了哦',
icon: 'none'
})
return;
} else {
goodsList.forEach(function(ele, index) {
if(cellindex==index){
for (let v in ele.list) {
if (v == indexs) {
console.log(number)
number = ele.list[indexs].number - 1;
ele.list[indexs].number = ele.list[indexs].number - 1;
console.log(number)
let url = '/wxapp/cart/editCartNumber'
let params = {
id: ele.list[indexs].id,
num: number
}
app.post(url, params).then(r => {
if (r.code == 1) {
} else {
wx.showToast({
title: '修改失败',
icon: 'none'
})
}
})
}
}
}
})
this.amount();
this.setData({
goodsList: goodsList,
})
this.totalPrice();
}
},
dec2(e) {
var indexs = e.currentTarget.dataset.index
var cellindex = e.currentTarget.dataset.cellindex
var promotion = this.data.promotion
var number2 = promotion[cellindex].list[indexs].number
if (number2 <= 1) {
wx.showToast({
title: '已经是最少了哦',
icon:'none'
})
return;
} else {
promotion.forEach(function(ele, index) {
if(cellindex==index){
for (let v in ele.list) {
if (v == indexs) {
number2 = ele.list[indexs].number - 1;
ele.list[indexs].number = ele.list[indexs].number - 1;
let url = '/wxapp/cart/editCartNumber'
let params = {
id: ele.list[indexs].id,
num: number2
}
app.post(url, params).then(r => {
if (r.code == 1) {
}
})
}
}
}
})
this.amount();
this.setData({
promotion: promotion
})
this.totalPrice();
}
},
//是否全选
last_both_choose(){
let that=this
let goodsList=that.data.goodsList
let promotion = that.data.promotion
let i=goodsList.length+promotion.length
let all_both_choose=that.data.all_both_choose
let j=0
goodsList.forEach(function(ele){
if(ele.chooseAll){
j++
}
})
promotion.forEach(function (ele) {
if (ele.chooseAll) {
j++
}
})
if(i==j){
console.log('全选success')
all_both_choose=true
}else{
all_both_choose=false
}
that.setData({
all_both_choose:all_both_choose
})
},
//选中所有商品
chooseAll() {
var that = this;
var goodsList = that.data.goodsList;
var promotion=that.data.promotion
var all_both_choose = that.data.all_both_choose
var n = that.data.n
var m=0
goodsList.forEach(function(ele, index) {
if (ele.chooseAll) {
for (let i = 0; i < ele.list.length; i++) {
ele.list[i].flag = false
}
ele.chooseAll = false
n--
that.setData({
goodsList: goodsList
})
} else {
for (let i = 0; i < ele.list.length; i++) {
ele.list[i].flag = true
}
ele.chooseAll = true
n++
that.setData({
goodsList: goodsList
})
}
that.last_both_choose();
});
// m=goodsList.length+promotion.length
// console.log("商品"+n)
// if(n==m){
// all_both_choose=true
// }else{
// all_both_choose=false
// }
that.setData({
// all_both_choose:all_both_choose,
// n:n
})
that.totalPrice();
},
chooseAll2() {
var that = this;
var promotion = that.data.promotion;
var goodsList=that.data.goodsList
var all_both_choose = that.data.all_both_choose
var n = that.data.n
var m=0
promotion.forEach(function (ele, index) {
if (ele.chooseAll) {
for (let i = 0; i < ele.list.length; i++) {
ele.list[i].flag = false
}
ele.chooseAll = false
n--
that.setData({
promotion: promotion
})
} else {
for (let i = 0; i < ele.list.length; i++) {
ele.list[i].flag = true
}
ele.chooseAll = true
n++
that.setData({
promotion: promotion
})
}
that.last_both_choose();
});
m=goodsList.length+promotion.length
console.log("促销" + n)
console.log("促销" + m)
if(m==n){
all_both_choose=true
}
else{
all_both_choose=false
}
that.setData({
// all_both_choose:all_both_choose,
n:n
})
that.totalPrice();
},
//增加商品数量
add(e) {
var indexs = e.currentTarget.dataset.index
var cellindex = e.currentTarget.dataset.cellindex
var goodsList = this.data.goodsList
var number2 = goodsList[cellindex].list[indexs].number
console.log(number2+"这个十二号")
var limit=e.currentTarget.dataset.limit
if(limit>number2||limit==0){
goodsList.forEach(function (ele, index) {
if (cellindex == index) {
for (let v in ele.list) {
if (v == indexs) {
console.log(number2)
number2 = ele.list[indexs].number + 1
ele.list[indexs].number = ele.list[indexs].number + 1
console.log(number2)
let url = '/wxapp/cart/editCartNumber'
let params = {
id: ele.list[indexs].id,
num: number2
}
app.post(url, params).then(r => {
if (r.code == 1) {
console.log(r)
}
})
}
}
}
})
this.amount();
this.setData({
goodsList: goodsList,
})
this.totalPrice();
}else{
wx.showToast({
title: '限购'+limit+'件',
icon:'none'
})
return
}
},
add2(e) {
var indexs = e.currentTarget.dataset.index
var cellindex = e.currentTarget.dataset.cellindex
var promotion = this.data.promotion
var number2 = promotion[cellindex].list[indexs].number
var limit = e.currentTarget.dataset.limit
if(limit>number2||limit==0){
promotion.forEach(function (ele, index) {
if (cellindex == index) {
for (let v in ele.list) {
if (v == indexs) {
number2 = ele.list[indexs].number + 1
ele.list[indexs].number = ele.list[indexs].number + 1
let url = '/wxapp/cart/editCartNumber'
let params = {
id: ele.list[indexs].id,
num: number2
}
app.post(url, params).then(r => {
if (r.code == 1) {
console.log(r)
}
})
}
}
}
})
this.amount();
this.setData({
promotion: promotion
})
this.totalPrice();
}else{
wx.showToast({
title: '限购'+limit+'件',
icon:'none'
})
return
}
},
//去结算
account() {
var that = this
var goodsList = that.data.goodsList
var id_arr = [];
goodsList.forEach(function(ele, index) {
for (var i in ele.list) {
// console.log(ele.list[i].flag);
if (ele.list[i].flag) {
id_arr.push(ele.list[i].id);
}
}
var id_str = id_arr.join(',');
});
wx.navigateTo({
url: '../my/settle_account/settle_account?id=' + id_arr + '&price=' + that.data.totalPrice,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
let a=this.data.shipment.free
this.fetchCartList();
this.setData({
chooseAll: false,
chooseAll2: false,
totalPrice: 0,
all_both_choose: false,
ship_balance:a
})
this.fetchCartNum()
},
/**
* 生命周期函数--监听页面隐藏
*/
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
... ...
<!--pages/cart/cart.wxml-->
<view class='cart_box'>
<view class='page'>
<view class='cart_box'>
<view class='top_label'>
购物车
<view class='del_btn'>删除</view>
<view class='del_btn' bindtap='del_btn'>删除 </view>
</view>
<view class='tips'>
<view class='left'>
<view class='note'>提示</view>满200元包邮,还差36包邮
<view class='note'>提示</view>满{{listlist.shipment.free}}元包邮,还差{{ship_balance}}包邮
</view>
<view class='right' catchtap='get_return'>再逛逛
<icon class='iconfont icon-icondayu'></icon>
</view>
<view class='right' catchtap='get_return'>再逛逛 <icon class='iconfont icon-icondayu'></icon></view>
</view>
<!-- 商品列表 -->
<view class='product_list'>
<view class='singlepart'>
<view>
<view class='product_list' wx:if='{{goodsList.length>0||promotion.length>0}}'>
<view class='singlepart' wx:for='{{goodsList}}' wx:for-item='cell' wx:for-index='cellindex' wx:key='{{cellindex}}'>
<view class='single_part_top'>
<view class='single_part_left'>
<view class='iconfont icon-weixuanzhong'></view>
标签01商品
<view class='iconfont icon-weixuanzhong {{cell.chooseAll?"active":""}}' bindtap='chooseAll'></view>
{{cell.name}}
</view>
<view class='single_part_right'>
<!-- <view class='single_part_right'>
鲜橙促销 买1送1
<view class='iconfont icon-icondayu'></view>
</view>
</view> -->
</view>
<view class='single_part_items'>
<view class='single_part_item'>
<view class='iconfont icon-weixuanzhong'></view>
<view class='single_part_item' wx:for='{{cell.list}}' wx:key='*this' wx:for-index='index' wx:for-item='value' data-id='{{value.product_id}}' bindtap='goDetail'>
<view class='iconfont icon-weixuanzhong {{value.flag?"active":""}}' data-cell='{{cellindex}}' catchtap='choose' data-id='{{value.id}}' data-flag='{{value.flag}}' data-index='{{index}}'></view>
<view class='single_part_imgbox'>
<image src='/pages/imgs/icon32.png' mode='widthFix'></image>
<image src='{{value.more.thumbnail}}' mode='widthFix'></image>
</view>
<view class='single_part_detail'>
<view class='product_title'>泰式冬阴功秘制虾汤620g</view>
<view class='product_type'>小份 切丝</view>
<view class='product_title'>{{value.title}}</view>
<view class='product_type'>{{value.sku_values}}</view>
<view class='product_action'>
<view class='price'>¥<text class='detail_price'>26</text></view>
<view class='action_box'>
<view class='short action_btn'>-</view>
<view class='detail_num'>1</view>
<view class='action_btn'>+</view>
</view>
<view class='price'>¥
<text class='detail_price'>{{value.goods_price}}</text>
</view>
</view>
</view>
<view class='single_part_item'>
<view class='iconfont icon-weixuanzhong'></view>
<view class='single_part_imgbox'>
<image src='/pages/imgs/icon32.png' mode='widthFix'></image>
</view>
<view class='single_part_detail'>
<view class='product_title'>泰式冬阴功秘制虾汤620g</view>
<view class='product_type'>小份 切丝</view>
<view class='product_action'>
<view class='price'>¥<text class='detail_price'>26</text></view>
<view class='action_box'>
<view class='short action_btn'>-</view>
<view class='detail_num'>1</view>
<view class='action_btn'>+</view>
<view class='short action_btn' catchtap='dec' data-number='{{value.number}}' data-index='{{index}}' data-cellindex='{{cellindex}}'>-</view>
<view class='detail_num'>{{value.number}}</view>
<view class='action_btn' catchtap='add' data-limit='{{value.limit_numer}}' data-number='{{value.number}}' data-index='{{index}}' data-cellindex='{{cellindex}}'>+</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class='singlepart'>
<view class='singlepart' data-id='{{cell.id}}' bindtap='goDetail2' wx:for='{{promotion}}' wx:for-item='cell' wx:for-index='cellindex' wx:key='{{cellindex}}'>
<view class='single_part_top'>
<view class='single_part_left'>
<view class='iconfont icon-weixuanzhong'></view>
标签01商品
<view class='iconfont icon-weixuanzhong {{cell.chooseAll?"active":""}}' catchtap='chooseAll2'></view>
{{cell.name}}
</view>
<view class='single_part_right'>
<!-- <view class='single_part_right'>
鲜橙促销 买1送1
<view class='iconfont icon-icondayu'></view>
</view>
</view> -->
</view>
<view class='single_part_items'>
<view class='single_part_item'>
<view class='iconfont icon-weixuanzhong'></view>
<view class='single_part_item' wx:for='{{cell.list}}' wx:key='*this' wx:for-index='index' wx:for-item='value'>
<view class='iconfont icon-weixuanzhong {{value.flag?"active":""}}' catchtap='choose2' data-cell='{{cellindex}}' data-id='{{value.id}}' data-flag='{{value.flag}}' data-index='{{index}}'></view>
<view class='single_part_imgbox'>
<image src='/pages/imgs/icon32.png' mode='widthFix'></image>
<image src='{{value.more.thumbnail}}' mode='widthFix'></image>
</view>
<view class='single_part_detail'>
<view class='product_title'>泰式冬阴功秘制虾汤620g</view>
<view class='product_type'>小份 切丝</view>
<view class='product_title'>{{value.title}}</view>
<view class='product_type'>{{value.sku_values}}</view>
<view class='product_action'>
<view class='price'>¥<text class='detail_price'>26</text></view>
<view class='action_box'>
<view class='short action_btn'>-</view>
<view class='detail_num'>1</view>
<view class='action_btn'>+</view>
<view class='price'>¥
<text class='detail_price'>{{value.goods_price}}</text>
</view>
</view>
</view>
</view>
<view class='single_part_item'>
<view class='iconfont icon-weixuanzhong'></view>
<view class='single_part_imgbox'>
<image src='/pages/imgs/icon32.png' mode='widthFix'></image>
</view>
<view class='single_part_detail'>
<view class='product_title'>泰式冬阴功秘制虾汤620g</view>
<view class='product_type'>小份 切丝</view>
<view class='product_action'>
<view class='price'>¥<text class='detail_price'>26</text></view>
<view class='action_box'>
<view class='short action_btn'>-</view>
<view class='detail_num'>1</view>
<view class='action_btn'>+</view>
<!-- <view class='action_box'>
<view class='short action_btn' catchtap='dec2' data-number='{{value.number}}' data-index='{{index}}' data-cellindex='{{cellindex}}'>-</view>
<view class='detail_num'>{{value.number}}</view>
<view class='action_btn' catchtap='add2' data-limit='{{value.limit_numer}}' data-number='{{value.number}}' data-index='{{index}}' data-cellindex='{{cellindex}}'>+</view>
</view> -->
</view>
</view>
</view>
</view>
</view>
</view>
<view wx:else class='gogogo'>请先去选择商品</view>
</view>
</view>
</view>
<view class='bottom_ac'>
<view class='choose'>
<view class='iconfont icon-weixuanzhong'></view> 全选
<view class='choose' bindtap='allBothChoose'>
<view class='iconfont icon-weixuanzhong {{all_both_choose?"active":""}}'></view> 全选
</view>
<view class='count'>
<view class='count_top'>
合计:<view class='price'>¥<text class='detail_price'>26</text></view>
合计:
<view class='price'>¥
<text class='detail_price'>{{totalPrice}} </text>
</view>
</view>
<view class='fee'>
含运费10
含运费{{shipPrice}}
</view>
</view>
<view class='count_btn'>
<view class='count_btn' bindtap='settleAccountGoods'>
<!-- 原来是account -->
结算
</view>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -5,6 +5,17 @@ page{
flex-flow: column;
height: 100%;
}
.page{
overflow-x: hidden;
min-height: 100%;
}
.gogogo{
text-align: center;
line-height: 500rpx;
color: #888;
font-size: 32rpx;
}
.cart_box{
flex: 1;
display: flex;
... ... @@ -59,12 +70,13 @@ page{
margin-right: 30rpx;
}
.product_list{
padding: 0 25rpx;
flex: 1;
overflow-y: scroll;
}
.singlepart{
border-top: 22rpx solid #FAFAFA;
padding: 0 25rpx;
box-sizing: border-box
}
.single_part_top{
height: 90rpx;
... ... @@ -88,6 +100,9 @@ page{
font-size: 40rpx;
margin-right: 24rpx;
}
.single_part_left .iconfont.active,.icon-weixuanzhong.active{
color:#FFDA44
}
.single_part_item{
display: flex;
margin: 30rpx 0 60rpx;
... ... @@ -105,6 +120,7 @@ page{
margin-left: 20rpx;
margin-right: 40rpx;
}
.single_part_imgbox image{
width: 100%;
}
... ... @@ -160,12 +176,16 @@ page{
padding: 0 16rpx;
}
.bottom_ac{
width: 100%;
height: 100rpx;
display: flex;
padding-left:25rpx;
background: #FFF;
align-items: center;
border-top: 1px solid #EFEFEF;
position: absolute;
bottom: 0;
left: 0;
}
.choose{
display: flex;
... ... @@ -199,4 +219,7 @@ page{
justify-self: flex-end;
margin-left: auto;
-webkit-margin-start: auto;
position: absolute;
right: 0;
top: 0
}
\ No newline at end of file
... ...
// pages/cart/mask/mask.js
Page({
/**
* 页面的初始数据
*/
data: {
navList: ['今日特惠', '烟灶推荐', '净水饮水推荐', '洗碗机推荐', '电热推荐', '燃热推荐', '消毒柜推荐', '嵌入式推荐', '商用电器', '活动说明'],
navLists: ['今日特惠', '烟灶推荐', '净水饮水推荐', '洗碗机推荐', '电热推荐', '燃热推荐', '消毒柜推荐', '嵌入式推荐', '商用电器', '活动说明'], status: 0,
multiArray: [['宴会庆典', '峰会论坛', '商业活动'], ["协会活动", "慈善活动", "答谢活动", "区块链", "人工智能", "大数据", "品牌推广", "开业庆典", "展会活动"]],
multiIndex: [0, 0],
},
getStatus(e) {
this.setData({
status: e.currentTarget.dataset.index
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
bindMultiPickerChange(e) {
this.setData({
multiIndex: e.detail.value
})
},
bindMultiPickerColumnChange(e) {
const data = {
multiArray: this.data.multiArray,
multiIndex: this.data.multiIndex
}
data.multiIndex[e.detail.column] = e.detail.value
switch (e.detail.column) {
case 0:
switch (data.multiIndex[0]) {
case 0:
data.multiArray[1] = ["协会活动", "慈善活动", "答谢活动"]
break
case 1:
data.multiArray[1] = ["区块链", "人工智能", "大数据"]
break
case 2:
data.multiArray[1] = ["品牌推广", "开业庆典", "展会活动"]
break
}
data.multiIndex[1] = 0
break
}
console.log(data.multiIndex)
this.setData(data)
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class="tui-city-scroll">
<swiper >
<swiper-item wx:for="{{navList}}" wx:key="">
<text bindtap="getStatus" id="Nav{{index}}" class="tui-nav-li {{index === status ? 'tui-nav-active' : ''}}" data-index="{{index}}">{{item}}</text>
</swiper-item>
</swiper>
</view>
<!--列表滚动区 -->
<view class="tui-fixed-y">
<scroll-view class="tui-city-scroll-y" scroll-y="true" scroll-into-view="Nav{{status}}" scroll-with-animation="true">
<view wx:for="{{navList}}" wx:key="{{item}}">
<view id="Nav{{index}}" class="tui-list-head">{{item}}</view>
<view class="tui-list-li">{{item}} 列表 {{index}}</view>
</view>
</scroll-view>
</view>
<view class="section">
<picker
mode="multiSelector"
bindchange="bindMultiPickerChange"
bindcolumnchange="bindMultiPickerColumnChange"
value="{{multiIndex}}"
range="{{multiArray}}"
>
<view class="picker">
当前选择:{{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}}
</view>
</picker>
</view>
\ No newline at end of file
... ...
/* .tui-fixed-x{
width: 100%;
position: fixed;
top: 0;
left: 0;
}
.tui-city-scroll{
height: 80rpx;
line-height: 80rpx;
width: 100%;
white-space: nowrap;
}
.tui-nav-li{
font-size: 30rpx;
padding: 0 8rpx;
}
.tui-nav-li:first-child{padding-left: 16rpx;}
.tui-nav-li:last-child{padding-right: 16rpx;}
.tui-nav-active{color: red;}
.tui-fixed-y{
width: 100%;
height: calc(100% - 80rpx);
position: fixed;
bottom: 0;
left: 0;
}
.tui-city-scroll-y{
padding: 0 20rpx;
height: 100%;
box-sizing: border-box;
}
.tui-list-head{
height: 50px;
line-height: 50px;
text-align: center;
font-size: 30rpx;
color: blue;
}
.tui-list-li{
height: 400px;
padding: 10rpx;
color: #fff;
font-size: 50rpx;
background-color: lightgreen;
}
*/
... ...
// pages/index/goodsDetial/goodsDetial.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
imgUrl: app.globalData.imgUrl,
shoucang: false,
active: true,
show: false,
shows: false,
id: 0,
goods: [],
ids: [],
idss: [],
status: 0,
cart_count: 0,
skuid: '',
num: 1,
id_arr: [],
gPrice: 0,
collocation: [],
goods_star: 1,
star_arr: [],
commentCount: 0,
favorite: 0,
totalPrice: 0,
gPrice: 0,
is_group: 0,
packageList: [],
showList: [],
showMore: false,
show1: false,
goods1: {},
origin: 0,
skuid_arr: [],
is_vip: 0
},
fetchVip() {
let url = '/wxapp/user/index'
app.post(url).then(r => {
if (r.code == 1) {
console.log(r)
this.setData({
is_vip: r.data.user.is_vip
})
this.fetchGoods()
}
})
},
//进入评论列表
jump_user_comment(e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '../user_comment/user_comment?id=' + this.data.id
})
},
//进入商品详情
goDetail(e) {
wx.navigateTo({
url: '../goodsDetials/goodsDetials?id=' + e.currentTarget.dataset.id
})
},
//减少数量
dec_num() {
var num = this.data.num;
if (num <= 1) {
return;
} else {
num--
}
this.setData({
num: num
});
this.totalPrice()
},
//增加数量
add_num() {
var num = this.data.num;
num++
this.setData({
num: num
});
this.totalPrice();
},
//总价格
totalPrice() {
var that = this
var total = that.data.goods.info.price * that.data.num
that.setData({
totalPrice: total
})
},
//点击收藏
collection_true(e) {
let id = e.currentTarget.dataset.id
let that = this
let url = '/wxapp/cookbook_package/setFavorites?id=' + id
let params = {
id: id
}
app.post(url).then(r => {
if (r.code == 1) {
wx.showToast({
title: r.msg,
icon: 'none'
})
that.fetchGoods();
}
})
},
//促销进商品详情
jump_goodsDetial2(e) {
wx.navigateTo({
url: '../goodsDetial2/goodsDetial2?id=' + e.currentTarget.dataset.id
})
},
//关闭弹窗
close_mask_carts() {
this.setData({
shows: false
});
},
//根据id获取内容
fetchGoods() {
let url = '/wxapp/cookbook_package/getPackageInfo';
let params = {
id: this.data.id
};
let that = this
let showList = []
let arr1 = []
let skuid1 = 0
let skuid_price1 = 0
let old_skuid_price1 = 0
let skuid_arr = that.data.skuid_arr;
let is_vip = that.data.is_vip
console.log(is_vip + 'shibushis')
app.post(url, params).then(r => {
// console.log(r);
r.data.list.forEach(function (ele, indexxx) {
if (is_vip == 1) {
ele.ggprice = ele.vip_price
} else {
ele.ggprice = ele.price
}
if (ele.is_default == 1) {
showList.push(ele)
}
ele.t = false
ele.attr.attr_sku.forEach(function (eles, indexxxx) {
for (let i = 0; i < eles.item.length; i++) {
eles.item[i].t = false
eles.item[0].t = true;
arr1.push(eles.item[0].id)
}
})
arr1.sort();
let arr2 = [...new Set(arr1)]
ele.arr = arr2
let str1 = arr2.join('_');
let sys_attrprice1 = r.data.list[indexxx].sys_attrprice
if (ele.attr.attr_sku.length == 0) {
return;
} else {
for (let i in sys_attrprice1) {
if (i == str1) {
skuid1 = sys_attrprice1[i].skuid
skuid_price1 = sys_attrprice1[i].price
old_skuid_price1 = sys_attrprice1[i].old_price
}
}
}
ele.ggid = skuid1
if (ele.ggid) {
skuid_arr.push(skuid1)
}
str1 = ''
arr1 = []
})
if (r.data.groupType) {
var days = ''
var hours = ''
var minutes = ''
var seconds = ''
var percent = 0
function time() {
var cut_time = r.data.groupType.count_down_time
days = Math.floor((cut_time) / (60 * 60 * 24));
hours = Math.floor((cut_time) / (60 * 60)) % 24;
minutes = Math.floor((cut_time) / (60)) % 60;
seconds = cut_time % 60;
percent = Math.floor(r.data.info.group_number * 100 / r.data.info.group_min_number)
}
time();
// setInterval(time, 1000);
that.setData({
day: days,
hour: hours,
minute: minutes,
second: seconds,
percent: percent,
goods: r.data,
gPrice: r.data.info.price,
collocation: r.data.collocation,
comment: r.data.comment,
// star_arr: star_arr,
is_group: r.data.info.group_min_number
});
} else {
that.setData({
goods: r.data,
gPrice: r.data.info.price,
// comment: r.data.comment,
packageList: r.data.list,
showList: showList
});
}
});
},
//渲染评论列表
fetchCommentList() {
let url = '/wxapp/product/comment?id=' + this.data.id
app.post(url).then(r => {
this.setData({
commentCount: r.data.length
});
})
},
//点击更换菜品
replaceDishes() {
this.setData({
showMore: true
})
wx.pageScrollTo({
scrollTop: 0,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
this.fetchVip();
var query = wx.createSelectorQuery();
var offset = query.select('.itme_list5');
this.setData({
id: options.id
});
// this.fetchGoods();
this.fetchCommentList();
},
// 返回上一页
get_back() {
wx.navigateBack({})
},
//弹框返回
closeShowMore() {
let that = this
let goods = that.data.goods
let num = goods.info.num
let showList = []
let n = 0
goods.list.forEach(function (ele, index) {
if (ele.t) {
showList.push(ele)
n++;
}
})
if ((n < goods.info.num && n > 0) || n > goods.info.num) {
wx.showToast({
title: '请选择' + num + '种商品',
icon: 'none'
})
return;
} else {
if (showList.length == 0) {
that.setData({
showMore: false,
})
} else {
that.setData({
showMore: false,
showList: showList
})
}
}
},
//attr选择规格
chooseStandard(e) {
let origin = e.currentTarget.dataset.origin
if (e.currentTarget.dataset.shop.attr.attr_sku.length == 0) {
wx.showToast({
title: '暂无规格',
icon: "none",
duration: 1300
})
} else {
this.setData({
goods1: e.currentTarget.dataset.shop,
show1: true,
origin: origin,
});
}
},
//关闭弹框
close_mask_cart1() {
this.setData({
show1: false
})
},
//加购筛选
changeIds1(e) {
let t = this;
let goods = t.data.showList;
let iindex = e.currentTarget.dataset.origin
//父级索引
let parent = e.currentTarget.dataset.parent
goods.forEach(function (ele, index) {
if (iindex == index) {
let new_arr = ele.arr
let listAll = ele.attr.attr_sku;
// 父级索引
let x = e.currentTarget.dataset.index;
// 当前点击Id
let nowId = e.currentTarget.dataset.gid;
//当前点击value
let nowValue = e.currentTarget.dataset.item;
// 子集索引
let nowIndex = e.currentTarget.dataset.index;
// 当前可否多选
let is_checkMore = false
let foo = new_arr.indexOf(nowId)
if (foo > -1) {
new_arr.splice(foo, 1)
} else {
ele.attr.attr_sku.forEach(function (eles, indexxxx) {
if (indexxxx == parent) {
for (let i = 0; i < eles.item.length; i++) {
let havId = ele.attr.attr_sku[indexxxx].item[i].id
let have = new_arr.indexOf(havId)
if (have > -1) {
new_arr.splice(have, 1)
}
}
}
})
}
// 当前点击父级值
let tempArry = JSON.parse(JSON.stringify(ele.attr.attr_sku[parent]));
!tempArry.chooseIndex ? tempArry.chooseIndex = [] : '';
// 是否多选
if (is_checkMore) { } else {
tempArry.chooseIndex.pop();
tempArry.chooseIndex.push(nowId);
for (let obj of tempArry.item) {
obj.t = false
}
tempArry.item[nowIndex].t = true;
}
ele.attr.attr_sku[parent] = tempArry;
}
})
t.setData({
goods1: goods[iindex]
})
// let goods = t.data.goodsList;
goods.forEach(function (ele, indexaa) {
if (iindex == indexaa) {
let new_arr = ele.arr
let sys_attrprice = goods[indexaa].sys_attrprice;
let new_arr_item = [];
let str = ''
let skuid = 0
let skuid_price = 0
let old_skuid_price = 0
let vip_skuid_price = 0
ele.attr.attr_sku.forEach(function (eles, indexx) {
if (indexx == parent) {
new_arr = new_arr.concat(eles.chooseIndex);
}
})
new_arr = new_arr.sort()
str = new_arr.join('_')
ele.arr = new_arr
t.setData({
goodsList: goods
})
new_arr_item = new_arr_item.join(',');
new_arr_item = new_arr_item.replace(/,/g, " ");
for (let i in sys_attrprice) {
if (i == str) {
skuid = sys_attrprice[i].skuid
skuid_price = sys_attrprice[i].price
old_skuid_price = sys_attrprice[i].old_price
vip_skuid_price = sys_attrprice[i].vip_price
ele.ggid = skuid;
var ggprice = 0
if (t.data.is_vip == 1) {
ggprice = vip_skuid_price
} else {
ggprice = skuid_price
}
ele.ggprice = ggprice
ele.arr = new_arr
}
}
}
})
t.setData({
goodsList: goods
})
console.log(101010101)
},
//skuid加入skuid_arr
hide_mask1(e) {
var skuid_arr = this.data.skuid_arr
var skuid1 = this.data.skuid1
var indexs = e.currentTarget.dataset.index
if (skuid1 != 0) {
// skuid_arr.push(skuid1)
}
var goods = this.data.showList
goods.forEach(function (ele, index) {
if (index == indexs) {
for (let i = 0; i < ele.attr.attr_sku.length; i++) {
if (ele.arr.length == 1) {
wx.showToast({
title: '请选择全部属性',
icon: 'none'
})
}
}
}
})
this.setData({
show1: false,
skuid_arr: skuid_arr
})
},
//立即购买
go_pay_sale() {
var that = this
var goodsList = that.data.showList
var skuid_arr = []
var total_price = 0
goodsList.forEach(function (ele, index) {
var skuid = ele.ggid
if (ele.ggprice) {
ele.ggprice = ele.ggprice.substring(0, ele.ggprice.length - 3)
}
var price = ele.ggprice * 1
if (ele.stock > 0) {
if (ele.ggid && ele.ggid != 0) {
total_price += price
skuid_arr.push(skuid)
} else {
wx.showToast({
title: '本件商品没有规格属性',
icon: 'none',
duration: 1000
})
ele.t = false
that.setData({
goodsList: goodsList
})
}
} else {
wx.showToast({
title: '商品已卖完',
icon: 'none'
})
}
})
console.log(total_price + "总价")
wx.navigateTo({
url: '../../my/settle_account/settle_account?pakSale=' + skuid_arr + '&pakId=' + that.data.goods.info.id
})
},
//选区食品包
changeFlag(e) {
let indexs = e.currentTarget.dataset.index
let that = this
let list = that.data.packageList
list.forEach(function (ele, index) {
if (indexs == index) {
console.log(ele.t + "之前")
ele.t = !ele.t
console.log(ele.t + "之后")
}
})
that.setData({
packageList: list
})
},
// 跳转图文食谱
get_recipe() {
wx.navigateTo({
url: '../production_steps/production_steps?id=' + this.data.id,
})
},
// 跳转购物车
get_car() {
this.setData({
show: true
});
},
//隐藏mask
hide_masks() {
var that = this
if (that.data.skuid != '') {
that.setData({
shows: false
});
var str = ''
str = that.data.id_arr.join(',');
if (that.data.id_arr.length > 1) {
var gPrice = that.data.num * that.data.gPrice
console.log(gPrice);
if (that.data.is_group == 0) {
wx.navigateTo({
url: '../../my/settle_account/settle_account?ids=' + that.data.skuid + '&gid=' + that.data.id + '&num=' + that.data.num + '&gPrice=' + gPrice
})
} else {
wx.navigateTo({
url: '../../my/settle_account/settle_account?ids=' + that.data.skuid + '&gid=' + that.data.id + '&num=' + that.data.num + '&gPrice=' + gPrice + '&is_group=' + that.data.is_group
})
}
}
} else {
wx.showToast({
title: '请先选择商品属性组合',
icon: 'none'
})
}
},
//跳至图文详情
jump_detail() {
this.setData({
active: false
});
wx.pageScrollTo({
scrollTop: 1200,
duration: 300
})
},
jump_goods() {
this.setData({
active: true
});
wx.pageScrollTo({
scrollTop: 0,
duration: 300
})
},
//收藏
collection() {
this.setData({
shoucang: !this.data.shoucang
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
var shareObj = {
// title: options.target.dataset.title, // 默认是小程序的名称(可以写slogan等)
path: '/pages/start/start',
imgUrl: '',
title: ''
}
// if (options.from == 'button') {
// // 此处可以修改 shareObj 中的内容
// shareObj.path = '/pages/start/start?status=' + options.target.dataset.status
// }  
return shareObj;
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class='page {{showMore||show1?"active":""}}'>
<view class='big_box'>
<view class='detail_container {{show||shows?"active":""}}'>
<view class='banner' wx:if='{{!showMore}}'>
<view class='iconfont icon-fanhui' catchtap='get_back'></view>
<view class='coupons'>
<view class='goods_detail {{active?"active":""}}' bindtap='jump_goods'>商品详情</view>
<view class='graphic_detail {{!active?"active":""}}' bindtap='jump_detail'>图文详情</view>
</view>
<view class='share'>
<button open-type='share' type='false' class='share_btn' plain='true'>分享</button>
</view>
</view>
<view class='banner_box'>
<view class='banner_box_group' wx:if='{{goods.groupType}}'>
距离团购
<text wx:if='{{goods.groupType.group_status==1}}'>开始\t\t\t</text>
<text wx:elif='{{goods.groupType.group_status==2}}'>结束\t\t\t</text> {{day}}天{{hour}}小时{{minute}}分钟
</view>
<view class='banner_img'>
<image src='{{goods.info.thumbnail}}'></image>
</view>
</view>
<view class='content_item'>
<view class='item_list'>
<view class='banner_title'>{{goods.info.title}}</view>
<view class='introduce'>{{goods.info.excerpt}}</view>
<view class='good_price_progress' wx:if='{{goods.groupType.group_status==2}}'>
<progress show-info border-radius='4' activeColor='#ffda44' stroke-width='8' percent='{{percent}}' font-size='12'></progress>
<text class='group_font'>已拼{{goods.info.group_number}}份\t\t\t\t目标{{goods.info.group_min_number}}份</text>
</view>
<!-- <view class='banner_character'>
<view class='banner_price'>
<view class=''>
<text class='money_icon'>¥</text>
<text class='money'>{{goods.info.price}}</text>
<text class='original_price'>¥{{goods.info.old_price}}</text>
</view>
</view>
</view> -->
<view class='banner_character'>
<view class='banner_price'>
<view class=''>
<text class='money_icon'>¥</text>
<text class='money'>{{goods.info.price}}</text>
<text class='original_price'>¥{{goods.info.old_price}}</text>
</view>
<view class='display_box'>
<text class='money_icon2'>¥</text>
<text class='money2'>{{goods.info.vip_price}}</text>
<view class='vip'>
<image class='vipvip' src='{{imgUrl}}vipvip.png'></image></view>
</view>
</view>
<!-- <view>已售出:{{goods.info.sale_number}}份</view> -->
</view>
</view>
<view class='item_list2' wx:if='{{common}}'>
<view class='user_evaluation'>
<view class='user_evaluation_title'>用户评价</view>
<view class='user_evaluation_time' bindtap='jump_user_comment'>
<view>({{commentCount}})</view>
<view class='iconfont icon-jinru'></view>
</view>
</view>
<view class='user_information_box' wx:for='{{comment}}' wx:for-index='index' wx:key='{{index}}'>
<view class='user_information'>
<view class='the_star'>
<view class='head_portrait'>
<image src='{{item.avatar}}'></image>
</view>
<view class='star_box'>
<view class='user_name'>{{item.full_name}}</view>
<view class='stars1'>
<view class='iconfont icon-pingfen' wx:for='{{item.stars_arr}}' wx:key='{{item}}'></view>
</view>
</view>
</view>
<view class='title'>{{item.create_time}}</view>
</view>
<view class='evaluation'>{{item.content}}</view>
<view class='evaluation_img'>
<view class='upload_img_box'>
<view class='upload_img' wx:for='{{item.more.photos}}' wx:for-item='child' wx:key='{{child}}'>
<image src='{{child}}'></image>
</view>
</view>
</view>
<view class='comments_btn'>
<view class='iconfont icon-message'></view>
<view class='comments'>评论</view>
</view>
</view>
</view>
<view class='item_list10'>
<view class='food_title_all'>
<view class='explain_one'>
商品包内容
</view>
<view class='two_title_xixi'>点击商品可查看商品信息,也可更换该商品包菜品</view>
</view>
<view class='food_box_big'>
<view class='real_food_box'>
<view class='collocation'>
<view class='collocation_box' wx:for='{{showList}}' wx:for-index='index' wx:key='{{index}}' bindtap='goDetail' data-id='{{item.id}}'>
<view class='iconfont icon-weixuanzhong {{flag?"active":""}}' catchtap='changeFlag'></view>
<view class='collocation_img'>
<image src='{{item.more.thumbnail}}'></image>
</view>
<view class='collocation_content'>
<view class='overflowe'>{{item.title}}
</view>
<view class='introduce'>{{item.tips}}</view>
<view class='introduce' catchtap='chooseStandard' data-shop="{{item}}" data-origin='{{index}}'>请选择商品属性
<view class='iconfont icon-icondayu'></view>
</view>
</view>
</view>
</view>
</view>
<view class='replace_dishes' bindtap='replaceDishes'>
<view class='replace_dishes_center'>
<view class='replace_image'>
<image src='../../imgs/replace.png'></image>
</view>
<view class='replace_font'>更换菜品</view>
</view>
</view>
</view>
</view>
<view>
<view class='explain'>
<view class='explain_one'>
小贴士
</view>
<view class='explain_two'>
<view> 01 这里是菜品更换说明,模块高度随文案内容变更,文案将两控制在100字以内</view>
<view> 02 从以下菜品更换您的菜谱,点即可查看详情</view>
<view> 03 这里是菜品更换说明,模块高度随文案内容变更,文案将两控制在100字以内</view>
</view>
</view>
</view>
</view>
<view class='bottom_btn'>
<view class='hint_btn'>
<view class='shop_car' bindtap='get_car'>
<view class='iconfont icon-gouwuche'></view>
<view>购物车</view>
<view class='cart_count'>{{goods.cartCount}}</view>
</view>
<!-- <view bindtap='collection' bindtap='collection_true' data-id='{{goods.info.id}}'>
<view class='iconfont icon-shoucang {{goods.info.is_favorite==1||shoucang?"active":""}}'></view>
<view class='shop_car {{goods.info.is_favorite==1||shoucang?"active":""}}'>收藏</view>
</view> -->
</view>
<view class='immediately_btn' bindtap='go_pay_sale'>立即购买</view>
</view>
</view>
<!-- 直接购买弹框 -->
<view class='cart_mask' wx:if='{{shows}}'>
<view class='cart_mask_diceng'>
<view class='close_jump_cart iconfont icon-cuowu' bindtap='close_mask_carts'></view>
<view class='goods_name'>菜品名称</view>
<view class='weight' wx:for='{{goods.attr.attr_sku}}' wx:key='{{item.id}}' wx:for-index='cellindex' wx:for-item='cell'>
<view class='weight_view'>{{cell.name}}</view>
<view class='quality'>
<view class='quality_left {{value.t?"active":""}}' wx:for='{{cell.item}}' wx:key='{{key}}' data-gid='{{value.id}}' data-parent="{{cellindex}}" data-item="{{value.attribute_value}}" data-index="{{index}}" bindtap='changeIds' wx:for-item='value'>{{value.attribute_value}}</view>
</view>
</view>
<view class='last_box'>
<view class='last_box_top'>
<view class='last_box_top_price'>
<view>¥{{goods.price}}</view>
</view>
</view>
<view class='last_box_top'>
<view class='last_box_top_price'>
<view class='member_price'>¥{{goods.vip_price}}</view>
<text class='member'>会员专享</text>
</view>
<view class='jiajian' wx:if='{{!goods.groupType}}'>
<view bindtap='dec_num' class='dec_num'>-</view>
<view class='numnum'> {{num}}</view>
<view bindtap='add_num' class='dec_num'>+</view>
</view>
<view class='purchase' bindtap='hide_masks'>确定</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 更换菜品弹框 -->
<view class='maskMore' wx:if='{{showMore}}'>
<view class='banner'>
<view class='iconfont icon-fanhui' catchtap='closeShowMore'></view>
<view class='coupons'>商品详情</view>
</view>
<view class='explaina'>
<view class='explain_one'>
菜品更换说明
</view>
<view class='explain_two'>
<view> 01 这里是菜品更换说明,模块高度随文案内容变更,文案将两控制在100字以内</view>
<view> 02 从以下菜品更换您的菜谱,点即可查看详情</view>
</view>
</view>
<view class='three'>
<view class='collocation_boxa' wx:for='{{packageList}}' wx:for-index='index' wx:key='{{index}}' bindtap='goDetail' data-id='{{item.id}}'>
<view class='iconfont icon-weixuanzhong {{item.t?"active":""}}' catchtap='changeFlag' data-index='{{index}}'></view>
<view class='collocation_img'>
<image src='{{item.more.thumbnail}}'></image>
</view>
<view class='collocation_content'>
<view class='overflowe'>{{item.title}}</view>
<view class='introduce'>{{item.tips}}</view>
</view>
</view>
</view>
</view>
<!-- 选择规格弹框弹框 -->
<view class='cart_mask' wx:if='{{show1}}'>
<view class='cart_mask_diceng'>
<view class='close_jump_cart iconfont icon-cuowu' bindtap='close_mask_cart1'></view>
<view class='goods_name'>{{goods1.title}}</view>
<view class='weight' wx:for='{{goods1.attr.attr_sku}}' wx:key='{{item.id}}' wx:for-index='cellindex' wx:for-item='cell'>
<view class='weight_view'>{{cell.name}}</view>
<view class='quality'>
<view class='quality_left {{value.t?"active":""}}' wx:for='{{cell.item}}' wx:key='{{key}}' data-gid='{{value.id}}' data-parent="{{cellindex}}" data-item="{{value.attribute_value}}" data-index="{{index}}" bindtap='changeIds1' wx:for-item='value' data-origin='{{origin}}'>{{value.attribute_value}}</view>
</view>
</view>
<view class='last_box'>
<view class='last_box_top'>
<view class='last_box_top_price'>
<view class='yanse'>¥{{goods1.ggprice}}</view>
</view>
<view class='purchase' bindtap='hide_mask1' data-index='{{originIndex}}'>确定</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
/* pages/index/goodsDetial/goodsDetial.wxss */
page {
background: #f3f5f5;
width: 100%;
height: 100%;
}
.page{
width: 100%;
height: 100%
}
.page.active{
overflow: hidden
}
.big_box {
width: 100%;
height: 100%;
}
.detail_container {
width: 100%;
height: 100%;
}
.detail_container.active {
overflow: hidden;
}
.coupons {
font-size: 30rpx;
color: #222;
display: flex;
}
.goods_detail {
font-weight: bold;
}
.goods_detail.active {
border-bottom: 3rpx solid #ffda44;
}
.graphic_detail {
font-weight: bold;
margin-left: 56rpx;
}
.graphic_detail.active {
border-bottom: 3rpx solid #ffda44;
}
.share {
font-size: 28rpx;
color: #222;
}
.share_btn {
background: transparent;
padding: 0;
margin: 0;
border: 0 !important;
color: #222;
font-size: 28rpx;
margin-top: 10rpx;
}
.banner {
position: fixed;
z-index: 999999;
}
.banner_box{
position: relative;
}
.banner_img {
height: 630rpx;
padding-top: 80rpx;
box-sizing: border-box;
}
.banner_img image {
width: 100%;
height: 100%;
}
.item_list {
padding: 32rpx 25rpx;
background-color: #fff;
margin-bottom: 20rpx;
}
.banner_title {
font-size: 34rpx;
color: #222;
}
.introduce {
font-size: 28rpx;
color: #888;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
position: relative
}
.banner_character {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 24rpx;
color: #888;
margin-top: 40rpx;
}
.banner_price {
display: flex;
align-items: center;
width: auto;
}
.money_icon {
font-size: 22rpx;
color: #222;
}
.money {
font-size: 38rpx;
font-weight: bold;
color: #222;
}
.original_price {
color: #888;
text-decoration: line-through;
}
.display_box {
width: auto;
margin-left: 40rpx;
display: flex;
align-items: center
}
.money_icon2 {
font-size: 22rpx;
color: #f44;
}
.money2 {
font-size: 38rpx;
font-weight: bold;
color: #f44;
}
.vip {
width: 80rpx;
height: 25rpx;
margin-left: 5rpx;
}
.vip image{
width: 100%;
height: 100%
}
.list_content {
display: flex;
justify-content: space-between;
align-items: center;
}
.content_title {
display: flex;
}
.title {
font-size: 24rpx;
color: #888;
}
.content {
font-size: 24rpx;
color: #222;
margin-left: 47rpx;
}
.icon-jinru {
font-size: 22rpx;
color: #c7c7c7;
}
.more_box {
font-size: 24rpx;
color: #949a9a;
border-top: 1rpx solid #ededed;
display: flex;
justify-content: center;
align-items: center;
padding-top: 24rpx;
margin-top: 35rpx;
}
.icon-zhankai {
font-size: 14rpx;
margin-left: 10rpx;
}
.item_list1 {
background-color: #fff;
margin-bottom: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
padding: 19rpx 16rpx;
}
.hint1 {
font-size: 22rpx;
color: #222;
background-color: #fafafa;
border-radius: 12rpx;
padding: 25rpx 39rpx;
}
.cash_back {
font-size: 28rpx;
font-weight: bold;
color: #222;
}
.red_font {
font-weight: bold;
color: #f44;
}
.item_list7 {
padding: 31rpx 25rpx 25rpx 25rpx;
}
.attribute {
width: 375rpx;
display: flex;
align-items: center;
/* margin-left: 49rpx; */
}
.attribute_titel {
font-size: 26rpx;
color: #94999a;
}
.stars {
display: flex;
font-size: 26rpx;
color: #222;
margin-left: 35rpx;
}
.icon-pingfen {
font-size: 26rpx;
color: #222;
}
.attribute_content {
font-size: 26rpx;
color: #222;
margin-left: 113rpx;
}
.item_list2, .item_list3, .item_list4, .itme_list5, .item_list6, .item_list7 , .item_list10 {
background-color: #fff;
margin-bottom: 20rpx;
}
.user_evaluation {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1rpx solid #f3f5f5;
padding: 31rpx 25rpx;
}
.user_evaluation_title {
font-size: 30rpx;
font-weight: bold;
color: #222;
}
.user_evaluation_time {
font-size: 24rpx;
color: #c7c7c7;
display: flex;
align-items: center;
}
.comments_btn {
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 23rpx;
color: #949a9a;
margin-top: 24rpx;
}
.icon-message {
font-size: 22rpx;
color: #949a9a;
margin-right: 10rpx;
}
.user_information_box {
padding: 31rpx 25rpx 25rpx 25rpx;
}
.user_information {
display: flex;
justify-content: space-between;
align-items: center;
}
.head_portrait {
width: 62rpx;
height: 62rpx;
}
.head_portrait image {
width: 100%;
height: 100%;
}
.star_box {
margin-left: 25rpx;
}
.the_star {
display: flex;
align-items: center;
}
.stars1 {
display: flex;
}
.user_name {
font-size: 26rpx;
color: #222;
}
.evaluation {
font-size: 24rpx;
color: #222;
margin-top: 25rpx;
}
.evaluation_img {
margin-top: 21rpx;
}
.upload_img_box {
display: flex;
}
.upload_img {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.upload_img image {
width: 100%;
height: 100%;
}
.item_list3 {
padding: 39rpx 25rpx 40rpx 25rpx;
}
.package_title {
font-size: 30rpx;
font-weight: bold;
color: #222;
}
.package_box {
display: flex;
margin-top: 44rpx;
}
.package_img_box {
width: 200rpx;
height: 200rpx;
}
.package_img {
width: 200rpx;
height: 200rpx;
}
.package_img image {
width: 100%;
height: 100%;
}
.package_content {
font-size: 30rpx;
color: #222;
margin-left: 40rpx;
}
.package_hint {
font-size: 24rpx;
color: #94999a;
}
.pickage_display {
font-size: 24rpx;
color: #f44;
margin-top: 47rpx;
}
.item_list4 {
padding: 46rpx 44rpx;
}
.detection_item {
display: flex;
justify-content: space-around;
margin-top: 58rpx;
}
.detection {
display: flex;
justify-content: center;
align-items: center;
}
.line1 {
width: 115rpx;
height: 1rpx;
background: linear-gradient(to right, #fff, #bbb);
}
.line2 {
width: 115rpx;
height: 1rpx;
background: linear-gradient(to left, #fff, #bbb);
}
.detection_title {
font-size: 26rpx;
color: #222;
margin: 0 30rpx;
}
.detection_box {
font-size: 26rpx;
color: #222;
}
.detection_img {
margin: 0 auto 23rpx;
width: 54rpx;
height: 54rpx;
}
.detection_img image {
width: 100%;
height: 100%;
}
.detection_hint {
font-size: 22rpx;
color: #94999a;
text-align: center;
margin-top: 20rpx;
}
.itme_list5 {
position: relative;
padding: 45rpx 25rpx 30rpx 25rpx;
box-sizing: border-box;
}
.recommended_box {
width: 150rpx;
height: 45rpx;
display: flex;
align-items: center;
justify-content: center;
background: #ffda44;
border-radius: 0 0 16rpx 16rpx;
font-size: 22rpx;
color: #333;
position: absolute;
right: 24rpx;
top: 0;
}
.foretaste_box {
display: flex;
align-items: center;
font-size: 30rpx;
}
.buyer_recommend {
font-size: 22rpx;
color: #94999a;
margin-left: 20rpx;
}
.buyer_name {
font-size: 30rpx;
color: #222;
}
.recommend_content {
background-color: #fafafa;
border-radius: 16rpx;
padding: 25rpx 25rpx 25rpx 25rpx;
margin-top: 30rpx;
font-size: 26rpx;
color: #222;
position: relative;
}
.icon-shangyinhao {
font-size: 22rpx;
color: #e3e3e3;
}
.triangle {
width: 0;
height: 0;
border-left: 60rpx solid #fafafa;
border-top: 30rpx solid transparent;
border-bottom: 30rpx solid transparent;
position: absolute;
top: -30rpx;
left: 50rpx;
}
.recommend_character {
margin-left: 10rpx;
}
.ingredients {
margin-top: 40rpx;
}
.ingredients_title {
font-size: 30rpx;
font-weight: bold;
color: #222;
text-align: center;
margin-bottom: 41rpx;
}
.ingredients_img {
width: 280rpx;
height: 280rpx;
margin-right: 34rpx;
}
.ingredients_box {
display: flex;
}
.ingredients_img image {
width: 100%;
height: 100%;
}
.ingredients_item {
width: 400rpx;
font-size: 26rpx;
display: flex;
/* margin-left: 34rpx; */
margin-top: 34rpx;
/* border: 1px solid red; */
}
.ingredients_name {
color: #94999a;
width: 80rpx;
}
.ingredients_content {
width: 300rpx;
display: flex;
flex-wrap: wrap;
margin-left: 30rpx;
}
.graphic_ingredients_box {
margin-top: 40rpx;
}
.graphic_ingredients {
height: 200rpx;
border: 1rpx solid red;
display: flex;
align-items: center;
justify-content: center;
background-image: url('http://hifresh.w.bronet.cn/assets/wxapp/keshihua@2x.png');
margin-bottom: 20rpx;
}
.graphic_ingredients_background {
width: 450rpx;
height: 110rpx;
background-color: #ffb244;
display: flex;
align-items: center;
justify-content: center;
}
.graphic_ingredients_border {
font-size: 38rpx;
color: #fff;
width: 430rpx;
height: 90rpx;
border: 1rpx solid #fff;
display: flex;
align-items: center;
justify-content: center;
}
.item_list6 {
padding: 30rpx 25rpx;
margin-bottom: 120rpx;
}
.item_list10{
padding: 30rpx 25rpx;
box-sizing: border-box
}
.collocation_title {
font-size: 30rpx;
font-weight: bold;
color: #222;
margin-bottom: 40rpx;
}
.collocation {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.collocation_box {
width: 340rpx;
border-radius: 16rpx;
overflow: hidden;
margin-bottom:20rpx;
}
.collocation_img {
width: 340rpx;
height: 340rpx;
}
.collocation_img image {
width: 100%;
height: 100%;
}
.collocation_content {
background: #fafafa;
font-size: 30rpx;
color: #222;
padding: 22rpx;
height: 152rpx;
position: relative
}
.bottom_btn {
width: 100%;
height: 100rpx;
background: #fff;
display: flex;
justify-content: flex-end;
align-items: center;
position: fixed;
bottom: 0;
left: 0;
}
.hint_btn {
width: 118rpx;
display: flex;
justify-content: space-around;
align-items: center;
}
.icon-shoucang.active {
color: #ff6700;
}
.shop_car {
font-size: 18rpx;
color: #747b7d;
position: relative;
}
.cart_count {
position: absolute;
right: 2rpx;
top: 0;
width: 24rpx;
height: 24rpx;
border-radius: 50%;
background: red;
text-align: center;
line-height: 24rpx;
color: #fff;
font-size: 18rpx;
}
.shop_car.active {
color: #ff6700;
}
.join_btn {
width: 266rpx;
height: 100rpx;
background: linear-gradient(to left, #ffda44, #ffb244);
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
color: #fff;
}
.join_btns{
width: 266rpx;
height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
color: #fff;
background: transparent
}
.immediately_btn {
width: 632rpx;
height: 100rpx;
background: linear-gradient(to left, #f99115, #f56800);
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
color: #fff;
}
/*购物车添加状态*/
.cart_mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
z-index: 9999999;
}
.cart_mask_diceng {
width: 80%;
/* min-height: 550rpx; */
position: absolute;
top: 50%;
margin-left: 10%;
transform: translateY(-50%);
background: rgba(255, 255, 255, 1);
border-radius: 10px;
padding-top: 20rpx;
padding-bottom: 130rpx;
}
.goods_name {
font-size: 30rpx;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: rgba(51, 51, 51, 1);
line-height: 36rpx;
text-align: center;
margin-top: 30rpx;
}
.weight {
height: 100rpx;
margin-top: 34rpx;
/* margin-bottom:44rpx; */
padding: 0 47rpx 0 36rpx;
box-sizing: border-box;
}
.weight_view {
font-size: 26rpx;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(51, 51, 51, 1);
line-height: 36rpx;
}
.quality {
margin-top: 24rpx;
}
.quality_left {
width: 150rpx;
height: 50rpx;
margin-bottom: 20rpx;
background: rgba(247, 247, 247, 1);
border-radius: 10rpx;
text-align: center;
line-height: 50rpx;
font-size: 26rpx;
font-family: FZY3JW--GB1-0;
font-weight: 400;
color: rgba(26, 26, 26, 1);
float: left;
margin-right: 20rpx;
}
.quality_left.active {
background: rgba(255, 218, 68, 1);
}
.last_box {
width: 100%;
height: 110rpx;
background: rgba(247, 247, 247, 1);
border-radius: 0px 0px 10px 10px;
margin-top: 100rpx;
/* padding: 18rpx 0 0 51rpx; */
box-sizing: border-box;
position: absolute;
bottom: 0;
}
.last_box_top {
font-size: 26rpx;
}
.last_box_top_price {
display: flex;
color: #f44;
line-height: 78rpx;
font-family: PingFang-SC-Bold;
font-weight: bold;
}
.last_box_top_price text {
color: #333;
font-size: 18rpx;
margin-left: 10rpx;
}
.member {
text-align: center;
font-family: PingFang-SC-Medium;
margin-left: 24rpx;
background: linear-gradient(-90deg, rgba(244, 243, 200, 1), rgba(250, 216, 90, 1));
border-radius: 5px;
color: rgba(187, 138, 54, 1);
padding: 4rpx -2rpx;
box-sizing: border-box;
/* margin-top:8rpx; */
font-size: 18rpx;
font-weight: 400;
}
.purchase {
width: 160rpx;
height: 50rpx;
background: rgba(255, 218, 68, 1);
border-radius: 25rpx;
font-size: 24rpx;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(26, 26, 26, 1);
line-height: 50rpx;
text-align: center;
position: absolute;
right: 36rpx;
top: 30rpx;
}
.jiajian {
width: 120rpx;
height: 50rpx;
position: absolute;
right: 200rpx;
top: 40rpx;
display: flex;
justify-content: space-between;
}
.dec_num {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
background: #ffda44;
font-size: 32rpx;
color: #fff;
font-weight: bold;
text-align: center;
line-height: 32rpx;
}
.numnum {
width: 32rpx;
height: 32rpx;
text-align: center;
line-height: 32rpx;
font-size: 30rpx;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(102, 102, 102, 1);
}
.close_jump_cart {
position: absolute;
top: 24rpx;
right: 24rpx;
color: #ededed;
font-size: 36rpx;
}
/*团购样式*/
.banner_box_group{
width:700rpx;
height:45rpx;
position: absolute;
left: 0;
bottom: 0;
background: linear-gradient(to right,#ffda44,transparent);
padding-left:26rpx;
z-index: 999;
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(255,255,255,1);
line-height:45rpx;
}
/*团购*/
.good_price_progress{
margin-top:10rpx;
}
.group_font{
font-size:24rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(136,136,136,1);
line-height:24rpx;
height: 24rpx;
}
.goods_margin_top{
margin-top:20rpx;
}
.group_image{
border-radius: 16rpx;
overflow: hidden
}
.group_time{
position: absolute;
bottom:0;
height:30px;
width:200rpx;
background:rgba(187,187,187,1);
border-radius: 0 0 16rpx 16rpx;
padding:0 10rpx;
font-size:20rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(255,255,255,1);
line-height:54rpx;
text-align: center;
}
.group_time.active{
background:rgba(255,68,68,1);
}
/*小贴士*/
.explain{
width: 93.6%;
height:auto;
box-shadow:0px 15px 30px 0px rgba(214,214,214,0.6);
border-radius:16px;
background: #fff;
margin:20rpx auto 130rpx;
padding:18rpx 49rpx;
box-sizing: border-box
}
.explain_one{
text-align: center;
font-size:30rpx;
font-family:PingFang-SC-Heavy;
font-weight:800;
color:rgba(38,54,58,1);
line-height:62rpx;
position: relative;
margin-bottom:16rpx;
}
.explain_one::before{
width: 115rpx;
height: 1rpx;
position: absolute;
left:70rpx;
top:0;
bottom:0;
margin:auto 0;
content: '';
background: linear-gradient(to left,rgba(187,187,187,1),transparent);
}
.explain_one::after{
width: 115rpx;
height: 1rpx;
position: absolute;
right:70rpx;
top:0;
bottom:0;
margin:auto 0;
content: '';
background: linear-gradient(to right,rgba(187,187,187,1),transparent);
}
.explain_two{
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(38,54,58,1);
line-height: 40rpx;
}
.food_title_all{
margin-bottom:30rpx;
}
.two_title_xixi{
width: 100%;
height: 23rpx;
text-align: center;
font-size:22rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(148,153,154,1);
line-height:23rpx;
}
.collocation_contents {
background: #fafafa;
font-size: 30rpx;
color: #222;
padding: 22rpx;
}
.overflowe{
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
position: relative
}
.icon-icondayu{
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
}
.introduces {
font-size: 28rpx;
color: #888;
}
.collocation_boxs {
width: 360rpx;
border-radius: 16rpx;
overflow: hidden;
float: left;
padding:0 10rpx;
position: relative
}
.icon-weixuanzhong{
position: absolute;
right:20rpx;
top:15rpx;
color:#888;
}
.icon-weixuanzhong.active{
color:rgba(255,218,68,1);
}
.replace_dishes{
width: 100%;
/* width:699px; */
height:80rpx;
border:1rpx solid rgba(255,68,68,1);
border-radius:40rpx;
margin:10rpx 0 20rpx;
display: flex;
justify-content: center;
align-items: center
}
.replace_dishes_center{
display: flex;
/* align-items: center */
}
.replace_image{
width: 31rpx;
height: 29rpx;
margin-right:18rpx;
margin-top:-14rpx;
}
.replace_image image{
width: 100%;
height: 100%
}
.replace_font{
height: 29rpx;
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(255,68,68,1);
line-height: 29rpx;
}
/*更换菜品弹框*/
.maskMore{
width: 100%;
min-height: 100%;
background: #f3f5f5;
position: absolute;
left: 0;
top: 0;
}
.coupons {
font-size: 30rpx;
color: #222;
display: flex;
}
.explaina{
width: 93.6%;
height:auto;
box-shadow:0px 15px 30px 0px rgba(214,214,214,0.6);
border-radius:16px;
background: #fff;
margin:120rpx auto 40rpx;
padding:18rpx 49rpx 18rpx;
box-sizing: border-box
}
.explain_one{
text-align: center;
font-size:30rpx;
font-family:PingFang-SC-Heavy;
font-weight:800;
color:rgba(38,54,58,1);
line-height:62rpx;
position: relative;
margin-bottom:16rpx;
}
.explain_one::before{
width: 115rpx;
height: 1rpx;
position: absolute;
left:70rpx;
top:0;
bottom:0;
margin:auto 0;
content: '';
background: linear-gradient(to left,rgba(187,187,187,1),transparent);
}
.explain_one::after{
width: 115rpx;
height: 1rpx;
position: absolute;
right:70rpx;
top:0;
bottom:0;
margin:auto 0;
content: '';
background: linear-gradient(to right,rgba(187,187,187,1),transparent);
}
.explain_two{
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(38,54,58,1);
line-height: 40rpx;
}
.three{
width: 100%;
padding:0 15rpx;
}
.collocation_boxa {
width: 360rpx;
border-radius: 16rpx;
overflow: hidden;
float: left;
padding:0 10rpx;
position: relative
}
.collocation_img {
width: 340rpx;
height: 340rpx;
}
.collocation_img image {
width: 100%;
height: 100%;
}
.introducea {
font-size: 28rpx;
color: #888;
}
.icon-weixuanzhong{
position: absolute;
right:20rpx;
top:15rpx;
color:#888;
}
.icon-weixuanzhong.active{
color:rgba(255,218,68,1);
}
/*购物车添加状态*/
.cart_mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
z-index: 9999999;
}
.cart_mask_diceng {
width: 80%;
/* min-height: 550rpx; */
position: absolute;
top: 50%;
margin-left: 10%;
transform: translateY(-50%);
background: rgba(255, 255, 255, 1);
border-radius: 10px;
padding-top: 20rpx;
padding-bottom: 130rpx;
}
.goods_name {
font-size: 30rpx;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: rgba(51, 51, 51, 1);
line-height: 36rpx;
text-align: center;
margin-top: 30rpx;
}
.weight {
height: 100rpx;
margin-top: 34rpx;
/* margin-bottom:44rpx; */
padding: 0 47rpx 0 36rpx;
box-sizing: border-box;
}
.weight_view {
font-size: 26rpx;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(51, 51, 51, 1);
line-height: 36rpx;
}
.quality {
margin-top: 24rpx;
}
.quality_left {
width: 150rpx;
height: 50rpx;
margin-bottom: 20rpx;
background: rgba(247, 247, 247, 1);
border-radius: 10rpx;
text-align: center;
line-height: 50rpx;
font-size: 26rpx;
font-family: FZY3JW--GB1-0;
font-weight: 400;
color: rgba(26, 26, 26, 1);
float: left;
margin-right: 20rpx;
}
.quality_left.active {
background: rgba(255, 218, 68, 1);
}
.last_box {
width: 100%;
height: 110rpx;
background: rgba(247, 247, 247, 1);
border-radius: 0px 0px 10px 10px;
margin-top: 100rpx;
padding: 18rpx 0 0 51rpx;
box-sizing: border-box;
position: absolute;
bottom: 0;
}
.last_box_top_price text {
color: #333;
font-size: 18rpx;
margin-left: 10rpx;
}
.member_price {
/* color: rgba(187, 138, 54, 1); */
color: #26363a;
}
.member {
text-align: center;
font-family: PingFang-SC-Medium;
margin-left: 24rpx;
background: linear-gradient(-90deg, rgba(244, 243, 200, 1), rgba(250, 216, 90, 1));
border-radius: 5px;
color: rgba(187, 138, 54, 1);
padding: 4rpx -2rpx;
box-sizing: border-box;
/* margin-top:8rpx; */
font-size: 18rpx;
font-weight: 400;
}
.purchase {
width: 160rpx;
height: 50rpx;
background: rgba(255, 218, 68, 1);
border-radius: 25rpx;
font-size: 24rpx;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(26, 26, 26, 1);
line-height: 50rpx;
text-align: center;
position: absolute;
right: 36rpx;
top: 30rpx;
}
.jiajian {
width: 120rpx;
height: 50rpx;
position: absolute;
right: 200rpx;
top: 40rpx;
display: flex;
justify-content: space-between;
}
.dec_num {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
background: #ffda44;
font-size: 32rpx;
color: #fff;
font-weight: bold;
text-align: center;
line-height: 32rpx;
}
.numnum {
width: 32rpx;
height: 32rpx;
text-align: center;
line-height: 32rpx;
font-size: 30rpx;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(102, 102, 102, 1);
}
.close_jump_cart {
position: absolute;
top: 24rpx;
right: 24rpx;
color: #ededed;
font-size: 36rpx;
}
.pickage_display {
font-size: 24rpx;
color: #f44;
margin-top: 47rpx;
}
.money_icon2 {
font-size: 22rpx;
color: #f44;
}
.money2 {
font-size: 38rpx;
font-weight: bold;
color: #f44;
}
\ No newline at end of file
... ...
// pages/index/goodsDetial/goodsDetial.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
imgUrl: app.globalData.imgUrl,
shoucang: false,
active: true,
show: false,
shows: false,
id: 0,
goods: [],
ids: [],
idss: [],
status: 0,
cart_count: 0,
skuid: '',
num: 1,
id_arr: [],
gPrice: 0,
collocation: [],
goods_star: 1,
star_arr: [],
commentCount: 0,
favorite: 0,
totalPrice: 0,
is_group: 0,
day: 0,
hour: 0,
minute: 0,
second: 0,
skuid_arr: [],
skuid_price: 0,
old_skuid_price: 0,
vip_skuid_price: 0,
yyhTop: 0,
basicInfo: false,
one: 11,
two: 22,
statestatus: 0,
groupList: [],
yesno: false,
stock:0,
is_vip:0
},
//进入基本参数
jumpBasicInfo() {
this.setData({
basicInfo: true
})
},
//进入评论列表
jump_user_comment(e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '../user_comment/user_comment?id=' + this.data.id
})
},
//跳转至建议搭配商品详情
jump_collocation_detail(e) {
let id = e.currentTarget.dataset.jid;
console.log(id)
this.setData({
id: id
})
wx.pageScrollTo({
scrollTop: 0,
duration:0
})
this.fetchGoods()
},
//减少数量
dec_num() {
var num = this.data.num;
if (num <= 1) {
return;
} else {
num--
}
this.setData({
num: num
});
this.totalPrice()
},
//增加数量
add_num() {
var num = this.data.num;
num++
this.setData({
num: num
});
this.totalPrice();
},
//总价格
totalPrice() {
var that = this
var total = that.data.goods.info.price * that.data.num
that.setData({
totalPrice: total
})
},
//点击收藏
collection_true(e) {
let id = e.currentTarget.dataset.id
let that = this
let url = '/wxapp/product/setFavorites?id=' + id
let params = {
id: id
}
app.post(url).then(r => {
if (r.code == 1) {
wx.showToast({
title: r.msg,
icon: 'none'
})
that.fetchGoods();
}
})
},
//促销进商品详情
jump_goodsDetial2(e) {
wx.navigateTo({
url: '../goodsDetial2/goodsDetial2?id=' + e.currentTarget.dataset.id
})
},
//加购筛选
changeIds(e) {
let t = this;
let goods = t.data.goods;
let new_arr = t.data.skuid_arr;
let listAll = t.data.goods.attr.attr_sku;
let list = listAll[e.currentTarget.dataset.parent].item;
let x = e.currentTarget.dataset.index;
let stock=0
// 当前点击Id
let nowId = e.currentTarget.dataset.gid;
//当前点击value
let nowValue = e.currentTarget.dataset.item;
// 父级索引
let parent = e.currentTarget.dataset.parent;
// 子集索引
let nowIndex = e.currentTarget.dataset.index;
// 当前可否多选
let is_checkMore = false
let foo = new_arr.indexOf(nowId)
if (foo > -1) {
new_arr.splice(foo, 1)
} else {
goods.attr.attr_sku.forEach(function(ele, indexxxx) {
if (indexxxx == parent) {
for (let i = 0; i < ele.item.length; i++) {
let havId = goods.attr.attr_sku[indexxxx].item[i].id
let have = new_arr.indexOf(havId)
if (have > -1) {
new_arr.splice(have, 1)
}
}
}
})
}
// 当前点击父级值
let tempArry = JSON.parse(JSON.stringify(this.data.goods.attr.attr_sku[parent]));
// let tempArry=this.data.goods.attr.attr_sku[parent]
!tempArry.chooseIndex ? tempArry.chooseIndex = [] : '';
!tempArry.chooseValue ? tempArry.chooseValue = [] : '';
// 是否多选
if (is_checkMore) {} else {
tempArry.chooseValue.pop();
tempArry.chooseValue.push(nowValue);
tempArry.chooseIndex.pop();
tempArry.chooseIndex.push(nowId);
for (let obj of tempArry.item) {
obj.t = false
}
tempArry.item[nowIndex].t = true;
}
t.data.goods.attr.attr_sku[parent] = tempArry;
t.setData({
goods: t.data.goods
})
// let goods = t.data.goods;
let sys_attrprice = goods.sys_attrprice;
// let new_arr = [];
let new_arr_item = [];
let str = ''
let skuid = 0
let skuid_price = 0
let old_skuid_price = 0
let vip_skuid_price = 0
goods.attr.attr_sku.forEach(function(ele, indexx) {
if (indexx == parent) {
new_arr = new_arr.concat(ele.chooseIndex);
}
})
new_arr = new_arr.sort()
str = new_arr.join('_');
new_arr_item = new_arr_item.join(',');
new_arr_item = new_arr_item.replace(/,/g, " ");
for (let i in sys_attrprice) {
if (i == str) {
skuid = sys_attrprice[i].skuid
skuid_price = sys_attrprice[i].price
old_skuid_price = sys_attrprice[i].old_price
vip_skuid_price = sys_attrprice[i].vip_price
stock = sys_attrprice[i].stock
}
}
this.setData({
id_arr: new_arr,
idss: new_arr,
skuid: skuid,
skuid_price: skuid_price,
old_skuid_price: old_skuid_price,
vip_skuid_price: vip_skuid_price,
skuid_arr: new_arr,
ids: new_arr_item,
stock:stock
});
},
//关闭弹窗
close_mask_cart() {
this.setData({
show: false
});
},
close_mask_info() {
this.setData({
basicInfo: false
});
},
close_mask_carts() {
this.setData({
shows: false
});
},
//点击我知道了
iKnow() {
this.setData({
basicInfo: false
});
},
//去结算
get_settle() {
if (isNaN(this.data.minute)) {
wx.showToast({
title: '活动已经结束',
icon: 'none'
})
return;
} else {
this.setData({
shows: true
});
}
},
//渲染是不是会员
fetchUser(){
let url = '/wxapp/user/index'
let that=this
app.post(url).then(res=>{
if(res.code==1){
that.setData({
is_vip:res.data.user.is_vip
})
that.fetchGoods()
}
})
},
//根据id获取内容
fetchGoods() {
let url = '/wxapp/product/getProductInfo';
// let goods_star=1;
let params = {
id: this.data.id
};
let that = this
app.post(url, params).then(r => {
console.log(r);
for (let i = 0; i < r.data.attr.attr_sku.length; i++) {
for (let x = 0; x < r.data.attr.attr_sku[i].item.length; x++) {
r.data.attr.attr_sku[i].item[x].t = false;
}
}
let comment = r.data.comment
comment.forEach(function(ele, index) {
ele.stars_arr = []
for (let i = 1; i < ele.goods_stars + 1; i++) {
ele.stars_arr.push(i);
}
})
let arr = []
let skuid = 0
let skuid_price = 0
let old_skuid_price = 0
let vip_skuid_price = 0
r.data.attr.attr_sku.forEach(function(ele, index) {
ele.item[0].t = true;
arr.push(ele.item[0].id)
})
arr = arr.sort()
let str = arr.join('_');
let sys_attrprice = r.data.sys_attrprice
for (let i in sys_attrprice) {
if (i == str) {
skuid = sys_attrprice[i].skuid
skuid_price = sys_attrprice[i].price
old_skuid_price = sys_attrprice[i].old_price
vip_skuid_price = sys_attrprice[i].vip_price
}
}
r.data.comment.forEach(function(ele, index) {
that.setData({
goods_star: ele.goods_stars
})
});
r.data.comment.forEach(function(ele, index) {
ele.create_time = app.timeFormate(ele.create_time, 'YYMMDD');
});
var zuihoujiage = ''
if (that.data.is_vip == 1) {
zuihoujiage = r.data.info.vip_price
} else {
zuihoujiage = r.data.info.price
}
console.log(zuihoujiage)
if (r.data.groupType) {
console.log('团购')
var days = ''
var hours = ''
var minutes = ''
var seconds = ''
var percent = 0
function time() {
var cut_time = r.data.groupType.count_down_time
days = Math.floor((cut_time) / (60 * 60 * 24));
hours = Math.floor((cut_time) / (60 * 60)) % 24;
minutes = Math.floor((cut_time) / (60)) % 60;
seconds = cut_time % 60;
percent = Math.floor(r.data.info.group_number * 100 / r.data.info.group_min_number)
}
time();
setInterval(time, 1000);
that.setData({
day: days,
hour: hours,
minute: minutes,
second: seconds,
percent: percent,
goods: r.data,
gPrice: zuihoujiage,
collocation: r.data.collocation,
comment: r.data.comment,
// star_arr: star_arr,
skuid: skuid,
is_group: r.data.info.group_min_number,
id_arr: arr,
skuid_arr: arr,
yesno: true
});
} else {
console.log("不是团购")
that.setData({
yesno: false,
goods: r.data,
gPrice: zuihoujiage,
collocation: r.data.collocation,
comment: r.data.comment,
// star_arr: star_arr,
favorite: r.data.is_favorite,
skuid_price: skuid_price,
old_skuid_price: old_skuid_price,
vip_skuid_price: vip_skuid_price,
skuid: skuid,
skuid_arr: arr,
id_arr: arr
});
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
var that = this
// var query = wx.createSelectorQuery();
// var offset = query.select('.itme_list5');
// var yyh = query.select('#yyh');
// var top=0
// yyh.boundingClientRect(function(res){
// top=res.top
// that.setData({
// yyhTop: top
// });
// }).exec()
that.setData({
id: options.id,
})
this.fetchUser()
},
// 返回上一页
get_back() {
wx.navigateBack({})
},
// 跳转图文食谱
get_recipe(){
get_recipe() {
wx.navigateTo({
url: '../production_steps/production_steps',
url: '../production_steps/production_steps?id=' + this.data.id,
})
},
// 跳转购物车
get_car() {
wx.switchTab({
url: '/pages/cart/cart'
this.setData({
show: true
});
},
//隐藏mask
hide_mask(e) {
var that = this
if (that.data.skuid != '') {
that.setData({
show: false
});
let url = '/wxapp/cart/addCart'
let params = {
skuid: that.data.skuid,
num: that.data.num
}
if(that.data.stock>0){
if (that.data.num <= e.currentTarget.dataset.limit || e.currentTarget.dataset.limit == 0) {
app.post(url, params).then(r => {
if (r.code == 1) {
wx.showToast({
title: '成功加入购物车',
icon: 'none'
})
that.fetchGoods();
} else {
wx.showToast({
title: r.msg,
icon: 'none'
})
}
});
} else {
wx.showToast({
title: '限购' + e.currentTarget.dataset.limit + '件',
icon: 'none'
})
return;
}
}else{
wx.showToast({
title: '已经售罄',
icon:'none'
})
}
} else {
console.log(that.data.skuid + "shangpinzuhe")
wx.showToast({
title: '请先选择商品属性组合',
icon: 'none'
})
}
},
hide_masks() {
var that = this
var minimum=that.data.goods.minimum_price
var pp=that.data.gPrice
console.log(pp)
pp = Math.round(pp)
console.log(pp)
var gPrice = that.data.num * pp
console.log(gPrice)
if (that.data.skuid != '') {
that.setData({
shows: false
});
var str = ''
str = that.data.id_arr.join(',');
if(gPrice>=minimum){
if (that.data.stock > 0) {
if (that.data.goods.info.limit_numer == that.data.num || that.data.goods.info.limit_numer == 0) {
if (that.data.id_arr.length > 1) {
if (that.data.is_group == 0) {
wx.navigateTo({
url: '../../my/settle_account/settle_account?ids=' + that.data.skuid + '&gid=' + that.data.id + '&num=' + that.data.num + '&gPrice=' + gPrice
})
} else {
wx.navigateTo({
url: '../../my/settle_account/settle_account?ids=' + that.data.skuid + '&gid=' + that.data.id + '&num=' + that.data.num + '&gPrice=' + gPrice + '&is_group=' + that.data.is_group
})
}
}
} else {
wx.showToast({
title: '限购' + that.data.goods.info.limit_numer + '件',
icon: 'none'
})
return;
}
} else {
wx.showToast({
title: '已经售罄',
icon: 'none'
})
return;
}
}else{
wx.showToast({
title: '商品实付'+minimum+'元起送',
icon:'none'
})
}
} else {
wx.showToast({
title: '请先选择商品属性组合',
icon: 'none'
})
}
},
//attr选择规格
chooseStandard() {
this.setData({
show: true
});
},
//跳至图文详情
jump_detail() {
this.setData({
active: false,
statestatus: 22
});
let top = this.data.yyhTop
// wx.pageScrollTo({
// scrollTop: top,
// duration: 300
// })
},
jump_goods() {
this.setData({
active: true,
statestatus: 11
});
// wx.pageScrollTo({
// scrollTop: 0,
// duration: 300
// })
},
//收藏
collection() {
this.setData({
shoucang: !this.data.shoucang
});
},
/**
... ... @@ -41,7 +570,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.fetchUser()
},
/**
... ... @@ -76,6 +605,10 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function() {
return {
path: '/pages/start/start?share_id=' + app.globalData.user_id,
imgUrl: '',
title: ''
}
}
})
\ No newline at end of file
... ...