作者 lihongjuan

1

正在显示 75 个修改的文件 包含 4827 行增加0 行删除

要显示太多修改。

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

//app.js
App({
onLaunch: function() {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
//封装公共接口
post: function(url, data, headerParams) {
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data;
let baseUrl = 'https://buygive.w.broing.cn/api/';
//网络请求
let header = {
// 'XX-Device-Type': 'wxapp',
'token': wx.getStorageSync("token") || ''
}
header = Object.assign(header, headerParams)
//网络请求
wx.request({
url: baseUrl + url,
data: postData,
method: headerParams,
header: header,
success: function(res) { //返回取得的数据
if (res.data.code == '1') {
resolve(res.data.data);
} else {
reject(res.data)
}
},
fail: function(e) {
reject('网络出错');
// wx.hideLoading()
wx.hideNavigationBarLoading()
},
complete: function() {
wx.hideNavigationBarLoading()
},
})
});
return promise;
},
//上传图片
// upload(filetype, file) {
// let token = wx.getStorageSync('token');
// console.log(token)
// var promise = new Promise((resolve, reject) => {
// wx.showNavigationBarLoading()
// wx.showLoading({
// title: '上传中',
// })
// let url = 'http://buygive.w.brotop.cn/api/common/upload';
// let head = {
// 'XX-Token': wx.getStorageSync('token'),
// 'XX-Device-Type': 'wxapp'
// }
// let typename = {
// filetype: filetype
// }
// wx.uploadFile({
// url: url, //仅为示例,非真实的接口地址
// filePath: file,
// name: 'file',
// header: head,
// formData: typename,
// success: function (res) {
// console.log('上传文件后', res)
// let temdata = JSON.parse(res.data);
// console.log(temdata)
// let urlobj = {
// url: temdata.data.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;
// },
upload(filetype, file) {
var promise = new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
wx.showLoading({
title: '上传中',
})
let url = 'https://buygive.w.broing.cn/api/common/upload';
let head = {
'token': wx.getStorageSync('token'),
'XX-Device-Type': ''
}
let typename = {
filetype: filetype
}
wx.uploadFile({
url: url, //仅为示例,非真实的接口地址
filePath: file,
name: 'file',
header: head,
formData: typename,
success: function (res) {
console.log('上传文件后', res)
let temdata = JSON.parse(res.data);
console.log(temdata)
let urlobj = {
aburl: temdata.data.absolute_url,
url: temdata.data.relative_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;
},
globalData: {
userInfo: null
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/homepage/homepage",
"pages/login/login",
"pages/cart/cart",
"pages/orderbox/orderbox",
"pages/goodevalute/goodevalute",
"pages/addaddress/addaddress",
"pages/dizhibox/dizhibox",
"pages/message/message",
"pages/mine/mine",
"pages/goodtail/goodtail",
"pages/orderdetail/orderdetail",
"pages/sureorder/sureorder",
"pages/searchbox/searchbox",
"pages/goodkind/goodkind",
"pages/index/index",
"pages/logs/logs",
"pages/giftdetail/giftdetail"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
},
"sitemapLocation": "sitemap.json",
"tabBar": {
"selectedColor": "#FF5A4E",
"list": [
{
"pagePath": "pages/homepage/homepage",
"text": "首页",
"selectedColor": "#FF5A4E",
"iconPath": "img/shou.png",
"selectedIconPath": "img/shouactive.png"
},
{
"pagePath": "pages/goodkind/goodkind",
"text": "分类",
"selectedColor": "#FF5A4E",
"iconPath": "img/kind.png",
"selectedIconPath": "img/kindactive.png"
},
{
"pagePath": "pages/cart/cart",
"text": "购物车",
"selectedColor": "#FF5A4E",
"iconPath": "img/cart.png",
"selectedIconPath": "img/cartactive.png"
},
{
"pagePath": "pages/mine/mine",
"text": "会员中心",
"selectedColor": "#FF5A4E",
"iconPath": "img/huiyuan.png",
"selectedIconPath": "img/huiyaunactive.png"
}
]
}
}
\ No newline at end of file
... ...
/**app.wxss**/
page {
background: #fff;
}
.searchboxleft {
width: 40rpx;
height: 40rpx;
font-size: 0;
}
.searchboxleft image {
width: 100%;
height: 100%;
}
.xiename {
display: flex;
align-items: center;
margin-top: 24rpx;
}
.xienameleft {
width: 52rpx;
height: 28rpx;
font-size: 0;
}
.xienameleft image {
width: 100%;
height: 100%;
}
.goodname {
color: #06121e;
font-size: 28rpx;
margin-left: 15rpx;
}
.register {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 5;
}
.registerk {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.2);
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 5;
}
.nodata {
color: #999;
font-size: 32rpx;
text-align: center;
margin-top: 100rpx;
}
.flex {
display: flex;
}
.flexone {
display: flex;
align-items: center;
}
.flextwo {
display: flex;
align-items: center;
justify-content: space-between;
}
.flexthree {
display: flex;
align-items: center;
justify-content: center;
}
.flexfour {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
... ...

317 字节

648 字节

673 字节

911 字节

780 字节

857 字节

211 字节

845 字节

636 字节

877 字节

550 字节

922 字节

872 字节

501 字节

919 字节

// pages/addaddress/addaddress.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
name: '',
mobile: '',
province: '',
city: '',
county: '',
addr: '',
region: ['北京市', '北京市', '东城区'],
regionname: '请选择所在地区',
addressid: '',
type:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
console.log(options)
if (options.type == 1) {
wx.setNavigationBarTitle({
title: '新增收货地址' //页面切换,更换页面标题
})
this.setData({
type:options.type
})
} else {
this.setData({
addressid: options.id,
type: options.type
})
wx.setNavigationBarTitle({
title: '编辑收货地址' //页面切换,更换页面标题
})
this.getaddresstail()
}
console.log(this.data.type)
},
//获取收货地址详情
getaddresstail() {
let that = this;
var url = 'take/get_one';
var params = {
take_id: that.data.addressid,
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
name: res.name,
mobile: res.mobile,
province: res.province,
city: res.city,
county: res.county,
addr: res.addr,
regionname: res.province + res.city + res.county,
})
console.log(that.data.name)
}).catch((err) => {
})
},
entershouhuo(e) {
this.setData({
name: e.detail.value
})
},
enterphone(e) {
this.setData({
mobile: e.detail.value
})
},
enteraddress(e) {
this.setData({
addr: e.detail.value
})
},
bindRegionChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({
region: e.detail.value,
regionname: e.detail.value[0] + e.detail.value[1] + e.detail.value[2],
province: e.detail.value[0],
city: e.detail.value[1],
county: e.detail.value[2]
})
},
addsave() {
let that = this;
console.log(that.data.regionname)
if (that.data.name == '') {
wx.showToast({
title: '请填写收货人',
icon: 'none'
})
return false
}
if (that.data.mobile == '') {
wx.showToast({
title: '请填写手机号',
icon: "none"
})
return false
}
if (that.data.mobile != '') {
var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
if (!reg.test(that.data.mobile)) {
wx.showToast({
title: '请输入正确的手机号',
icon: "none"
})
return false
}
}
if (that.data.regionname == '请选择所在地区') {
wx.showToast({
title: '请选择所在地区',
icon: "none"
})
return false
}
if (that.data.addr == '') {
wx.showToast({
title: '请输入详细地址',
icon: 'none'
})
return false
}
var url = 'take/create_take';
var params = {
name: that.data.name,
mobile: that.data.mobile,
province: that.data.province,
city: that.data.city,
county: that.data.county,
addr: that.data.addr
}
app.post(url, params).then((res) => {
console.log(res);
wx.showToast({
title: '新增收货地址成功',
icon: 'none'
})
setTimeout(function() {
// wx.navigateTo({
// url: '/pages/dizhibox/dizhibox',
// })
wx.redirectTo({
url: '/pages/dizhibox/dizhibox?addrestype=' + 1,
})
}, 1000)
}).catch((err) => {
})
},
editsave() {
let that = this;
console.log(that.data.regionname)
if (that.data.name == '') {
wx.showToast({
title: '请填写收货人',
icon: 'none'
})
return false
}
if (that.data.mobile == '') {
wx.showToast({
title: '请填写手机号',
icon: "none"
})
return false
}
if (that.data.mobile != '') {
var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
if (!reg.test(that.data.mobile)) {
wx.showToast({
title: '请输入正确的手机号',
icon: "none"
})
return false
}
}
if (that.data.regionname == '请选择所在地区') {
wx.showToast({
title: '请选择所在地区',
icon: "none"
})
return false
}
if (that.data.addr == '') {
wx.showToast({
title: '请输入详细地址',
icon: 'none'
})
return false
}
var url = 'take/update_take';
var params = {
name: that.data.name,
mobile: that.data.mobile,
province: that.data.province,
city: that.data.city,
county: that.data.county,
addr: that.data.addr,
take_id:that.data.addressid
}
app.post(url, params).then((res) => {
console.log(res);
wx.showToast({
title: '保存成功',
icon: 'none'
})
setTimeout(function() {
wx.navigateTo({
url: '/pages/dizhibox/dizhibox',
})
}, 1000)
}).catch((err) => {
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "新增收货地址"
}
\ No newline at end of file
... ...
<view class="addressbox">
<view class="addressboxitem">
<view class="addressboxitemleft">
<view class="addressboxitemleftname">收货人</view>
<view class="addressenter">
<input placeholder='请输入收货人' placeholder-class='enteradd' bindinput="entershouhuo" value="{{name}}"/>
</view>
</view>
</view>
<view class="addressboxitem">
<view class="addressboxitemleft">
<view class="addressboxitemleftname">手机号码</view>
<view class="addressenter">
<input placeholder='请输入手机号码' placeholder-class='enteradd' bindinput="enterphone" type="number" value="{{mobile}}"/>
</view>
</view>
</view>
<picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
<view class="addressboxitem">
<view class="addressboxitemleft">
<view class="addressboxitemleftname">所在地区</view>
<view class="addressenter">
{{regionname}}
</view>
<!-- <view class="picker">
当前选择:{{region[0]}},{{region[1]}},{{region[2]}}
</view> -->
</view>
<view class="addressright">
<image src="/img/yourow.png"></image>
</view>
</view>
</picker>
<view class="addressboxitem">
<view class="addressboxitemleft">
<view class="addressboxitemleftname">详细地址</view>
<view class="addressenter">
<input placeholder='请输入详细地址' placeholder-class='enteradd' bindinput="enteraddress" value="{{addr}}"/>
</view>
</view>
</view>
</view>
<view class="adddizhibtn" bindtap="addsave" wx:if="{{type==1}}">保存</view>
<view class="adddizhibtn" bindtap="editsave" wx:else>保存</view>
\ No newline at end of file
... ...
page {
background: #f9f9f9;
}
.addressbox {
padding: 0 32rpx;
box-sizing: border-box;
background: #fff;
}
.addressright {
width: 12rpx;
height: 20rpx;
font-size: 0;
}
.addressright image {
width: 100%;
height: 100%;
}
.addressboxitemleftname {
width: 115rpx;
color: #3d444d;
font-size: 28rpx;
}
.addressboxitem {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 0;
box-sizing: border-box;
border-bottom: 1rpx solid #f5f5f5;
}
.addressboxitemleft {
display: flex;
align-items: center;
}
.addressenter {
width: 475rpx;
color: #06121e;
font-size: 28rpx;
margin-left: 40rpx;
}
.addressenter input {
width: 100%;
height: 100%;
}
.enteradd {
color: #06121e;
font-size: 28rpx;
}
.save {
width: 686px;
height: 88px;
background: rgba(255, 90, 78, 1);
opacity: 1;
border-radius: 8px;
}
.adddizhibtn {
width: 686rpx;
height: 88rpx;
background: rgba(255, 90, 78, 1);
opacity: 1;
border-radius: 8rpx;
color: #fff;
font-size: 32rpx;
text-align: center;
line-height: 88rpx;
position: fixed;
bottom:40rpx;
left:24rpx;
}
... ...
// pages/cart/cart.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
delshow: false,
hidedelcart: false,
delalldshow: false,
cartlist: [],
totalmoney: 0,
goodsid: [],
selall: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
manage() {
this.setData({
delalldshow: !this.data.delalldshow
})
},
//获取购物车列表
getcarlist() {
let that = this;
var url = 'car/get_all';
var params = {
token: wx.getStorageSync('token'),
}
app.post(url, params).then((res) => {
console.log(res);
for (var obj of res) {
obj.sel = false
}
that.setData({
cartlist: res
})
}).catch((err) => {
})
},
// 选择购物车
selcart(e) {
console.log(e)
let cartid = e.currentTarget.dataset.id;
console.log(cartid)
let newcartlist = this.data.cartlist;
let newtotalmoney = this.data.totalmoney;
let newgoodsid = this.data.goodsid;
for (var obj of newcartlist) {
if (obj.id == cartid) {
obj.sel = !obj.sel;
if (obj.sel == true) {
newtotalmoney = newtotalmoney + Number(obj.price) * Number(obj.number) + Number(obj.freight)+Number(obj.gift.freight);
newgoodsid.push(obj.id)
} else if (obj.sel == false) {
newtotalmoney = newtotalmoney - Number(obj.price) * Number(obj.number) - Number(obj.freight)-Number(obj.gift.freight);
for (var i = 0; i < newgoodsid.length; i++) {
if (newgoodsid[i] == cartid) {
newgoodsid.splice(i, 1)
}
}
}
}
}
if (newgoodsid.length == newcartlist.length) {
this.setData({
selall: true
})
} else {
this.setData({
selall: false
})
}
this.setData({
cartlist: newcartlist,
totalmoney: newtotalmoney,
goodsid: newgoodsid
})
// console.log(this.data.cartlist);
// console.log(this.data.totalmoney);
// console.log(this.data.goodsid)
},
// 增加数量
addcartnum(e) {
let cartid = e.currentTarget.dataset.id;
let newcartlist = this.data.cartlist;
let newtaotalmoney = this.data.totalmoney;
let newnumber = 0;
let suanmoney = 0
console.log(newtaotalmoney)
for (var obj of newcartlist) {
if (obj.id == cartid) {
obj.number = Number(obj.number) + 1;
if (obj.sel == true) {
newnumber = newnumber + 1
suanmoney = newnumber * Number(obj.price)
console.log(obj.number)
newtaotalmoney = newtaotalmoney + suanmoney
}
}
}
this.setData({
totalmoney: newtaotalmoney,
cartlist: newcartlist
})
let that = this;
var url = 'car/update_car';
var params = {
goods_id: cartid,
type: 1
}
app.post(url, params).then((res) => {
console.log(res);
}).catch((err) => {
})
},
// 减少数量
reducecartnum(e) {
let cartid = e.currentTarget.dataset.id;
let newcartlist = this.data.cartlist;
let newtaotalmoney = this.data.totalmoney;
let newnumber = 0;
let suanmoney = 0
console.log(newtaotalmoney)
for (var obj of newcartlist) {
if (obj.id == cartid) {
if (obj.number > 1) {
obj.number = Number(obj.number) - 1;
if (obj.sel == true) {
newnumber = newnumber + 1
suanmoney = newnumber * Number(obj.price)
console.log(obj.number)
newtaotalmoney = newtaotalmoney - suanmoney
}
} else {
wx.showToast({
title: '不能再减少了',
icon: 'none'
})
obj.number = 1;
}
}
}
this.setData({
totalmoney: newtaotalmoney,
cartlist: newcartlist
})
let that = this;
var url = 'car/update_car';
var params = {
goods_id: cartid,
type: 2
}
app.post(url, params).then((res) => {
console.log(res);
}).catch((err) => {
})
},
// 结算
jiesuan() {
let that = this;
if (that.data.goodsid.length == 0) {
wx.showToast({
title: '请选择商品',
icon: "none"
})
return false
}
var url = 'order/confirm_order';
var params = {
take_id: '',
type: 2,
goods_ids: that.data.goodsid.join(",")
}
app.post(url, params).then((res) => {
console.log(res);
let orderarr = res.goods;
console.log('887766554433', orderarr)
for (var obj of orderarr) {
obj.content = '';
obj.gift.content = ''
}
orderarr = JSON.stringify(orderarr)
let freight = res.freight;
let price = res.price;
let total = res.total
wx.navigateTo({
url: '/pages/sureorder/sureorder?orderarr=' + orderarr + '&freight=' + freight + '&price=' + price + '&total=' + total + '&type=' + 2,
})
}).catch((err) => {
console.log(err);
wx.showToast({
title: err.msg,
icon: 'none'
})
})
},
// 全选
selquan() {
this.setData({
selall: !this.data.selall
})
let newcartlist = this.data.cartlist;
let newgoodsid = []
if (this.data.selall == true) {
for (var obj of newcartlist) {
obj.sel = true
newgoodsid.push(obj.id)
}
} else {
for (var obj of newcartlist) {
obj.sel = false
}
newgoodsid = []
}
this.setData({
cartlist: newcartlist,
goodsid: newgoodsid
})
console.log(this.data.goodsid)
},
delcart() {
let that = this;
if (that.data.goodsid.length == 0) {
wx.showToast({
title: '请选择要删除的商品',
icon: "none"
})
} else {
that.setData({
hidedelcart: true
})
}
},
surecancelcar() {
let that=this;
var url = 'car/delete_car';
var params = {
goods_ids: that.data.goodsid.join(",")
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
delshow:true,
hidedelcart:false,
goodsid:[],
totalmoney:0
})
// wx.showToast({
// title: '删除购物车成功',
// icon: 'none'
// })
setTimeout(function() {
that.setData({
delshow: false,
})
that.getcarlist()
},1000)
}).catch((err) => {
})
},
cancelhidecar(){
this.setData({
hidedelcart: false
})
},
hidedel() {
this.setData({
delshow: false
})
},
hidecart() {
this.setData({
hidedelcart: false
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.setData({
totalmoney: 0,
delalldshow: false,
goodsid:[]
})
this.getcarlist()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "我的购物车"
}
\ No newline at end of file
... ...
<!-- 删除购物车成功 -->
<view class="register" bindtap="hidedel" wx:if="{{delshow}}">
<view class="delwrap">
<view class="delsuccess">
<image src='/img/delsuccess.png'></image>
</view>
<view class="delname">删除成功</view>
</view>
</view>
<!-- 是否删除购物车 -->
<view class="register" wx:if="{{hidedelcart}}" bindtap="hidecart">
<view class="delcartwrap">
<view class="delcatname">确认你已选中的商品删除吗</view>
<view class="delbottom">
<view class="delbottomleft" catchtap='cancelhidecar'>取消</view>
<view class="delbottomright" catchtap='surecancelcar'>确定</view>
</view>
</view>
</view>
<view class="manage" bindtap="manage">
<view class="manageitem">
<view class="manageimg">
<image src="/img/seetingimger.png"></image>
</view>
<view class="guanli" wx:if="{{delalldshow==false}}">管理</view>
<view class="guanli" wx:else>完成</view>
</view>
</view>
<view class="nodata" wx:if="{{cartlist.length==0}}">暂无数据</view>
<view class="cartbox" wx:else>
<view class="cartboxitem" wx:for="{{cartlist}}" wx:key=''>
<view class="xuancar" bindtap="selcart" data-id="{{item.id}}">
<view class="cartboxitemleft" >
<image src="/img/nosel.png" wx:if="{{item.sel==false}}"></image>
<image src="/img/selcart.png" wx:else></image>
</view>
</view>
<view class="cartboxitemright">
<view class="goodkindbox">
<view class='goodkindrightitemleft'>
<view class="goodkindleftimg">
<image src="{{item.image}}"></image>
</view>
<view class="xiename">
<view class="xienameleft">
<image src="/img/good.png"></image>
</view>
<view class="goodname">{{item.goods_name}}</view>
</view>
</view>
<view class="songk">
<image src="/img/send.png"></image>
</view>
<view class='goodkindrightitemleft'>
<view class="goodkindleftimg">
<image src="{{item.gift.image}}"></image>
</view>
<view class="xiename">
<view class="xienameleft">
<image src="/img/zeng.png"></image>
</view>
<view class="goodname">{{item.gift.goods_name}}</view>
</view>
</view>
</view>
<view class="goodkindprice">
<view class="goodkindpriceleft">
¥{{item.price}}
</view>
<view class="goodkindpriceright" wx:if="{{item.freight=='0.00'}}">运费:免运费</view>
<view class="goodkindpriceright" wx:else>运费:{{item.freight}}元</view>
<view class="goodkindpriceright" wx:if="{{item.gift.freight=='0.00'}}">运费:免运费</view>
<view class="goodkindpriceright" wx:else>运费:{{item.gift.freight}}元</view>
</view>
<view class="goodkind">
<view class="goodkindnum">
<view class="goodkindnumleft" bindtap="reducecartnum" data-id="{{item.id}}">
<image src="/img/jian.png"></image>
</view>
<view class="goodnum">{{item.number}}</view>
<view class="goodkindnumleft" bindtap="addcartnum" data-id="{{item.id}}">
<image src="/img/add.png"></image>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="cartbottom" wx:if="{{delalldshow}}">
<view class="cartbottomleft">
<view class="cartbottomleftsel" bindtap="selquan">
<image src="/img/selcart.png" wx:if="{{selall}}"></image>
<image src="/img/nosel.png" wx:else></image>
</view>
<view class="cartbottomleftname">全选</view>
</view>
<view class="cartbottomright" bindtap="delcart">删除</view>
</view>
<view class="cartbottom" wx:else>
<view class="cartbottomleft">
<view class="totalmoney">总计:{{totalmoney}}</view>
</view>
<view class="cartbottomright" bindtap="jiesuan">结算</view>
</view>
\ No newline at end of file
... ...
@import "../goodkind/goodkind.wxss";
page {
background: #f9f9f9;
}
.cartboxitemleft {
width: 32rpx;
height: 32rpx;
font-size: 0;
}
.cartboxitemright {
margin-left: 1rpx;
}
.cartboxitemleft image {
width: 100%;
height: 100%;
}
.cartboxitem {
display: flex;
align-items: center;
padding: 24rpx 18rpx;
box-sizing: border-box;
}
.goodkindleftimg {
width: 284rpx;
height: 284rpx;
font-size: 0;
}
.songk {
width: 42rpx;
height: 42rpx;
font-size: 0;
margin: 126rpx 12rpx 0;
}
.goodkindpriceleft {
font-size: 32rpx;
}
.goodkindpriceright {
font-size: 24rpx;
margin-left: 43rpx;
}
.goodkindnumleft {
width:47rpx;
height: 34rpx;
font-size: 0;
margin: 14rpx;
box-sizing: border-box;
}
.goodkindnumleft image {
width: 100%;
height: 100%;
}
.xuancar{
width:77rpx;
height:200rpx;
}
.goodkind {
display: flex;
justify-content: flex-end;
margin-top:14rpx;
}
.goodkindnum {
display: flex;
align-items: center;
justify-content: flex-end;
background: #f9f9f9;
border:1rpx solid #f9f9f9;
/* justify-content: space-between; */
/* width: 148px;
height: 56px;
background: #F9F9F9; */
}
.goodnum {
width:79rpx;
height:79rpx;
background: #fff;
line-height:79rpx;
text-align: center;
color:26rpx;
font-size: 26rpx;
/* border-top:2rpx solid #f9f9f9;
border-bottom:2rp solid #f9f9f9; */
}
.cartbox{
padding-bottom: 100rpx;
}
.cartboxitem {
background: #fff;
margin-bottom: 24rpx;
}
.cartbottom {
display: flex;
}
.cartbottom {
display: flex;
align-items: center;
position: fixed;
bottom: 0;
left: 0;
background: #fff;
height: 88rpx;
}
.cartbottomleft {
width: 470rpx;
display: flex;
align-items: center;
padding: 28rpx 32rpx;
box-sizing: border-box;
background: #fff;
}
.cartbottomleftsel {
width: 32rpx;
height: 32rpx;
font-size: 0;
}
.cartbottomleftname {
color: #5b5e63;
font-size: 28rpx;
margin-left:24rpx;
}
.cartbottomright {
width: 280rpx;
height: 88rpx;
background: rgba(255, 90, 78, 1);
opacity: 1;
color: #fff;
font-size: 32rpx;
text-align: center;
line-height: 88rpx;
}
/* 删除成功 */
.delwrap {
width: 240rpx;
height: 240rpx;
background: #3a3a3a;
border-radius: 4rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 9999;
}
.delsuccess {
width: 72rpx;
height: 72rpx;
font-size: 0;
margin: 58rpx auto 0;
}
.delsuccess image {
width: 100%;
height: 100%;
}
.delname {
color: #fff;
font-size: 28rpx;
text-align: center;
margin-top: 16rpx;
}
.delcartwrap {
width: 540rpx;
height: 250rpx;
background: rgba(255, 255, 255, 1);
opacity: 1;
border-radius: 16rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.delcatname {
color: #232323;
font-size: 30rpx;
margin-top: 60rpx;
text-align: center;
}
.delbottom {
display: flex;
align-items: center;
justify-content: space-between;
height: 84rpx;
border-top: 1rpx solid #f5f5f5;
margin-top: 62rpx;
}
.delbottomleft {
width: 274rpx;
text-align: center;
border-right: 1rpx solid #f5f5f5;
color: #666;
font-size: 30rpx;
height: 84rpx;
line-height: 84rpx;
}
.delbottomright {
width: 274rpx;
color: #ff5a4e;
font-size: 30rpx;
text-align: center;
height: 84rpx;
line-height: 84rpx;
}
.cartbottomleftsel{
width:32rpx;
height:32rpx;
font-size: 0
}
.cartbottomleftsel image{
width:100%;
height:100%;
}
.manageimg{
width:31rpx;
height:31rpx;
font-size: 0;
}
.manageimg image{
width:100%;
height:100%;
}
.guanli{
color:#BDC4CE;
font-size: 18rpx;
margin-top:4rpx;
}
.manage{
display:flex;
justify-content: flex-end;
padding:12rpx 32rpx;
box-sizing: border-box;
}
.totalmoney{
color:#FF5A4E;
font-size: 30rpx;
font-weight: bold;
}
\ No newline at end of file
... ...
// pages/dizhibox/dizhibox.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
addresslist: [],
deladdress: false,
delid: '',
addrestype: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if (options.addrestype != undefined) {
this.setData({
addrestype: options.addrestype
})
}
this.getaddresslist()
},
//获取收货地址
getaddresslist() {
let that = this;
var url = 'take/get_all';
var params = {
token: wx.getStorageSync('token'),
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
addresslist: res
})
}).catch((err) => {
})
},
adddizhi() {
wx.redirectTo({
url: '/pages/addaddress/addaddress?type=' + 1,
})
},
seladdress(e) {
if (this.data.addrestype == 1) {
let item = e.currentTarget.dataset.item
let pages = getCurrentPages();
// let currPage = pages[pages.length - 1]; //当前页面
let prevPage = pages[pages.length - 2]; //上一个页面
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
prevPage.setData({
addresstext: item,
addresstype: 2
});
wx.navigateBack({
checked: true
})
}
},
// 编辑地址
edit(e) {
console.log(e)
let id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '/pages/addaddress/addaddress?id=' + id + '&type=' + 2,
})
},
//删除地址
deladdress(e) {
let id = e.currentTarget.dataset.id;
this.setData({
delid: id,
deladdress: true
})
},
cancelorder() {
this.setData({
deladdress: false
})
},
suredel() {
let that = this;
var url = 'take/delete_take';
var params = {
take_id: that.data.delid,
}
app.post(url, params).then((res) => {
console.log(res);
wx.showToast({
title: '删除地址成功',
icon: 'none'
})
setTimeout(function() {
that.setData({
deladdress: false
})
that.getaddresslist()
}, 1000)
}).catch((err) => {
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "收货地址"
}
\ No newline at end of file
... ...
<view class="register" wx:if="{{deladdress}}">
<view class="delwrap">
<view class="delwrd">是否删除该地址</view>
<view class="delbottom">
<view class="delbottomleft" bindtap="cancelorder">取消</view>
<view class="delbottomright" bindtap="suredel">确定</view>
</view>
</view>
</view>
<view class='shouhuobox'>
<view class="shouhuoboxitem" wx:for="{{addresslist}}" wx:key="" bindtap="seladdress" data-item="{{item}}">
<view class="shouhuoitemtop">
<view class="addleft">
<view class="shouhuoitemtopleft">{{item.name}}</view>
<view class="shouhuoitemphone">{{item.mobile}}</view>
</view>
<view class="shouitemright" catchtap="edit" data-id="{{item.id}}">
<image src="/img/addedit.png"></image>
</view>
</view>
<view class="dizhi">
<view class="shouhuoaddress">{{item.province}} {{item.city}} {{item.addr}}</view>
<view class="delimg" catchtap="deladdress" data-id="{{item.id}}">
<image src="/img/deladdress.png"></image>
</view>
</view>
</view>
</view>
<view class="adddizhi" bindtap="adddizhi">
<view class="adddizhibtn">添加收货地址</view>
</view>
\ No newline at end of file
... ...
.shouhuobox{
padding-bottom: 150rpx;
}
.addleft{
display:flex;
align-items: center;
}
.shouhuoboxitem {
padding: 24rpx 38rpx;
box-sizing: border-box;
border-top: 24rpx solid #f9f9f9;
/* display: flex;
justify-content: space-between;
align-items: center; */
}
.shouhuoitemtop {
width:100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.shouhuoitemtopleft {
color: #232323;
font-size: 32rpx;
}
.shouhuoitemphone {
color: #bdc4ce;
font-size: 24rpx;
margin-left: 14rpx;
}
.shouhuoaddress {
width:600rpx;
overflow: hidden;
text-overflow: ellipsis;
color: #3d444d;
font-size: 24rpx;
margin-top: 20rpx;
}
.shouitemright {
width: 18rpx;
height: 18rpx;
font-size: 0;
margin-right:9rpx;
}
.shouitemright image {
width: 100%;
height: 100%;
}
.adddizhi {
height: 128rpx;
background: #fff;
width: 750rpx;
position: fixed;
bottom: 0;
left: 0;
}
.adddizhibtn {
width: 686rpx;
height: 88rpx;
background: rgba(255, 90, 78, 1);
opacity: 1;
border-radius: 8rpx;
color:#fff;
font-size: 32rpx;
text-align: center;
line-height: 88rpx;
margin:0 auto;
}
.dizhi{
display:flex;
align-items: center;
justify-content: space-between
}
.delimg{
width:33rpx;
height:33rpx;
font-size: 0;
}
.delimg image{
width:100%;
height:100%;
}
.delwrap{
width:600rpx;
height:300rpx;
position: absolute;
left:50%;
top:50%;
transform: translate(-50%,-50%);
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
box-sizing: border-box
}
.delwrd{
color:#5B5E63;
font-size: 32rpx;
font-weight: bold;
text-align: center;
}
.delbottom{
display:flex;
align-items: center;
justify-content: space-between;
margin-top:100rpx;
}
.delbottomleft{
width:200rpx;
height:80rpx;
border-radius: 44rpx;
border:1rpx solid #8C9198;
color:#5B5E63;
font-size: 30rpx;
text-align: center;
line-height: 80rpx;
}
.delbottomright{
width:200rpx;
height:80rpx;
border-radius: 44rpx;
background: #FF5A4E;
color:#fff;
font-size: 30rpx;
text-align: center;
line-height: 80rpx;
}
\ No newline at end of file
... ...
// pages/goodtail/goodtail.js
var WxParse = require('../../wxParse/wxParse.js');
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
imgUrls: [
],
indicatorDots: false,
autoplay: false,
interval: 2000,
duration: 1000,
currentSwiper: 0,
ping: 1,
goodid: '',
goodtail: '',
page: 1,
commentlist: [],
totalping:0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
goodid: options.goodid
})
this.getgoodtail();
},
getgoodtail() {
let that = this;
var url = 'goods/get_one';
var params = {
goods_id: that.data.goodid,
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
imgUrls: res.gift.images,
goodtail: res
})
this.getgoodcomment()
WxParse.wxParse('article', 'html', res.gift.content, that, 5);
}).catch((err) => {
})
},
//获取商品评论
getgoodcomment() {
let that = this;
var url = 'comment/get_all';
var params = {
goods_id: that.data.goodtail.gift.id,
page: that.data.page,
pageNum: 10
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
commentlist: that.data.commentlist.concat(res.data),
totalping:res.total
})
}).catch((err) => {
})
},
swiperChange: function (e) {
this.setData({
currentSwiper: e.detail.current
})
},
comment(e) {
this.setData({
ping: e.currentTarget.dataset.id
})
if (this.data.ping == 1) {
this.getgoodtail()
} else {
this.setData({
page: 1,
commentlist: []
})
this.getgoodcomment()
}
},
//商品详情页
gogood(){
wx.redirectTo({
url: '/pages/goodtail/goodtail?goodid='+this.data.goodid,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let newpage = this.data.page;
newpage++;
this.setData({
page: newpage
})
this.getgoodcomment()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "商品详情"
}
\ No newline at end of file
... ...
<import src="../../wxParse/wxParse.wxml" />
<!-- 转换箭头 -->
<view class="zhuanhuan" bindtap="gogood">
<image src="/img/jump.png"></image>
</view>
<view class="swiper_image">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange" circular="true">
<block wx:for="{{imgUrls}}" wx:key="doct">
<swiper-item>
<image src="{{item}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" />
</swiper-item>
</block>
</swiper>
<view class="bannerdot">
<text>{{currentSwiper+1}}</text>/
<text>{{imgUrls.length}}</text>
</view>
<!-- <view class="dots">
<block wx:for="{{imgUrls}}" wx:key="">
<view class="dot{{index == currentSwiper ? ' active' : ''}}"></view>
</block>
</view> -->
</view>
<view class="goodname">
<view class="boxgoodrightop">
<view class="boxgoodrigtl">
<image src="/img/zeng.png"></image>
</view>
{{goodtail.gift.goods_name}}
</view>
<view class="goodprice">
<!-- <view class="goodpriceleft">¥{{goodtail.gift.price}}</view> -->
<view class="goodpriceright" wx:if="{{goodtail.gift.freight=='0.00'}}">运费:免运费</view>
<view class="goodpriceright" wx:else>运费:{{goodtail.gift.freight}}元</view>
</view>
</view>
<!--商品 -->
<view class="zenggood" bindtap="gogood">
<view class="zenggoodleft">
<image src='{{goodtail.image}}'></image>
</view>
<view class="zengright">
<view class="boxgoodrightop zengname">
<view class="boxgoodrigtl">
<image src="/img/good.png"></image>
</view>
{{goodtail.goods_name}}
</view>
</view>
</view>
<!-- 详情和评论 -->
<view class="pingxiang">
<view class="pingxiangitem {{ping==1?'pingzctive':''}} " data-id="1" bindtap="comment">详情</view>
<view class="pingxiangitem {{ping==2?'pingzctive':''}}" data-id="2" bindtap="comment">评论({{totalping}})</view>
</view>
<view class="pingdetail" wx:if="{{ping==1}}">
<template is="wxParse" data="{{wxParseData:article.nodes}}" />
<!-- <view class="pingdetailimg">
<image src="/img/changtu.png"></image>
</view> -->
</view>
<view class='commentdetail' wx:else>
<view class="nodata" wx:if="{{commentlist.length==0}}">暂无评论</view>
<view wx:else>
<view class="commentitem" wx:for="{{commentlist}}" wx:key="">
<view class="commentitemtop">
<view class="commentleft">
<view class="commentitemleft">
<image src="{{item.avatar}}"></image>
</view>
<view class="commentitemright">{{item.nickname}}</view>
</view>
<view class="commentright">{{item.createtime}}</view>
</view>
<view class="commenttext">
{{item.content}}
</view>
<view class="pingfen">
<view class="pingfenleft">
<view class="pingfenitem">
<image src="{{item.star>=1?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
<view class="pingfenitem">
<image src="{{item.star>=2?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
<view class="pingfenitem">
<image src="{{item.star>=3?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
<view class="pingfenitem">
<image src="{{item.star>=4?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
<view class="pingfenitem">
<image src="{{item.star>=5?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
</view>
<view class="pingfenname">{{item.star}}分</view>
</view>
<view class="pingimg">
<view class="pingimgitem" wx:for="{{item.images}}" wx:key="">
<image src="{{item}}"></image>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
.swiper_image {
width: 750rpx;
height: 600rpx;
font-size: 0;
position: relative;
box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11);
border-radius: 10px;
}
.swiper_item_img {
height: 600rpx;
}
.swiper_image image {
width: 100%;
height: 100%;
/* box-shadow:0px -1px 6px 0px rgba(212,137,96,0.11); */
}
.swiper_item_img swiper-item {
width: 750rpx;
height: 600rpx;
box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11);
display: felx;
align-items: center;
justify-content: center;
}
.swiper_item_img swiper-item image {
width: 100%;
height: 100%;
}
.bannerdot {
width: 84rpx;
height: 44rpx;
background: rgba(0, 0, 0, 0.2);
opacity: 1;
border-radius: 20rpx;
color: #fff;
font-size: 30rpx;
text-align: center;
position: absolute;
bottom: 24rpx;
right: 28rpx;
}
.boxgoodrightop {
color: #06121e;
font-size: 28rpx;
font-weight: bold;
position: relative;
padding-left: 64rpx;
box-sizing: border-box;
}
.boxgoodrigtl {
width: 52rpx;
height: 28rpx;
font-size: 0;
position: absolute;
top: 6rpx;
left: 0;
}
.boxgoodrigtl image {
width: 100%;
height: 100%;
}
.orderdetailboxgood {
display: flex;
}
.boxgoodright {
margin-left: 24rpx;
}
.boxgoodrigbot {
display: flex;
align-items: center;
margin-top: 66rpx;
}
.boxgoodrmoney {
color: #ea322b;
font-size: 32rpx;
}
.boxgoodnum {
color: #3d444d;
font-size: 24rpx;
margin-left: 16rpx;
}
.goodname {
padding: 38rpx 32rpx;
box-sizing: border-box;
border-bottom: 24rpx solid #f5f5f5;
}
.goodprice {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 15rpx;
}
.goodpriceleft {
color: #ea322b;
font-size: 36rpx;
}
.goodpriceright {
color: #3d444d;
font-size: 28rpx;
}
.zenggood {
display: flex;
padding: 28rpx;
box-sizing: border-box;
border-bottom: 24rpx solid #f9f9f9;
}
.zenggoodleft {
width: 144rpx;
height: 144rpx;
font-size: 0;
}
.zenggoodleft image {
width: 100%;
height: 100%;
}
.zengname {
color: #5b5e63;
font-size: 24rpx;
width: 522rpx;
margin-left: 28rpx;
}
.pingxiang {
display: flex;
align-items: center;
padding: 24rpx 36rpx;
box-sizing: border-box;
}
.pingxiangitem {
color: #232323;
font-size: 28rpx;
margin-right: 70rpx;
}
.pingzctive {
color: #ff5a4e;
font-size: 28rpx;
position: relative;
}
.commentdetail{
padding-bottom: 50rpx;
}
.pingzctive::after {
content: '';
display: block;
width: 80rpx;
height: 4rpx;
border-radius: 16rpx;
background: #ff5a4e;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: -20rpx;
}
.pingdetail {
padding: 24rpx;
box-sizing: border-box;
}
.pingdetailimg {
width: 750rpx;
height: 2474rpx;
font-size: 0;
}
.pingdetailimg image {
width: 100%;
height: 100%;
}
.commentitem {
padding: 0 26rpx 36rpx;
box-sizing: border-box;
}
.commentitemtop {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 0 16rpx;
box-sizing: border-box;
}
.commentitemleft {
width: 84rpx;
height: 84rpx;
border-radius: 50%;
}
.commentitemleft image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.commentleft {
display: flex;
align-items: center;
}
.commentitemright {
color: #8c9198;
font-size: 28rpx;
margin-left: 18rpx;
}
.commentright {
color: #3d444d;
font-size: 24rpx;
}
.commenttext {
color: #5b5e63;
font-size: 24rpx;
}
.pingfenleft {
display: flex;
align-items: center;
}
.pingfenitem {
width: 37rpx;
height: 37rpx;
font-size: 0;
margin-right: 32rpx;
}
.pingfenitem image {
width: 100%;
height: 100%;
}
.pingfen {
display: flex;
align-items: center;
margin-top: 24rpx;
}
.pingfenname {
color: #ff5a4e;
font-size: 26rpx;
margin-left: 8rpx;
}
.pingimg {
display: flex;
align-items: center;
margin-top: 24rpx;
}
.pingimgitem {
width: 154rpx;
height: 154rpx;
font-size: 0;
margin-right: 24rpx;
}
.pingimgitem image {
width: 100%;
height: 100%;
}
.zhuanhuan {
position: fixed;
top: 583rpx;
right: 46rpx;
width: 80rpx;
height: 80rpx;
font-size: 0;
z-index: 999;
transform: rotate(-180deg)
}
.zhuanhuan image {
width: 100%;
height: 100%;
}
... ...
// pages/goodevalute/goodevalute.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
pingid: '',
type: '',
star: '',
imgarr: [],
chuanimgarr:[],
star: 1,
content: '',
item:"",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
console.log(options)
this.setData({
pingid: options.id,
type: options.type,
item:JSON.parse(options.item),
imgarr: [],
chuanimgarr: [],
})
console.log(this.data.item)
},
// 选择五角星
chosestar(e) {
console.log(e)
this.setData({
star: e.currentTarget.dataset.star
})
},
chooseImage() {
let that = this;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
success: function(res) {
console.log('9988776655',res)
console.log(res.tempFilePaths[0])
app.upload('image', res.tempFilePaths[0]).then((res) => {
console.log('上传文件', res);
let newimagarr = that.data.imgarr;
console.log(newimagarr)
newimagarr.push(res.aburl);
let newchuanimagarr=that.data.chuanimgarr;
newchuanimagarr.push(res.url);
that.setData({
imgarr: newimagarr,
newchuanimagarr: newchuanimagarr
})
console.log(that.data.imgarr)
// that.setData({
// banneritem: res.url
// })
}).catch((err) => {
console.log(err)
})
},
fail: function(res) {}
})
},
delimg(e){
let that=this;
let url=e.currentTarget.dataset.url;
let index=e.currentTarget.dataset.index;
let newimagarr = that.data.imgarr;
let newchuanimagarr = that.data.chuanimgarr;
for(var i=0;i<newimagarr.length;i++){
if (url == newimagarr[i]){
newimagarr.splice(i,1)
}
}
for (var j = 0; j < newchuanimagarr.length; j++) {
if (index==j) {
newchuanimagarr.splice(j, 1)
}
}
that.setData({
imgarr: newimagarr,
chuanimgarr: newchuanimagarr
})
console.log(that.data.imgarr);
console.log(that.data.chuanimgarr)
},
// 输入评论
enterevalute(e) {
this.setData({
content: e.detail.value
})
},
// 发布
fabu() {
let that = this;
if (that.data.content==''){
wx.showToast({
title: '请输入评价内容',
icon:'none'
})
return false
}
var url = 'comment/create_comment';
var params = {
order_info_id:this.data.pingid,
star:this.data.star,
images: this.data.chuanimgarr.join(","),
content: this.data.content
}
app.post(url, params).then((res) => {
console.log(res);
wx.showToast({
title: '评论成功',
icon:'none'
})
setTimeout(function(){
wx.navigateTo({
url: '/pages/orderbox/orderbox?index=' + 4,
})
},1000)
}).catch((err) => {
})
},
// chooseImage() {
// let that = this;
// wx.chooseImage({
// count: 1,
// sizeType: ['original', 'compressed'],
// success: function (res) {
// console.log(res)
// app.upload('image', res.tempFilePaths[0]).then((res) => {
// console.log('上传文件' + JSON.stringify(res));
// let data = JSON.parse(JSON.stringify(res))
// console.log(data)
// let arr = that.data.images;
// arr.push(data.url)
// that.setData({
// images: arr
// })
// console.log(that.data.images)
// }).catch((err) => {
// console.log(err)
// })
// },
// fail: function (res) { }
// })
// },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "商品评价"
}
\ No newline at end of file
... ...
<view class="evalutepage">
<view class="evalutebox">
<view class="evaluteboxhead">
<view class="evaluteleft">
<image src="{{item.image}}"></image>
<view class="zengsong" wx:if="{{type==2}}">
<image src="/img/song.png"></image>
</view>
</view>
<view class="evaluteright">
<view class="boxgoodrightop">
<view class="boxgoodrigtl" wx:if="{{type==1}}">
<image src="/img/good.png"></image>
</view>
<view class="boxgoodrigtl" wx:else>
<image src="/img/zeng.png"></image>
</view>
{{item.goods_name}}
</view>
<view class="desc">描述相符</view>
<view class="wuxing">
<view class="wuxingleft">
<view class="wuxingitem" bindtap="chosestar" data-star="1">
<image src="/img/shixing.png" wx:if="{{star>=1}}" ></image>
<image src="/img/kongxing.png" wx:else></image>
</view>
<view class="wuxingitem" bindtap="chosestar" data-star="2">
<image src="/img/shixing.png" wx:if="{{star>=2}}"></image>
<image src="/img/kongxing.png" wx:else></image>
</view>
<view class="wuxingitem" bindtap="chosestar" data-star="3">
<image src="/img/shixing.png" wx:if="{{star>=3}}"></image>
<image src="/img/kongxing.png" wx:else></image>
</view>
<view class="wuxingitem" bindtap="chosestar" data-star="4">
<image src="/img/shixing.png" wx:if="{{star>=4}}"></image>
<image src="/img/kongxing.png" wx:else></image>
</view>
<view class="wuxingitem" bindtap="chosestar" data-star="5">
<image src="/img/shixing.png" wx:if="{{star>=5}}"></image>
<image src="/img/kongxing.png" wx:else></image>
</view>
</view>
<view class="wuxingfen">{{star}}分</view>
</view>
</view>
</view>
<view class="enterdes">
<textarea placeholder='请输入评价' placeholder-class='enterping' bindinput="enterevalute"/>
</view>
<view class="upimg">
<view class="upimgbnox">
<block wx:for="{{imgarr}}" wx:key="">
<view class="upimgnoxitem">
<image src="{{item}}"></image>
<view class="chahao" bindtap="delimg" data-url="{{item}}" data-index="{{index}}">
<image src="/img/delimg.png"></image>
</view>
</view>
</block>
<view class="upimgnoxitem" bindtap="chooseImage">
<image src="/img/addimg.png"></image>
</view>
</view>
</view>
</view>
<!-- <view class="evalutebox">
<view class="evaluteboxhead">
<view class="evaluteleft">
<image src="/img/evalute.png"></image>
<view class="zengsong">
<image src="/img/song.png"></image>
</view>
</view>
<view class="evaluteright">
<view class="boxgoodrightop">
<view class="boxgoodrigtl">
<image src="/img/good.png"></image>
</view>
商品名称商品名称
</view>
<view class="desc">描述相符</view>
<view class="wuxing">
<view class="wuxingleft">
<view class="wuxingitem">
<image src="/img/shixing.png"></image>
</view>
<view class="wuxingitem">
<image src="/img/shixing.png"></image>
</view>
<view class="wuxingitem">
<image src="/img/shixing.png"></image>
</view>
<view class="wuxingitem">
<image src="/img/shixing.png"></image>
</view>
<view class="wuxingitem">
<image src="/img/shixing.png"></image>
</view>
</view>
<view class="wuxingfen">5分</view>
</view>
</view>
</view>
<view class="enterdes">
<textarea placeholder='请输入评价' placeholder-class='enterping' />
</view>
<view class="upimg">
<view class="upimgbnox">
<view class="upimgnoxitem">
<image src="/img/xie.png"></image>
<view class="chahao">
<image src="/img/delimg.png"></image>
</view>
</view>
<view class="upimgnoxitem">
<image src="/img/xie.png"></image>
<view class="chahao">
<image src="/img/delimg.png"></image>
</view>
</view>
<view class="upimgnoxitem">
<image src="/img/xie.png"></image>
</view>
</view>
</view>
</view> -->
</view>
<view class="adddizhi">
<view class="adddizhibtn" bindtap="fabu">发布</view>
</view>
\ No newline at end of file
... ...
.evalutebox {
padding: 0 24rpx 24rpx;
box-sizing: border-box;
border-bottom:24rpx solid #f9f9f9;
margin-top:24rpx;
}
.evaluteleft {
width: 144rpx;
height: 144rpx;
border-radius: 16rpx;
font-size: 0;
flex: 0 0 auto;
position: relative
}
.evaluteleft{
position: relative
}
.zengsong{
width:44rpx;
height:44rpx;
font-size: 0;
position: absolute;
left:-10rpx;
top:-20rpx;
z-index:999;
}
.zengsong image{
widht:100%;
}
.evaluteleft image {
width: 100%;
height: 100%;
border-radius: 16rpx;
}
.boxgoodrightop {
color: #06121e;
font-size: 30rpx;
font-weight: bold;
position: relative;
padding-left: 64rpx;
box-sizing: border-box;
}
.boxgoodrigtl {
width: 52rpx;
height: 28rpx;
font-size: 0;
position: absolute;
top: 6rpx;
left: 0;
}
.boxgoodrigtl image {
width: 100%;
height: 100%;
}
.evaluteboxhead {
display: flex;
/* align-items: center */
}
.evaluteright {
margin-left: 36rpx;
}
.desc {
color: #06121e;
font-size: 24rpx;
margin-top: 21rpx;
}
.wuxingitem {
width: 30rpx;
height: 30rpx;
font-size: 0;
margin-right: 26rpx;
}
.wuxingitem image {
width: 100%;
height: 100%;
}
.wuxingleft {
display: flex;
align-items: center;
}
.wuxingfen {
color: #ff5a4e;
font-size: 24rpx;
}
.wuxing {
display: flex;
align-items: center;
margin-top: 16rpx;
}
.enterdes {
width: 686rpx;
height: 182rpx;
color: #3d444d;
font-size: 28rpx;
margin-top: 44rpx;
}
.enterdes textarea {
width: 100%;
height: 100%;
color: #3d444d;
font-size: 28rpx;
}
.enterping {
color: #3d444d;
font-size: 28rpx;
}
.upimgbnox{
display:flex;
align-items: center;
flex-wrap: wrap
}
.upimgnoxitem{
width:180rpx;
height:180rpx;
font-size: 0;
position: relative;
margin-right:20rpx;
margin-bottom:20rpx;
}
.upimgnoxitem image{
width:100%;
height:100%;
}
.chahao{
width:40rpx;
height:40rpx;
font-size: 0;
position: absolute;
top:-10rpx;
right:-10rpx;
}
.chahao image{
width:100%;
height:100%;
}
.adddizhi {
height: 128rpx;
background: #fff;
width: 750rpx;
position: fixed;
bottom: 0;
left: 0;
}
.adddizhibtn {
width: 686rpx;
height: 88rpx;
background: rgba(255, 90, 78, 1);
opacity: 1;
border-radius: 8rpx;
color:#fff;
font-size: 32rpx;
text-align: center;
line-height: 88rpx;
margin:0 auto;
}
.evalutepage{
padding-bottom: 150rpx;
}
\ No newline at end of file
... ...
// pages/goodkind/goodkind.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
goodkind: [],
sel: 0,
page: 1,
categories_id: '',
kindgoodlist: [],
keyword: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
enterword(e) {
this.setData({
keyword: e.detail.value
})
},
sousuo(){
if(this.data.keyword==''){
wx.showToast({
title: '请输入商品/关键词',
icon:'none'
})
}else{
this.setData({
page:1,
kindgoodlist:[]
})
this.getfenleikind()
}
},
//获取分类
getkind() {
let that = this;
var url = 'sundry/get_category';
app.post(url, '').then((res) => {
console.log(res);
that.setData({
goodkind: res,
categories_id: res[0].id
})
that.getfenleikind()
}).catch((err) => {
})
},
//获取分类列表
getfenleikind() {
let that = this;
var url = 'goods/get_all';
var params = {
keyword: that.data.keyword,
categories_id: that.data.categories_id,
page: that.data.page,
pageNum: 10
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
kindgoodlist: that.data.kindgoodlist.concat(res)
})
}).catch((err) => {
})
},
goodtail(e) {
let token = wx.getStorageSync("token");
if (token == '') {
wx.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function () {
wx.navigateTo({
url: '/pages/login/login',
})
}, 1500)
}else{
let id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '/pages/goodtail/goodtail?goodid=' + id,
})
}
},
goodsel(e) {
this.setData({
sel: e.currentTarget.dataset.index,
categories_id: e.currentTarget.dataset.id,
page: 1,
kindgoodlist: []
})
console.log(this.data.categories_id)
this.getfenleikind()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.setData({
kindgoodlist: []
})
this.getkind()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
let newpage = this.data.page;
newpage++;
this.setData({
page: newpage,
})
this.getfenleikind()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "商品分类"
}
\ No newline at end of file
... ...
<view class="searchhead">
<view class="searchheadleft">
<view class="searchboxleft">
<image src="/img/sousuo.png"></image>
</view>
<view class="searchleftcontent">
<input placeholder='请输入商品/赠品关键字' bindinput="enterword" />
</view>
</view>
<view class="searchheadright" bindtap="sousuo">
搜索
</view>
</view>
<view class="goodkindbox">
<view class="goodkindleft">
<view class="goodkindleftitem {{sel==index?'goodsel':''}}" wx:for="{{goodkind}}" wx:key="" bindtap="goodsel" data-index="{{index}}" data-id="{{item.id}}">{{item.categories_name}}</view>
</view>
<view class="nodataw" wx:if="{{kindgoodlist.length==0}}">暂无数据</view>
<view class="goodkindright" wx:else>
<view class="goodkindrightitem" wx:for="{{kindgoodlist}}" wx:key="" bindtap="goodtail" data-id="{{item.id}}">
<view class="goodkindbox">
<view class='goodkindrightitemleft'>
<view class="goodkindleftimg">
<image src="{{item.image}}"></image>
</view>
<view class="xiename">
<view class="xienameleft">
<image src="/img/good.png"></image>
</view>
<view class="goodname">{{item.goods_name}}</view>
</view>
</view>
<view class="songk">
<image src="/img/send.png"></image>
</view>
<view class='goodkindrightitemleft'>
<view class="goodkindleftimg">
<image src="{{item.gift.image}}"></image>
</view>
<view class="xiename">
<view class="xienameleft">
<image src="/img/zeng.png"></image>
</view>
<view class="goodname">{{item.gift.goods_name}}</view>
</view>
</view>
</view>
<view class="goodkindprice">
<view class="goodkindpriceleft">
¥{{item.price}}
</view>
<view class="goodkindpriceright" wx:if="{{item.freight==0.00}}">运费:免运费</view>
<view class="goodkindpriceright" wx:else>运费:{{item.freight}}元</view>
<view class="zengfreight" wx:if="{{item.gift.freight==0.00}}">
<view class="goodkindpriceright">运费:免运费</view>
</view>
<view class="zengfreight" wx:else>
<view class="goodkindpriceright">运费:{{item.gift.freight}}元</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
page{
background: #f9f9f9;
}
.searchhead{
padding:20rpx 32rpx;
box-sizing: border-box;
display:flex;
align-items: center;
border-bottom:1rpx solid #f5f5f5;
background: #fff;
}
.searchheadleft{
width:548rpx;
height:60rpx;
display:flex;
align-items: center;
background: #f9f9f9;
padding: 0 22rpx;
box-sizing: border-box
}
.searchleftcontent{
color:#8C9198;
font-size: 24rpx;
margin-left:12rpx;
}
.searchheadright{
width:126rpx;
height:60rpx;
background: #EEEEEE;
text-align: center;
line-height: 60rpx;
color:#3D444D;
font-size: 24rpx;
margin-left:12rpx;
}
.goodkindleft{
width:218rpx;
padding: 48rpx 30rpx;
box-sizing: border-box;
background: #fff;
height:1104rpx;
overflow-y: scroll;
}
.goodkindleftitem{
width:138rpx;
color:#5B5E63;
font-size: 32rpx;
margin-bottom:60rpx;
text-align: center
}
.goodkindleftimg{
width:212rpx;
height:212rpx;
font-size: 0
}
.goodkindleftimg image{
width:100%;
height:100%;
}
.goodkindright{
padding: 12rpx;
box-sizing: border-box;
background: #F9F9F9;
height:1104rpx;
overflow-y: scroll;
overflow-x: hidden
}
.goodkindrightitem{
background: #fff;
width:528rpx;
padding: 24rpx 32rpx;
box-sizing: border-box;
margin-bottom:16rpx;
}
.goodkindbox{
display:flex;
}
.goodkindrightitem:last-child{
margin-bottom:0
}
.songk{
width:32rpx;
height:32rpx;
font-size: 0;
margin-top:90rpx;
}
.songk image{
width:100%;
height:100%;
}
.goodkindbox{
display:flex;
}
.goodkindprice{
display:flex;
align-items: center;
margin-top:18rpx;
}
.goodkindpriceleft{
color:#FF5A4E;
font-size:28rpx;
font-weight:bold;
}
.goodkindpriceright{
color:#3D444D;
font-size: 24rpx;
margin-left:8rpx;
}
.goodsel{
width:138rpx;
color:#06121E;
font-size: 32rpx;
font-weight: bold;
position: relative;
}
.goodsel::after{
content:'';
display:block;
width:64rpx;
height:4rpx;
background:#FF5A4E;
border-radius: 44rpx;
position: absolute;
left:50%;
transform: translateX(-50%);
bottom:-10rpx;
}
.zengfreight{
display:felx;
justify-content: flex-end
}
.nodataw{
width:528rpx;
text-align: center;
color:#999;
font-size: 30rpx;
margin-top:185rpx;
}
/* .goodsel ::before{
display:block;
content:'';
width:64rpx;
height:4rpx;
border-radius: 44rpx;
background: #FF5A4E;
position: absolute;
left:0;
} */
.zengfreight{
margin-left:40rpx;
}
\ No newline at end of file
... ...
// pages/goodtail/goodtail.js
var WxParse = require('../../wxParse/wxParse.js');
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
imgUrls: [
],
indicatorDots: false,
autoplay: false,
interval: 2000,
duration: 1000,
currentSwiper: 0,
ping: 1,
goodid: '',
goodtail: '',
page: 1,
commentlist: [],
count: 0,
totalping: 0,
giftstandard: '请选择规格',
standard: '请选择规格',
standardarr:[],
giftstandardarr:[],
buynum:1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.setData({
goodid: options.goodid,
page: 1,
commentlist: []
})
this.getgoodtail();
this.getgoodcomment()
//获取气泡
this.getqipao()
},
gocart() {
wx.switchTab({
url: '/pages/cart/cart',
})
},
//获取购物车气泡
getqipao() {
let that = this;
var url = 'car/bubble';
var params = {}
app.post(url, '').then((res) => {
console.log(res);
this.setData({
count: res.count
})
}).catch((err) => {
})
},
getgoodtail() {
let that = this;
var url = 'goods/get_one';
var params = {
goods_id: that.data.goodid,
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
imgUrls: res.images,
goodtail: res,
})
that.data.goodtail.standard.forEach(function(value, index, array) {
value.selindex = -1,
value.selname = ''
})
that.data.goodtail.gift.standard.forEach(function(value, index, array) {
value.selindex = -1,
value.selname = ''
})
that.setData({
goodtail: that.data.goodtail
})
// WxParse.wxParse('article', 'html', res.content, that, 5);
}).catch((err) => {
})
},
reducenum(){
this.data.buynum=this.data.buynum-1;
if(this.data.buynum==1){
this.setData({
buynum:this.data.buynum
})
}
},
addnum(){
this.data.buynum = this.data.buynum +1;
this.setData({
buynum: this.data.buynum
})
},
selattr(e) {
let that = this;
console.log(e)
let index = e.currentTarget.dataset.index;
let attrindex = e.currentTarget.dataset.bindex;
let name=e.currentTarget.dataset.name
console.log(index);
console.log(attrindex)
that.data.standardarr.push(name)
that.data.goodtail.standard[attrindex].selindex = index;
that.data.goodtail.standard[attrindex].selname = name;
that.setData({
goodtail: that.data.goodtail,
standardarr: that.data.standardarr
})
console.log(that.data.goodtail)
console.log(that.data.standardarr)
},
selgiftattr(e){
let that = this;
console.log(e)
let index = e.currentTarget.dataset.index;
let attrindex = e.currentTarget.dataset.bindex;
let name = e.currentTarget.dataset.name
console.log(index);
console.log(attrindex)
that.data.giftstandardarr.push(name)
that.data.goodtail.gift.standard[attrindex].selindex = index;
that.data.goodtail.gift.standard[attrindex].selname = name;
that.setData({
goodtail: that.data.goodtail,
giftstandardarr: that.data.giftstandardarr
})
console.log(that.data.goodtail)
console.log(that.data.giftstandardarr)
},
//加入购物车
addcart() {
let that = this;
var url = 'car/update_car';
var params = {
goods_id: that.data.goodid,
type: 1,
goods_standard:that.data.standardarr.join(","),
give_standard: that.data.giftstandardarr.join(",")
}
app.post(url, params).then((res) => {
console.log(res);
wx.showToast({
title: '添加购物车成功',
icon: 'none'
})
that.getqipao()
}).catch((err) => {
wx.showToast({
title: err.msg,
icon: 'none'
})
})
},
//跳入赠品详情
gogift() {
wx.redirectTo({
url: '/pages/giftdetail/giftdetail?goodid=' + this.data.goodid,
})
},
//获取商品评论
getgoodcomment() {
let that = this;
var url = 'comment/get_all';
var params = {
goods_id: that.data.goodid,
page: that.data.page,
pageNum: 10
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
commentlist: that.data.commentlist.concat(res.data),
totalping: res.total
})
console.log(that.data.commentlist)
}).catch((err) => {
})
},
swiperChange: function(e) {
this.setData({
currentSwiper: e.detail.current
})
},
comment(e) {
this.setData({
ping: e.currentTarget.dataset.id
})
if (this.data.ping == 1) {
this.getgoodtail()
} else {
this.setData({
page: 1,
commentlist: []
})
this.getgoodcomment()
}
},
//立即抢购
lijiqiang() {
let that = this;
var url = 'order/confirm_order';
var params = {
goods_ids: that.data.goodtail.id,
take_id: '',
type: 1
}
app.post(url, params).then((res) => {
console.log(res);
let orderarr = res.goods;
for (var obj of orderarr) {
obj.content = '';
obj.gift.content = ''
}
let neworderarr = JSON.stringify(orderarr)
let freight = res.freight;
let price = res.price;
let total = res.total;
console.log(freight);
console.log(price);
console.log(total);
console.log(orderarr);
wx.navigateTo({
url: '/pages/sureorder/sureorder?orderarr=' + neworderarr + '&freight=' + freight + '&price=' + price + '&total=' + total + '&type=' + 1,
})
}).catch((err) => {
wx.showToast({
title: err.msg,
icon: 'none'
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
if (this.data.ping == 2) {
let newpage = this.data.page;
newpage++;
this.setData({
page: newpage
})
this.getgoodcomment()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "商品详情"
}
\ No newline at end of file
... ...
<import src="../../wxParse/wxParse.wxml" />
<!-- 转换箭头 -->
<view class="zhuanhuan" bindtap="gogift">
<image src="/img/jump.png"></image>
</view>
<view class="swiper_image">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange" circular="true">
<block wx:for="{{imgUrls}}" wx:key="doct">
<swiper-item>
<image src="{{item}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" />
</swiper-item>
</block>
</swiper>
<view class="bannerdot">
<text>{{currentSwiper+1}}</text>/
<text>{{imgUrls.length}}</text>
</view>
<!-- <view class="dots">
<block wx:for="{{imgUrls}}" wx:key="">
<view class="dot{{index == currentSwiper ? ' active' : ''}}"></view>
</block>
</view> -->
</view>
<view class="goodname">
<view class="boxgoodrightop">
<view class="boxgoodrigtl">
<image src="/img/good.png"></image>
</view>
{{goodtail.goods_name}}
</view>
<view class="goodprice">
<view class="goodpriceleft">¥{{goodtail.price}}</view>
<view class="goodpriceright" wx:if="{{goodtail.freight=='0.00'}}">运费:免运费</view>
<view class="goodpriceright" wx:else>运费:{{goodtail.freight}}元</view>
</view>
</view>
<!--赠品 -->
<view class="zenggood" bindtap="gogift">
<view class="zenggoodleft">
<image src='{{goodtail.gift.image}}'></image>
</view>
<view class="zengright">
<view class="boxgoodrightop zengname">
<view class="boxgoodrigtl">
<image src="/img/zeng.png"></image>
</view>
{{goodtail.gift.goods_name}}
</view>
</view>
</view>
<!-- 详情和评论 -->
<view class="pingxiang">
<view class="pingxiangitem {{ping==1?'pingzctive':''}} " data-id="1" bindtap="comment">详情</view>
<view class="pingxiangitem {{ping==2?'pingzctive':''}}" data-id="2" bindtap="comment">评论({{totalping}})</view>
</view>
<view class="pingdetail" wx:if="{{ping==1}}">
<template is="wxParse" data="{{wxParseData:article.nodes}}" />
<!-- <view class="pingdetailimg">
<image src="/img/changtu.png"></image>
</view> -->
</view>
<view class='commentdetail' wx:else>
<view class="nodata" wx:if="{{commentlist.length==0}}">暂无评论</view>
<view wx:else>
<view class="commentitem" wx:for="{{commentlist}}" wx:key="">
<view class="commentitemtop">
<view class="commentleft">
<view class="commentitemleft">
<image src="{{item.avatar}}"></image>
</view>
<view class="commentitemright">{{item.nickname}}</view>
</view>
<view class="commentright">{{item.createtime}}</view>
</view>
<view class="commenttext">
{{item.content}}
</view>
<view class="pingfen">
<view class="pingfenleft">
<view class="pingfenitem">
<image src="{{item.star>=1?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
<view class="pingfenitem">
<image src="{{item.star>=2?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
<view class="pingfenitem">
<image src="{{item.star>=3?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
<view class="pingfenitem">
<image src="{{item.star>=4?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
<view class="pingfenitem">
<image src="{{item.star>=5?'/img/shixing.png':'/img/kongxing.png'}}"></image>
</view>
</view>
<view class="pingfenname">{{item.star}}分</view>
</view>
<view class="pingimg">
<view class="pingimgitem" wx:for="{{item.images}}" wx:key="">
<image src="{{item}}"></image>
</view>
</view>
</view>
</view>
</view>
<view class="cartbottom">
<view class="cartbottomleft" bindtap="gocart">
<view class="cartbototmtopimg">
<image src="/img/shop.png"></image>
<view class="cartnum">{{count}}</view>
</view>
<view class="gouwucart">购物车</view>
</view>
<view class="cartright">
<view class="cartleftname" bindtap="addcart">加入购物车</view>
<view class="qianggou" bindtap="lijiqiang">立即抢购</view>
</view>
</view>
<!-- 选择商品属性 -->
<view class="registerk">
<view class="naturewrap">
<view class="naturebox">
<view class="naturetop flexone">
<view class="naturetopleft">
<image src="{{goodtail.image}}"></image>
</view>
<view class="naturetopright">
<view class="goodprice">¥{{goodtail.price}}</view>
<view class="naturestock">库存:{{goodtail.inventory}}件</view>
<view class="natureshu">{{standard}}</view>
</view>
</view>
<view class="sizebox">
<view class="size" wx:for='{{goodtail.standard}}' wx:key="" wx:for-item="standarditem" wx:if="{{goodtail.standard!=null}}" wx:for-index="bindex" >
<view class="sizetop">{{standarditem.name}}</view>
<view class="sizebox flexone">
<view class="coloritem {{standarditem.selindex==index?'itemactive':''}}" wx:for='{{standarditem.value}}' wx:key="" bindtap="selattr" data-index="{{index}}" data-bindex="{{bindex}}" data-name="{{item}}">{{item}}</view>
</view>
</view>
</view>
<view class="buynum flextwo">
<view class="buymumleft">购买数量</view>
<view class='buynumright flexone'>
<view class="buynumreduce" bindtap="reducenum">
<image src="/img/buyreduce.png"></image>
</view>
<view class="numname">{{buynum}}</view>
<view class="buynumreduce" bindtap="addnum">
<image src="/img/buyadd.png"></image>
</view>
</view>
</view>
<view class="naturetop flexone">
<view class="naturetopleft">
<image src="{{goodtail.gift.image}}"></image>
</view>
<view class="naturetopright">
<view class="goodprice">{{goodtail.gift.goods_name}}</view>
<view class="naturestock">库存:{{goodtail.gift.inventory}}件</view>
<view class="natureshu">{{giftstandard}}</view>
</view>
</view>
<view>
<view class="size" wx:for="{{goodtail.gift.standard}}" wx:if='{{goodtail.gift.standard!=null}}' wx:for-item="standarditem" wx:for-index="bindex">
<view class="sizetop">{{standarditem.name}}</view>
<view class="sizebox flexone">
<view class="coloritem {{standarditem.selindex==index?'itemactive':''}}" wx:for='{{standarditem.value}}' wx:key="" bindtap="selgiftattr" data-index="{{index}}" data-bindex="{{bindex}}" data-name="{{item}}">{{item}}</view>
</view>
</view>
</view>
</view>
<view class="cartbottom boxcartbot">
<view class="cartbottomleft" bindtap="gocart">
<view class="cartbototmtopimg">
<image src="/img/shop.png"></image>
<view class="cartnum">{{count}}</view>
</view>
<view class="gouwucart">购物车</view>
</view>
<view class="cartright">
<view class="cartleftname" bindtap="addcart">加入购物车</view>
<view class="qianggou" bindtap="lijiqiang">立即抢购</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
.swiper_image {
width: 750rpx;
height: 600rpx;
font-size: 0;
position: relative;
box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11);
border-radius: 10px;
}
.swiper_item_img {
height: 600rpx;
}
.swiper_image image {
width: 100%;
height: 100%;
/* box-shadow:0px -1px 6px 0px rgba(212,137,96,0.11); */
}
.swiper_item_img swiper-item {
width: 750rpx;
height: 600rpx;
box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11);
display: felx;
align-items: center;
justify-content: center;
}
.swiper_item_img swiper-item image {
width: 100%;
height: 100%;
}
.bannerdot {
width: 84rpx;
height: 44rpx;
background: rgba(0, 0, 0, 0.2);
opacity: 1;
border-radius: 20rpx;
color: #fff;
font-size: 30rpx;
text-align: center;
position: absolute;
bottom: 24rpx;
right: 28rpx;
}
.boxgoodrightop {
color: #06121e;
font-size: 28rpx;
font-weight: bold;
position: relative;
padding-left: 64rpx;
box-sizing: border-box;
}
.boxgoodrigtl {
width: 52rpx;
height: 28rpx;
font-size: 0;
position: absolute;
top: 6rpx;
left: 0;
}
.boxgoodrigtl image {
width: 100%;
height: 100%;
}
.orderdetailboxgood {
display: flex;
}
.boxgoodright {
margin-left: 24rpx;
}
.boxgoodrigbot {
display: flex;
align-items: center;
margin-top: 66rpx;
}
.boxgoodrmoney {
color: #ea322b;
font-size: 32rpx;
}
.boxgoodnum {
color: #3d444d;
font-size: 24rpx;
margin-left: 16rpx;
}
.goodname {
padding: 38rpx 32rpx;
box-sizing: border-box;
border-bottom: 24rpx solid #f5f5f5;
}
.goodprice {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 15rpx;
}
.goodpriceleft {
color: #ea322b;
font-size: 36rpx;
}
.goodpriceright {
color: #3d444d;
font-size: 28rpx;
}
.zenggood {
display: flex;
padding: 28rpx;
box-sizing: border-box;
border-bottom: 24rpx solid #f9f9f9;
}
.zenggoodleft {
width: 144rpx;
height: 144rpx;
font-size: 0;
border-radius: 8rpx;
}
.zenggoodleft image {
width: 100%;
height: 100%;
border-radius: 8rpx;
}
.zengname {
color: #5b5e63;
font-size: 24rpx;
width: 522rpx;
margin-left: 28rpx;
}
.pingxiang {
display: flex;
align-items: center;
padding: 24rpx 36rpx;
box-sizing: border-box;
}
.pingxiangitem {
color: #232323;
font-size: 28rpx;
margin-right: 70rpx;
}
.pingzctive {
color: #ff5a4e;
font-size: 28rpx;
position: relative;
}
.commentdetail {
padding-bottom: 159rpx;
}
.pingzctive::after {
content: '';
display: block;
width: 80rpx;
height: 4rpx;
border-radius: 16rpx;
background: #ff5a4e;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: -20rpx;
}
.pingdetail {
padding: 24rpx;
box-sizing: border-box;
padding-bottom: 159rpx;
}
.pingdetailimg {
width: 750rpx;
height: 2474rpx;
font-size: 0;
}
.pingdetailimg image {
width: 100%;
height: 100%;
}
.commentitem {
padding: 0 26rpx 36rpx;
box-sizing: border-box;
}
.commentitemtop {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 0 16rpx;
box-sizing: border-box;
}
.commentitemleft {
width: 84rpx;
height: 84rpx;
border-radius: 50%;
}
.commentitemleft image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.commentleft {
display: flex;
align-items: center;
}
.commentitemright {
color: #8c9198;
font-size: 28rpx;
margin-left: 18rpx;
}
.commentright {
color: #3d444d;
font-size: 24rpx;
}
.commenttext {
color: #5b5e63;
font-size: 24rpx;
}
.pingfenleft {
display: flex;
align-items: center;
}
.pingfenitem {
width: 37rpx;
height: 37rpx;
font-size: 0;
margin-right: 32rpx;
}
.pingfenitem image {
width: 100%;
height: 100%;
}
.pingfen {
display: flex;
align-items: center;
margin-top: 24rpx;
}
.pingfenname {
color: #ff5a4e;
font-size: 26rpx;
margin-left: 8rpx;
}
.pingimg {
display: flex;
align-items: center;
margin-top: 24rpx;
}
.pingimgitem {
width: 154rpx;
height: 154rpx;
font-size: 0;
margin-right: 24rpx;
}
.pingimgitem image {
width: 100%;
height: 100%;
}
.zhuanhuan {
position: fixed;
top: 583rpx;
right: 46rpx;
width: 80rpx;
height: 80rpx;
font-size: 0;
z-index: 7;
}
.zhuanhuan image {
width: 100%;
height: 100%;
}
.cartbottom {
width: 750rpx;
height: 104rpx;
background: #fff;
position: fixed;
bottom: 0;
left: 0;
padding: 14rpx 32rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
}
.cartbottomleft {
display: felx;
flex-direction: column;
justify-content: center;
align-items: center;
}
.cartleftname {
width: 212rpx;
height: 77rpx;
background: rgba(255, 90, 78, 1);
opacity: 1;
border-radius: 20rpx 4rpx 4rpx 20rpx;
color: #fff;
font-size: 28rpx;
text-align: center;
line-height: 77rpx;
margin-right: 12rpx;
}
.qianggou {
width: 180rpx;
height: 77rpx;
background: rgba(255, 90, 78, 1);
opacity: 1;
color: #fff;
font-size: 28rpx;
text-align: center;
line-height: 77rpx;
border-radius: 4rpx 20rpx 20rpx 4rpx;
}
.cartright {
display: flex;
align-items: center;
}
.cartbototmtopimg {
width: 48rpx;
height: 48rpx;
font-size: 0;
position: relative;
margin-left: 8rpx;
}
.cartbototmtopimg image {
width: 100%;
height: 100%;
}
.cartnum {
width: 24rpx;
height: 24rpx;
background: #ff0001;
border-radius: 50%;
color: #fff;
font-size: 20rpx;
text-align: center;
line-height: 24rpx;
position: absolute;
right: -5rpx;
top: -5rpx;
}
.gouwucart {
color: #3d444d;
font-size: 20rpx;
text-align: center;
margin-top: 8rpx;
}
.wxParse-p {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.wxParse-p image {
display: block;
}
.naturewrap {
width: 750rpx;
height: 1150rpx;
background: rgba(255, 255, 255, 1);
opacity: 1;
border-radius: 20rpx 20rpx 0rpx 0rpx;
position: absolute;
bottom: 0;
left: 0;
z-index: 999;
padding: 48rpx 32rpx;
box-sizing: border-box;
overflow-y: scroll
}
.naturetopleft {
width: 156rpx;
height: 156rpx;
font-size: 0;
}
.naturetopright {
margin-left: 28rpx;
}
.goodprice {
color: #ea322b;
font-size: 36rpx;
font-weight: bold;
}
.naturestock {
color: #8c9198;
font-size: 28rpx;
margin-top: 16rpx;
}
.natureshu {
color: #8c9198;
font-size: 28rpx;
margin-top: 5rpx;
}
image {
width: 100%;
height: 100%;
}
.sizeitem {
width: 88rpx;
height: 56rpx;
background: rgba(238, 238, 238, 1);
opacity: 1;
border-radius: 8rpx;
color: #06121e;
font-size: 24rpx;
text-align: center;
line-height: 56rpx;
margin-right: 20rpx;
margin-bottom: 16rpx;
}
.sizebox {
flex-wrap: wrap;
margin-top: 28rpx;
}
.coloritem {
height:56rpx;
padding: 12rpx 22rpx;
box-sizing: border-box;
background: rgba(238, 238, 238, 1);
opacity: 1;
border-radius: 8rpx;
color:#06121E;
font-size: 24rpx;
text-align: center;
margin-right:20rpx;
margin-bottom: 16rpx;
border:1rpx solid transparent;
}
.size{
margin-top:36rpx;
}
.buynumreduce{
width:56rpx;
height:56rpx;
font-size: 0
}
.numname{
color:#3D444D;
font-size: 32rpx;
margin: 0 28rpx;
height:56rpx;
line-height: 56rpx;
}
.buynum{
margin-top:60rpx;
margin-bottom:60rpx;
padding-bottom: 60rpx;
border-bottom:1rpx solid #f5f5f5;
}
.boxcartbot{
position: fixed;
bottom:0;
left:0;
background:#fff;
border-top:1rpx solid #f5f5f5;
}
.naturebox{
padding-bottom: 150rpx;
}
.itemactive{
border:1rpx solid #EF4C46;
color:#EF4C46;
}
\ No newline at end of file
... ...
// pages/homepage/homepage.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
imgUrls: [],
indicatorDots: false,
autoplay: true,
interval: 2000,
duration: 1000,
currentSwiper: 0,
categories_id: '',
goodlist: [],
page: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
swiperChange: function(e) {
this.setData({
currentSwiper: e.detail.current
})
},
// 进入搜索页
gosearch() {
let token = wx.getStorageSync("token");
if (token == '') {
wx.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function() {
wx.navigateTo({
url: '/pages/login/login',
})
}, 1500)
} else {
wx.navigateTo({
url: '/pages/searchbox/searchbox',
})
}
},
// 获取首页数据
getindexdata() {
let that = this;
let url = 'goods/get_all';
let param = {
keyword: that.data.keyword,
categories_id: that.data.categories_id,
page: that.data.page,
pageNum: 10
}
app.post(url, param, 'post').then((res) => {
console.log(res);
that.setData({
goodlist: that.data.goodlist.concat(res)
})
}).catch((err) => {
})
},
//获取首页轮播图
getbanner() {
let that = this;
let url = 'sundry/get_slide';
let param = {
}
app.post(url, '', 'post').then((res) => {
console.log(res);
if(res.length>5){
let newimgUrls = []
for(var i=0;i<5;i++){
newimgUrls.push(res[i])
}
that.setData({
imgUrls:newimgUrls
})
}else{
that.setData({
imgUrls: res
})
}
}).catch((err) => {
})
},
//进入商品详情页
gotogood(e) {
let token = wx.getStorageSync("token");
if (token == '') {
wx.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function() {
wx.navigateTo({
url: '/pages/login/login',
})
}, 1500)
} else {
let goodid = e.currentTarget.dataset.id;
wx.navigateTo({
url: '/pages/goodtail/goodtail?goodid=' + goodid,
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.setData({
page:1,
goodlist:[]
})
this.getindexdata();
this.getbanner()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
let newpage = this.data.page;
newpage++;
this.setData({
page: newpage
})
this.getindexdata();
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "买赠商城"
}
\ No newline at end of file
... ...