Commit a697e696 authored by Menethil's avatar Menethil
Browse files

小程序添加团购

parent b2d9fd3c
{
"pages": [
"pages/index/index",
"pages/catalog/catalog",
"pages/newGoods/newGoods",
"pages/hotGoods/hotGoods",
"pages/ucenter/index/index",
"pages/ucenter/address/address",
"pages/ucenter/addressAdd/addressAdd",
"pages/ucenter/footprint/footprint",
"pages/ucenter/order/order",
"pages/ucenter/orderDetail/orderDetail",
"pages/ucenter/coupon/coupon",
"pages/ucenter/collect/collect",
"pages/auth/login/login",
"pages/auth/accountLogin/accountLogin",
"pages/auth/register/register",
"pages/auth/reset/reset",
"pages/payResult/payResult",
"pages/comment/comment",
"pages/commentPost/commentPost",
"pages/topic/topic",
"pages/topicComment/topicComment",
"pages/topicDetail/topicDetail",
"pages/topicCommentPost/topicCommentPost",
"pages/brand/brand",
"pages/brandDetail/brandDetail",
"pages/search/search",
"pages/category/category",
"pages/cart/cart",
"pages/checkout/checkout",
"pages/goods/goods",
"pages/about/about"
],
"window": {
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTitleText": "litemall小程序商城",
"enablePullDownRefresh": true,
"navigationBarTextStyle": "black",
"backgroundColor": "#FFFFFF",
"backgroundTextStyle": "dark"
},
"tabBar": {
"backgroundColor": "#fafafa",
"borderStyle": "white",
"selectedColor": "#AB956D",
"color": "#666",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/images/ic_menu_choice_nor.png",
"selectedIconPath": "static/images/home@selected.png",
"text": "首页"
},
{
"pagePath": "pages/catalog/catalog",
"iconPath": "static/images/ic_menu_sort_nor.png",
"selectedIconPath": "static/images/category@selected.png",
"text": "分类"
},
{
"pagePath": "pages/cart/cart",
"iconPath": "static/images/ic_menu_shoping_nor.png",
"selectedIconPath": "static/images/cart@selected.png",
"text": "购物车"
},
{
"pagePath": "pages/ucenter/index/index",
"iconPath": "static/images/ic_menu_me_nor.png",
"selectedIconPath": "static/images/my@selected.png",
"text": "个人"
}
]
},
"networkTimeout": {
"request": 10000,
"connectSocket": 10000,
"uploadFile": 10000,
"downloadFile": 10000
},
"debug": true
"pages": [
"pages/index/index",
"pages/catalog/catalog",
"pages/newGoods/newGoods",
"pages/hotGoods/hotGoods",
"pages/ucenter/index/index",
"pages/ucenter/address/address",
"pages/ucenter/addressAdd/addressAdd",
"pages/ucenter/footprint/footprint",
"pages/ucenter/order/order",
"pages/ucenter/orderDetail/orderDetail",
"pages/ucenter/coupon/coupon",
"pages/ucenter/collect/collect",
"pages/auth/login/login",
"pages/auth/accountLogin/accountLogin",
"pages/auth/register/register",
"pages/auth/reset/reset",
"pages/payResult/payResult",
"pages/comment/comment",
"pages/commentPost/commentPost",
"pages/topic/topic",
"pages/topicComment/topicComment",
"pages/topicDetail/topicDetail",
"pages/topicCommentPost/topicCommentPost",
"pages/brand/brand",
"pages/brandDetail/brandDetail",
"pages/search/search",
"pages/category/category",
"pages/cart/cart",
"pages/checkout/checkout",
"pages/goods/goods",
"pages/about/about",
"pages/groupon/myGroupon/myGroupon",
"pages/groupon/grouponDetail/grouponDetail"
],
"window": {
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTitleText": "litemall小程序商城",
"enablePullDownRefresh": true,
"navigationBarTextStyle": "black",
"backgroundColor": "#FFFFFF",
"backgroundTextStyle": "dark"
},
"tabBar": {
"backgroundColor": "#fafafa",
"borderStyle": "white",
"selectedColor": "#AB956D",
"color": "#666",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/images/ic_menu_choice_nor.png",
"selectedIconPath": "static/images/home@selected.png",
"text": "首页"
},
{
"pagePath": "pages/catalog/catalog",
"iconPath": "static/images/ic_menu_sort_nor.png",
"selectedIconPath": "static/images/category@selected.png",
"text": "分类"
},
{
"pagePath": "pages/cart/cart",
"iconPath": "static/images/ic_menu_shoping_nor.png",
"selectedIconPath": "static/images/cart@selected.png",
"text": "购物车"
},
{
"pagePath": "pages/ucenter/index/index",
"iconPath": "static/images/ic_menu_me_nor.png",
"selectedIconPath": "static/images/my@selected.png",
"text": "个人"
}
]
},
"networkTimeout": {
"request": 10000,
"connectSocket": 10000,
"uploadFile": 10000,
"downloadFile": 10000
},
"debug": true
}
\ No newline at end of file
......@@ -4,9 +4,9 @@
// 局域网测试使用
// var WxApiRoot = 'http://192.168.0.101:8080/wx/';
// 云平台部署时使用
var WxApiRoot = 'http://122.152.206.172:8080/wx/';
// var WxApiRoot = 'http://122.152.206.172:8080/wx/';
// 云平台上线时使用
// var WxApiRoot = 'https://www.menethil.com.cn/wx/';
var WxApiRoot = 'https://www.menethil.com.cn/wx/';
module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口
......@@ -79,5 +79,9 @@ module.exports = {
UserFormIdCreate: WxApiRoot + 'formid/create', //用户FromId,用于发送模版消息
GroupOn: WxApiRoot + 'groupon/query', //团购API-查询
GroupOnMy: WxApiRoot + 'groupon/my', //团购API-我的团购
GroupOnDetail: WxApiRoot + 'groupon/detail', //团购API-详情
GroupOnJoin: WxApiRoot + 'groupon/join', //团购API-详情
StorageUpload: WxApiRoot + 'storage/upload' //图片上传
};
\ No newline at end of file
'use strict';
Component({
externalClasses: ['custom-class'],
/**
* 组件的属性列表
* 用于组件自定义设置
*/
properties: {
// 颜色状态
type: {
type: String,
value: ''
},
// 自定义颜色
color: {
type: String,
value: ''
},
// 左侧内容
leftText: {
type: String,
value: ''
},
// 右侧内容
rightText: {
type: String,
value: ''
}
}
});
\ No newline at end of file
<view class="custom-class zan-capsule zan-capsule--{{type}}">
<block wx:if="{{color}}">
<view class="zan-capsule__left" style="background: {{ color }}; border-color: {{ color }}">{{ leftText }}</view>
<view class="zan-capsule__right" style="color: {{ color }}; border-color: {{ color }}">{{ rightText }}</view>
</block>
<block wx:else>
<view class="zan-capsule__left">{{ leftText }}</view>
<view class="zan-capsule__right">{{ rightText }}</view>
</block>
</view>
\ No newline at end of file
.zan-capsule {
display: inline-block;
font-size: 12px;
vertical-align: middle;
line-height: 19px;
-webkit-transform: scale(0.83);
transform: scale(0.83);
}
.zan-capsule__left, .zan-capsule__right {
display: inline-block;
line-height: 17px;
height: 19px;
vertical-align: middle;
box-sizing: border-box;
}
.zan-capsule__left {
padding: 0 2px;
color: #fff;
background: #999;
border-radius: 2px 0 0 2px;
border: 1rpx solid #999;
}
.zan-capsule__right {
padding: 0 5px;
color: #999;
border-radius: 0 2px 2px 0;
border: 1rpx solid #999;
}
.zan-capsule--danger .zan-capsule__left {
color: #fff;
background: #f24544;
border-color: #f24544;
}
.zan-capsule--danger .zan-capsule__right {
color: #f24544;
border-color: #f24544;
}
......@@ -12,168 +12,170 @@ Page({
goodsTotalPrice: 0.00, //商品总价
freightPrice: 0.00, //快递费
couponPrice: 0.00, //优惠券的价格
grouponPrice: 0.00, //团购优惠价格
orderTotalPrice: 0.00, //订单总价
actualPrice: 0.00, //实际需要支付的总价
cartId: 0,
addressId: 0,
couponId: 0
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
},
getCheckoutInfo: function () {
let that = this;
util.request(api.CartCheckout, { cartId: that.data.cartId, addressId: that.data.addressId, couponId: that.data.couponId }).then(function (res) {
if (res.errno === 0) {
that.setData({
checkedGoodsList: res.data.checkedGoodsList,
checkedAddress: res.data.checkedAddress,
actualPrice: res.data.actualPrice,
checkedCoupon: res.data.checkedCoupon,
couponList: res.data.couponList,
couponPrice: res.data.couponPrice,
freightPrice: res.data.freightPrice,
goodsTotalPrice: res.data.goodsTotalPrice,
orderTotalPrice: res.data.orderTotalPrice,
addressId: res.data.addressId,
couponId: res.data.couponId
});
}
wx.hideLoading();
couponId: 0,
grouponLinkId: 0, //参与的团购,如果是发起则为0
grouponRulesId: 0 //团购规则ID
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
},
//获取checkou信息
getCheckoutInfo: function() {
let that = this;
util.request(api.CartCheckout, {
cartId: that.data.cartId,
addressId: that.data.addressId,
couponId: that.data.couponId,
grouponRulesId: that.data.grouponRulesId
}).then(function(res) {
if (res.errno === 0) {
that.setData({
checkedGoodsList: res.data.checkedGoodsList,
checkedAddress: res.data.checkedAddress,
actualPrice: res.data.actualPrice,
checkedCoupon: res.data.checkedCoupon,
couponPrice: res.data.couponPrice,
grouponPrice: res.data.grouponPrice,
freightPrice: res.data.freightPrice,
goodsTotalPrice: res.data.goodsTotalPrice,
orderTotalPrice: res.data.orderTotalPrice,
addressId: res.data.addressId,
couponId: res.data.couponId,
grouponRulesId: res.data.grouponRulesId,
});
},
selectAddress() {
wx.navigateTo({
url: '/pages/ucenter/address/address',
})
},
addAddress() {
wx.navigateTo({
url: '/pages/ucenter/addressAdd/addressAdd',
})
},
onReady: function () {
// 页面渲染完成
}
wx.hideLoading();
});
},
selectAddress() {
wx.navigateTo({
url: '/pages/ucenter/address/address',
})
},
addAddress() {
wx.navigateTo({
url: '/pages/ucenter/addressAdd/addressAdd',
})
},
onReady: function() {
// 页面渲染完成
},
onShow: function () {
// 页面显示
wx.showLoading({
title: '加载中...',
})
try {
var cartId = wx.getStorageSync('cartId');
if (cartId) {
this.setData({
'cartId': cartId
});
}
},
onShow: function() {
// 页面显示
wx.showLoading({
title: '加载中...',
});
try {
var cartId = wx.getStorageSync('cartId');
if (cartId) {
this.setData({
'cartId': cartId
});
}
var addressId = wx.getStorageSync('addressId');
if (addressId) {
this.setData({
'addressId': addressId
});
}
var addressId = wx.getStorageSync('addressId');
if (addressId) {
this.setData({
'addressId': addressId
});
}
var couponId = wx.getStorageSync('couponId');
if (couponId) {
this.setData({
'couponId': couponId
});
}
} catch (e) {
// Do something when catch error
console.log(e);
}
this.getCheckoutInfo();
},
onHide: function () {
// 页面隐藏
var couponId = wx.getStorageSync('couponId');
if (couponId) {
this.setData({
'couponId': couponId
});
}
},
onUnload: function () {
// 页面关闭
var grouponRulesId = wx.getStorageSync('grouponRulesId');
if (grouponRulesId) {
this.setData({
'grouponRulesId': grouponRulesId
});
}
},
submitOrder: function () {
if (this.data.addressId <= 0) {
util.showErrorToast('请选择收货地址');
return false;
}
util.request(api.OrderSubmit, { cartId: this.data.cartId, addressId: this.data.addressId, couponId: this.data.couponId }, 'POST').then(res => {
if (res.errno === 0) {
const orderId = res.data.orderId;
var grouponLinkId = wx.getStorageSync('grouponLinkId');
if (grouponLinkId) {
this.setData({
'grouponLinkId': grouponLinkId
});
}
} catch (e) {
// Do something when catch error
console.log(e);
}
// 模拟支付成功,同理,后台也仅仅是返回一个成功的消息而已
// wx.showModal({
// title: '目前不能微信支付',
// content: '点击确定模拟支付成功,点击取消模拟未支付成功',
// success: function(res) {
// if (res.confirm) {
// util.request(api.OrderPrepay, { orderId: orderId }, 'POST').then(res => {
// if (res.errno === 0) {
// wx.redirectTo({
// url: '/pages/payResult/payResult?status=1&orderId=' + orderId
// });
// }
// else{
// wx.redirectTo({
// url: '/pages/payResult/payResult?status=0&orderId=' + orderId
// });
// }
// });
// }
// else if (res.cancel) {
// wx.redirectTo({
// url: '/pages/payResult/payResult?status=0&orderId=' + orderId
// });
// }
this.getCheckoutInfo();
},
onHide: function() {
// 页面隐藏
// }
// });
},
onUnload: function() {
// 页面关闭
util.request(api.OrderPrepay, {
orderId: orderId
}, 'POST').then(function (res) {
if (res.errno === 0) {
const payParam = res.data;
console.log("支付过程开始")
wx.requestPayment({
'timeStamp': payParam.timeStamp,
'nonceStr': payParam.nonceStr,
'package': payParam.packageValue,
'signType': payParam.signType,
'paySign': payParam.paySign,
'success': function (res) {
console.log("支付过程成功")
wx.redirectTo({
url: '/pages/payResult/payResult?status=1&orderId=' + orderId
});
},
'fail': function (res) {
console.log("支付过程失败")
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
},
'complete': function (res) {
console.log("支付过程结束")
}
});
}
else{
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
},
submitOrder: function() {
if (this.data.addressId <= 0) {
util.showErrorToast('请选择收货地址');
return false;
}
util.request(api.OrderSubmit, {
cartId: this.data.cartId,
addressId: this.data.addressId,
couponId: this.data.couponId,
grouponRulesId: this.data.grouponRulesId,
grouponLinkId: this.data.grouponLinkId
}, 'POST').then(res => {
if (res.errno === 0) {
const orderId = res.data.orderId;
util.request(api.OrderPrepay, {
orderId: orderId
}, 'POST').then(function(res) {
if (res.errno === 0) {
const payParam = res.data;
console.log("支付过程开始");
wx.requestPayment({
'timeStamp': payParam.timeStamp,
'nonceStr': payParam.nonceStr,
'package': payParam.packageValue,
'signType': payParam.signType,
'paySign': payParam.paySign,
'success': function(res) {
console.log("支付过程成功");
wx.redirectTo({
url: '/pages/payResult/payResult?status=1&orderId=' + orderId
});
} else {
},
'fail': function(res) {
console.log("支付过程失败");
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
},
'complete': function(res) {
console.log("支付过程结束")
}
});
} else {
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
});
}
})
\ No newline at end of file
} else {
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
});
}
});
\ No newline at end of file
......@@ -8,6 +8,8 @@ Page({
data: {
id: 0,
goods: {},
groupon: [], //该商品支持的团购规格
grouponLink: {}, //参与的团购
attribute: [],
issueList: [],
comment: [],
......@@ -26,16 +28,21 @@ Page({
hasCollectImage: '/static/images/icon_collect_checked.png',
collectImage: '/static/images/icon_collect.png',
shareImage: '',
isGroupon: false, //标识是否是一个参团购买
soldout: false
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getGoodsInfo();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
// 页面分享
onShareAppMessage: function() {
let that = this;
return {
title: that.data.goods.name,
desc: '唯爱与美食不可辜负',
path: '/pages/index/index?goodId=' + this.data.id
}
},
// 保存分享图
saveShare: function() {
let that = this;
wx.downloadFile({
......@@ -69,6 +76,24 @@ Page({
})
},
//从分享的团购进入
getGrouponInfo: function(grouponId) {
let that = this;
util.request(api.GroupOnJoin, {
grouponId: grouponId
}).then(function(res) {
if (res.errno === 0) {
that.setData({
grouponLink: res.data.groupon,
id: res.data.goods.id
});
//获取商品详情
that.getGoodsInfo();
}
});
},
// 获取商品信息
getGoodsInfo: function() {
let that = this;
util.request(api.GoodsDetail, {
......@@ -107,9 +132,26 @@ Page({
productList: res.data.productList,
userHasCollect: res.data.userHasCollect,
shareImage: res.data.shareImage,
checkedSpecPrice: res.data.info.retailPrice
checkedSpecPrice: res.data.info.retailPrice,
groupon: res.data.groupon
});
//如果是通过分享的团购参加团购,则团购项目应该与分享的一致并且不可更改
if (that.data.isGroupon) {
let groupons = that.data.groupon;
for (var i = 0; i < groupons.length; i++) {
if (groupons[i].id != that.data.grouponLink.rulesId) {
groupons.splice(i, 1);
}
}
groupons[0].checked = true;
//重设团购规格
that.setData({
groupon: groupons
});
}
if (res.data.userHasCollect == 1) {
that.setData({
collectImage: that.data.hasCollectImage
......@@ -121,12 +163,13 @@ Page({
}
WxParse.wxParse('goodsDetail', 'html', res.data.info.detail, that);
//获取推荐商品
that.getGoodsRelated();
}
});
},
// 获取推荐商品
getGoodsRelated: function() {
let that = this;
util.request(api.GoodsRelated, {
......@@ -138,8 +181,39 @@ Page({
});
}
});
},
// 团购选择
clickGroupon: function(event) {
let that = this;
//参与团购,不可更改选择
if (that.data.isGroupon) {
return;
}
let specName = event.currentTarget.dataset.name;
let specValueId = event.currentTarget.dataset.valueId;
let _grouponList = this.data.groupon;
for (let i = 0; i < _grouponList.length; i++) {
if (_grouponList[i].id == specValueId) {
if (_grouponList[i].checked) {
_grouponList[i].checked = false;
} else {
_grouponList[i].checked = true;
}
} else {
_grouponList[i].checked = false;
}
}
this.setData({
groupon: _grouponList,
});
},
// 规格选择
clickSkuValue: function(event) {
let that = this;
let specName = event.currentTarget.dataset.name;
......@@ -173,6 +247,20 @@ Page({
//重新计算哪些值不可以点击
},
//获取选中的团购信息
getCheckedGrouponValue: function() {
let checkedValues = {};
let _grouponList = this.data.groupon;
for (let i = 0; i < _grouponList.length; i++) {
if (_grouponList[i].checked) {
checkedValues = _grouponList[i];
}
}
return checkedValues;
},
//获取选中的规格信息
getCheckedSpecValue: function() {
let checkedValues = [];
......@@ -194,10 +282,7 @@ Page({
return checkedValues;
},
//根据已选的值,计算其它值的状态
setSpecValueStatus: function() {
},
//判断规格是否选择完整
isCheckedAllSpec: function() {
return !this.getCheckedSpecValue().some(function(v) {
......@@ -206,13 +291,15 @@ Page({
}
});
},
getCheckedSpecKey: function() {
let checkedValue = this.getCheckedSpecValue().map(function(v) {
return v.valueText;
});
return checkedValue;
},
// 规格改变时,重新计算价格及显示信息
changeSpecInfo: function() {
let checkedNameValue = this.getCheckedSpecValue();
......@@ -236,7 +323,6 @@ Page({
});
}
if (this.isCheckedAllSpec()) {
this.setData({
checkedSpecText: this.data.tmpSpecText
......@@ -274,6 +360,8 @@ Page({
}
},
// 获取选中的产品(根据规格)
getCheckedProductItem: function(key) {
return this.data.productList.filter(function(v) {
if (v.specifications.toString() == key.toString()) {
......@@ -283,16 +371,22 @@ Page({
}
});
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.setData({
id: parseInt(options.id)
});
this.getGoodsInfo();
},
onReady: function() {
// 页面渲染完成
if (options.id) {
this.setData({
id: parseInt(options.id)
});
this.getGoodsInfo();
}
if (options.grouponId) {
this.setData({
isGroupon: true,
});
this.getGrouponInfo(options.grouponId);
}
},
onShow: function() {
// 页面显示
......@@ -305,29 +399,10 @@ Page({
}
});
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
switchAttrPop: function() {
if (this.data.openAttr == false) {
this.setData({
openAttr: !this.data.openAttr
});
}
},
closeAttr: function() {
this.setData({
openAttr: false,
});
},
//添加或是取消收藏
addCollectOrNot: function() {
let that = this;
//添加或是取消收藏
util.request(api.CollectAddOrDelete, {
type: 0,
valueId: this.data.id
......@@ -356,11 +431,8 @@ Page({
});
},
openCartPage: function() {
wx.switchTab({
url: '/pages/cart/cart'
});
},
//立即购买(先自动加入购物车)
addFast: function() {
var that = this;
if (this.data.openAttr == false) {
......@@ -400,6 +472,9 @@ Page({
return false;
}
//验证团购是否有效
let checkedGroupon = this.getCheckedGrouponValue();
//立即购买
util.request(api.CartFastAdd, {
goodsId: this.data.goods.id,
......@@ -412,6 +487,8 @@ Page({
// 如果storage中设置了cartId,则是立即购买,否则是购物车购买
try {
wx.setStorageSync('cartId', res.data);
wx.setStorageSync('grouponRulesId', checkedGroupon.id);
wx.setStorageSync('grouponLinkId', that.data.grouponLink.id);
wx.navigateTo({
url: '/pages/checkout/checkout'
})
......@@ -429,6 +506,8 @@ Page({
},
//添加到购物车
addToCart: function() {
var that = this;
if (this.data.openAttr == false) {
......@@ -505,6 +584,7 @@ Page({
}
},
cutNumber: function() {
this.setData({
number: (this.data.number - 1 > 1) ? this.data.number - 1 : 1
......@@ -514,5 +594,46 @@ Page({
this.setData({
number: this.data.number + 1
});
}
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
switchAttrPop: function() {
if (this.data.openAttr == false) {
this.setData({
openAttr: !this.data.openAttr
});
}
},
closeAttr: function() {
this.setData({
openAttr: false,
});
},
openCartPage: function() {
wx.switchTab({
url: '/pages/cart/cart'
});
},
onReady: function() {
// 页面渲染完成
},
// 下拉刷新
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getGoodsInfo();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
//根据已选的值,计算其它值的状态
setSpecValueStatus: function() {
},
})
\ No newline at end of file
<view class="container">
<swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{goods.gallery}}" wx:key="*this">
<image src="{{item}}" background-size="cover"></image>
</swiper-item>
</swiper>
<view class="service-policy">
<swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{goods.gallery}}" wx:key="*this">
<image src="{{item}}" background-size="cover"></image>
</swiper-item>
</swiper>
<!-- 分享 -->
<view class="service-policy" wx:if="{{!isGroupon}}">
<button class="savesharebtn" bindtap="saveShare">分享朋友圈</button>
<button class="sharebtn" open-type="share">分享给朋友</button>
</view>
<view class="goods-info">
<view class="c">
<text class="name">{{goods.name}}</text>
<text class="desc">{{goods.goodsBrief}}</text>
<text class="price">¥{{checkedSpecPrice}}</text>
<view class="brand" wx:if="{{brand.name}}">
<navigator url="../brandDetail/brandDetail?id={{brand.id}}">
<text>{{brand.name}}</text>
</navigator>
</view>
</view>
<view class="goods-info">
<view class="c">
<text class="name">{{goods.name}}</text>
<text class="desc">{{goods.goodsBrief}}</text>
<view class="price">
<view class="counterPrice">原价:¥{{goods.counterPrice}}</view>
<view class="retailPrice">现价:¥{{checkedSpecPrice}}</view>
</view>
<view class="brand" wx:if="{{brand.name}}">
<navigator url="../brandDetail/brandDetail?id={{brand.id}}">
<text>{{brand.name}}</text>
</navigator>
</view>
</view>
<view class="section-nav section-attr" bindtap="switchAttrPop">
<view class="t">{{checkedSpecText}}</view>
<image class="i" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<view class="section-nav section-attr" bindtap="switchAttrPop">
<view class="t">{{checkedSpecText}}</view>
<image class="i" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<view class="comments" wx:if="{{comment.count > 0}}">
<view class="h">
<navigator url="/pages/comment/comment?valueId={{goods.id}}&type=0">
<text class="t">评价({{comment.count > 999 ? '999+' : comment.count}})</text>
<text class="i">查看全部</text>
</navigator>
</view>
<view class="comments" wx:if="{{comment.count > 0}}">
<view class="h">
<navigator url="/pages/comment/comment?valueId={{goods.id}}&type=0">
<text class="t">评价({{comment.count > 999 ? '999+' : comment.count}})</text>
<text class="i">查看全部</text>
</navigator>
<view class="b">
<view class="item" wx:for="{{comment.data}}" wx:key="id">
<view class="info">
<view class="user">
<image src="{{item.avatar}}"></image>
<text>{{item.nickname}}</text>
</view>
<view class="time">{{item.addTime}}</view>
</view>
<view class="b">
<view class="item" wx:for="{{comment.data}}" wx:key="id">
<view class="info">
<view class="user">
<image src="{{item.avatar}}"></image>
<text>{{item.nickname}}</text>
</view>
<view class="time">{{item.addTime}}</view>
</view>
<view class="content">
{{item.content}}
</view>
<view class="imgs" wx:if="{{item.picList.length > 0}}">
<image class="img" wx:for="{{item.picList}}" wx:key="*this" wx:for-item="iitem" src="{{iitem}} "></image>
</view>
<!-- <view class="spec">白色 2件</view> -->
</view>
<view class="content">
{{item.content}}
</view>
</view>
<view class="goods-attr">
<view class="t">商品参数</view>
<view class="l">
<view class="item" wx:for="{{attribute}}" wx:key="name">
<text class="left">{{item.attribute}}</text>
<text class="right">{{item.value}}</text>
</view>
<view class="imgs" wx:if="{{item.picList.length > 0}}">
<image class="img" wx:for="{{item.picList}}" wx:key="*this" wx:for-item="iitem" src="{{iitem}} "></image>
</view>
</view>
</view>
<view class="detail">
<import src="/lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
</view>
<view class="goods-attr">
<view class="t">商品参数</view>
<view class="l">
<view class="item" wx:for="{{attribute}}" wx:key="name">
<text class="left">{{item.attribute}}</text>
<text class="right">{{item.value}}</text>
</view>
</view>
</view>
<view class="detail">
<import src="/lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
</view>
<view class="common-problem">
<view class="h">
<view class="line"></view>
<text class="title">常见问题</text>
<view class="common-problem">
<view class="h">
<view class="line"></view>
<text class="title">常见问题</text>
</view>
<view class="b">
<view class="item" wx:for="{{issueList}}" wx:key="id">
<view class="question-box">
<text class="spot"></text>
<text class="question">{{item.question}}</text>
</view>
<view class="b">
<view class="item" wx:for="{{issueList}}" wx:key="id">
<view class="question-box">
<text class="spot"></text>
<text class="question">{{item.question}}</text>
</view>
<view class="answer">
{{item.answer}}
</view>
</view>
<view class="answer">
{{item.answer}}
</view>
</view>
</view>
</view>
<view class="related-goods" wx:if="{{relatedGoods.length > 0}}">
<view class="h">
<view class="line"></view>
<text class="title">大家都在看</text>
</view>
<view class="b">
<view class="item" wx:for="{{relatedGoods}}" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<text class="name">{{item.name}}</text>
<text class="price">¥{{item.retailPrice}}</text>
</navigator>
</view>
</view>
<!-- 大家都在看 -->
<view class="related-goods" wx:if="{{relatedGoods.length > 0}}">
<view class="h">
<view class="line"></view>
<text class="title">大家都在看</text>
</view>
<view class="b">
<view class="item" wx:for="{{relatedGoods}}" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<text class="name">{{item.name}}</text>
<text class="price">¥{{item.retailPrice}}</text>
</navigator>
</view>
</view>
</view>
</view>
<!-- 规格选择界面 -->
<view class="attr-pop-box" hidden="{{!openAttr}}">
<view class="attr-pop">
<view class="close" bindtap="closeAttr">
<image class="icon" src="/static/images/icon_close.png"></image>
<view class="attr-pop">
<view class="close" bindtap="closeAttr">
<image class="icon" src="/static/images/icon_close.png"></image>
</view>
<view class="img-info">
<image class="img" src="{{goods.picUrl}}"></image>
<view class="info">
<view class="c">
<view class="p">价格:¥{{checkedSpecPrice}}</view>
<view class="a">{{tmpSpecText}}</view>
</view>
</view>
</view>
<!-- 规格列表 -->
<view class="spec-con">
<view class="spec-item" wx:for="{{specificationList}}" wx:key="name">
<view class="name">{{item.name}}</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">{{vitem.value}}</view>
</view>
<view class="img-info">
<image class="img" src="{{goods.picUrl}}"></image>
<view class="info">
<view class="c">
<view class="p">价格:¥{{checkedSpecPrice}}</view>
<view class="a">{{tmpSpecText}}</view>
</view>
</view>
</view>
<view class="spec-con" wx:if="{{groupon.length > 0}}">
<view class="spec-item">
<view class="name">团购立减</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickGroupon" wx:for="{{groupon}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">¥{{vitem.discount}} ({{vitem.discountMember}}人)</view>
</view>
</view>
<view class="spec-con">
<view class="spec-item" wx:for="{{specificationList}}" wx:key="name">
<view class="name">{{item.name}}</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">{{vitem.value}}</view>
</view>
</view>
</view>
<view class="number-item">
<view class="name">数量</view>
<view class="selnum">
<view class="cut" bindtap="cutNumber">-</view>
<input value="{{number}}" class="number" disabled="true" type="number" />
<view class="add" bindtap="addNumber">+</view>
</view>
</view>
<!-- 数量 -->
<view class="number-item">
<view class="name">数量</view>
<view class="selnum">
<view class="cut" bindtap="cutNumber">-</view>
<input value="{{number}}" class="number" disabled="true" type="number" />
<view class="add" bindtap="addNumber">+</view>
</view>
</view>
</view>
</view>
</view>
<!-- 联系客服 -->
<view class="contact">
<contact-button style="opacity:0;position:absolute;" type="default-dark" session-from="weapp" size="27">
</contact-button>
<contact-button style="opacity:0;position:absolute;" type="default-dark" session-from="weapp" size="27">
</contact-button>
</view>
<!-- 底部按钮 -->
<view class="bottom-btn">
<view class="l l-collect" bindtap="addCollectOrNot">
<image class="icon" src="{{ collectImage }}"></image>
</view>
<view class="l l-cart">
<view class="box">
<text class="cart-count">{{cartGoodsCount}}</text>
<image bindtap="openCartPage" class="icon" src="/static/images/ic_menu_shoping_nor.png"></image>
</view>
<view class="l l-collect" bindtap="addCollectOrNot" wx:if="{{!isGroupon}}">
<image class="icon" src="{{ collectImage }}"></image>
</view>
<view class="l l-cart" wx:if="{{!isGroupon}}">
<view class="box">
<text class="cart-count">{{cartGoodsCount}}</text>
<image bindtap="openCartPage" class="icon" src="/static/images/ic_menu_shoping_nor.png"></image>
</view>
<view class="c" bindtap="addFast" wx:if="{{!soldout}}">立即购买</view>
<view class="r" bindtap="addToCart" wx:if="{{!soldout}}">加入购物车</view>
<view class="n" wx:if="{{soldout}}">商品已售空</view>
</view>
<view class="r" bindtap="addToCart" wx:if="{{!soldout}}" wx:if="{{!isGroupon}}">加入购物车</view>
<view class="c" bindtap="addFast" wx:if="{{!soldout}}">{{isGroupon?'参加团购':'立即购买'}}</view>
<view class="n" wx:if="{{soldout}}">商品已售空</view>
</view>
\ No newline at end of file
......@@ -71,10 +71,23 @@
}
.goods-info .price {
height: 35rpx;
font-size: 35rpx;
line-height: 35rpx;
color: #b4282d;
height: 70rpx;
align-content: center;
}
.goods-info .counterPrice {
float: left;
padding-left: 120rpx;
text-decoration: line-through;
font-size: 30rpx;
color: #999;
}
.goods-info .retailPrice {
/* float: right; */
padding-left: 60rpx;
font-size: 30rpx;
color: #a78845;
}
.goods-info .brand {
......@@ -418,6 +431,7 @@
width: 750rpx;
height: auto;
overflow: hidden;
padding-bottom: 80rpx;
}
.related-goods .h {
......
var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
Page({
data: {
id: 0,
orderId: 0,
groupon: {},
linkGrouponId: 0,
joiners: [],
orderInfo: {},
orderGoods: [],
expressInfo: {},
flag: false,
handleOption: {}
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.setData({
id: options.id
});
this.getOrderDetail();
},
// 页面分享
onShareAppMessage: function() {
let that = this;
return {
title: '邀请团购',
desc: '唯爱与美食不可辜负',
path: '/pages/index/index?grouponId=' + this.data.linkGrouponId
}
},
shareGroupon: function() {
let that = this;
wx.showActionSheet({
itemList: ['分享给朋友', '分享到朋友圈'],
success: function(res) {
if (res.tapIndex == 0) {
wx.showModal({
title: '提示',
content: '点击右上角 "..." 转发给朋友',
showCancel: false
});
} else if (res.tapIndex == 1) {
that.saveShare();
} else {
console.log(res.tapIndex);
}
},
fail: function(res) {
console.log(res.errMsg);
}
})
},
// 保存分享图
saveShare: function() {
let that = this;
wx.downloadFile({
url: that.data.groupon.shareUrl,
success: function(res) {
console.log(res)
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function(res) {
wx.showModal({
title: '存图成功',
content: '图片成功保存到相册了,可以分享到朋友圈了',
showCancel: false,
confirmText: '好的',
confirmColor: '#a78845',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
})
},
fail: function(res) {
console.log('fail')
}
})
},
fail: function() {
console.log('fail')
}
})
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderDetail();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
//获取物流信息
getOrderExpress: function() {
let that = this;
util.request(api.ExpressQuery, {
expCode: that.data.orderInfo.expCode,
expNo: that.data.orderInfo.expNo
}, 'POST').then(function(res) {
if (res.errno === 0) {
that.setData({
expressInfo: res.data
});
}
});
},
expandDetail: function() {
let that = this;
this.setData({
flag: !that.data.flag
})
},
getOrderDetail: function() {
let that = this;
util.request(api.GroupOnDetail, {
grouponId: that.data.id
}).then(function(res) {
if (res.errno === 0) {
that.setData({
joiners: res.data.joiners,
groupon: res.data.groupon,
linkGrouponId: res.data.linkGrouponId,
orderId: res.data.orderInfo.id,
orderInfo: res.data.orderInfo,
orderGoods: res.data.orderGoods,
handleOption: res.data.orderInfo.handleOption
});
// 请求物流信息,仅当订单状态为发货时才请求
if (res.data.orderInfo.handleOption.confirm) {
that.getOrderExpress();
}
}
});
},
// “去付款”按钮点击效果
payOrder: function() {
let that = this;
util.request(api.OrderPrepay, {
orderId: that.data.orderId
}, 'POST').then(function(res) {
if (res.errno === 0) {
const payParam = res.data;
console.log("支付过程开始");
wx.requestPayment({
'timeStamp': payParam.timeStamp,
'nonceStr': payParam.nonceStr,
'package': payParam.packageValue,
'signType': payParam.signType,
'paySign': payParam.paySign,
'success': function(res) {
console.log("支付过程成功");
util.redirect('/pages/ucenter/order/order');
},
'fail': function(res) {
console.log("支付过程失败");
util.showErrorToast('支付失败');
},
'complete': function(res) {
console.log("支付过程结束")
}
});
}
});
},
// “取消订单”点击效果
cancelOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确定要取消此订单?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderCancel, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '取消订单成功'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
// “取消订单并退款”点击效果
refundOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确定要取消此订单?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderRefund, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '取消订单成功'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
// “删除”点击效果
deleteOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确定要删除此订单?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderDelete, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '删除订单成功'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
// “确认收货”点击效果
confirmOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确认收货?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderConfirm, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '确认收货成功!'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
});
\ No newline at end of file
{
"navigationBarTitleText": "团购详情"
}
\ No newline at end of file
<view class="container">
<view class="order-info">
<view class="item-a">下单时间:{{orderInfo.addTime}}</view>
<view class="item-b">订单编号:{{orderInfo.orderSn}}</view>
<view class="item-c">
<view class="l">实付:
<text class="cost">¥{{orderInfo.actualPrice}}</text>
</view>
<view class="r">
<view class="btn active" bindtap="shareGroupon">邀请参团</view>
</view>
</view>
</view>
<view class="menu-list-pro">
<view class="h">
<view class="label">参与团购 ( {{joiners.length}}人)</view>
<view class="status">查看全部</view>
</view>
<view class="menu-list-item" wx:for-items="{{joiners}}" wx:key="id" data-id="{{item.id}}">
<image class="icon" src="{{item.avatar}}"></image>
<text class="txt">{{item.nickname}}</text>
</view>
</view>
<view class="order-goods">
<view class="h">
<view class="label">商品信息</view>
<view class="status">{{orderInfo.orderStatusText}}</view>
</view>
<view class="goods">
<view class="item" wx:for="{{orderGoods}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
</view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view>
<view class="attr">{{item.goodsSpecificationValues}}</view>
<view class="price">¥{{item.retailPrice}}</view>
</view>
</view>
</view>
<view class="order-bottom">
<view class="address">
<view class="t">
<text class="name">{{orderInfo.consignee}}</text>
<text class="mobile">{{orderInfo.mobile}}</text>
</view>
<view class="b">{{orderInfo.address}}</view>
</view>
<view class="total">
<view class="t">
<text class="label">商品合计:</text>
<text class="txt">¥{{orderInfo.goodsPrice}}</text>
</view>
<view class="t">
<text class="label">运费:</text>
<text class="txt">¥{{orderInfo.freightPrice}}</text>
</view>
</view>
<view class="pay-fee">
<text class="label">实付:</text>
<text class="txt">¥{{orderInfo.actualPrice}}</text>
</view>
</view>
</view>
<!-- 物流信息,仅收货状态下可见 -->
<view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}">
<view class="expand">
<view class="title">
<view class="t">快递公司:{{expressInfo.expName}}</view>
<view class="b">物流单号:{{expressInfo.expCode}}</view>
</view>
<image class="ti" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<!-- <view class="order-express" > -->
<view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem" wx:if="{{ flag }}">
<view class="trace">
<view class="acceptStation">{{iitem.AcceptStation}}</view>
<view class="acceptTime">{{iitem.AcceptTime}}</view>
</view>
</view>
</view>
<!-- </view> -->
</view>
\ No newline at end of file
page {
height: 100%;
width: 100%;
background: #f4f4f4;
}
.order-info {
padding-top: 25rpx;
background: #fff;
height: auto;
overflow: hidden;
}
.item-a {
padding-left: 31.25rpx;
height: 42.5rpx;
padding-bottom: 12.5rpx;
line-height: 30rpx;
font-size: 30rpx;
color: #666;
}
.item-b {
padding-left: 31.25rpx;
height: 29rpx;
line-height: 29rpx;
margin-top: 12.5rpx;
margin-bottom: 41.5rpx;
font-size: 30rpx;
color: #666;
}
.item-c {
margin-left: 31.25rpx;
border-top: 1px solid #f4f4f4;
height: 103rpx;
line-height: 103rpx;
}
.item-c .l {
float: left;
}
.item-c .r {
height: 103rpx;
float: right;
display: flex;
align-items: center;
padding-right: 16rpx;
}
.item-c .r .btn {
float: right;
}
.item-c .cost {
color: #b4282d;
}
.item-c .btn {
line-height: 66rpx;
border-radius: 5rpx;
text-align: center;
margin: 0 15rpx;
padding: 0 20rpx;
height: 66rpx;
}
.item-c .btn.active {
background: #a78845;
color: #fff;
}
.order-goods {
margin-top: 20rpx;
background: #fff;
}
.order-goods .h {
height: 93.75rpx;
line-height: 93.75rpx;
margin-left: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
padding-right: 31.25rpx;
}
.order-goods .h .label {
float: left;
font-size: 30rpx;
color: #333;
}
.order-goods .h .status {
float: right;
font-size: 30rpx;
color: #b4282d;
}
.order-goods .item {
display: flex;
align-items: center;
height: 192rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order-goods .item:last-child {
border-bottom: none;
}
.order-goods .item .img {
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
}
.order-goods .item .img image {
height: 145.83rpx;
width: 145.83rpx;
}
.order-goods .item .info {
flex: 1;
height: 145.83rpx;
margin-left: 20rpx;
}
.order-goods .item .t {
margin-top: 8rpx;
height: 33rpx;
line-height: 33rpx;
margin-bottom: 10.5rpx;
}
.order-goods .item .t .name {
display: block;
float: left;
height: 33rpx;
line-height: 33rpx;
color: #333;
font-size: 30rpx;
}
.order-goods .item .t .number {
display: block;
float: right;
height: 33rpx;
text-align: right;
line-height: 33rpx;
color: #333;
font-size: 30rpx;
}
.order-goods .item .attr {
height: 29rpx;
line-height: 29rpx;
color: #666;
margin-bottom: 25rpx;
font-size: 25rpx;
}
.order-goods .item .price {
display: block;
float: left;
height: 30rpx;
line-height: 30rpx;
color: #333;
font-size: 30rpx;
}
.order-goods .item .btn {
height: 50rpx;
line-height: 50rpx;
border-radius: 5rpx;
text-align: center;
display: block;
float: right;
margin: 0 15rpx;
padding: 0 20rpx;
}
.order-goods .item .btn.active {
background: #b4282d;
color: #fff;
}
.order-bottom {
margin-top: 20rpx;
padding-left: 31.25rpx;
height: auto;
overflow: hidden;
background: #fff;
}
.order-bottom .address {
height: 128rpx;
padding-top: 25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order-bottom .address .t {
height: 35rpx;
line-height: 35rpx;
margin-bottom: 7.5rpx;
}
.order-bottom .address .name {
display: inline-block;
height: 35rpx;
width: 140rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .address .mobile {
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .address .b {
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .total {
height: 106rpx;
padding-top: 20rpx;
border-bottom: 1px solid #f4f4f4;
}
.order-bottom .total .t {
height: 30rpx;
line-height: 30rpx;
margin-bottom: 7.5rpx;
display: flex;
}
.order-bottom .total .label {
width: 150rpx;
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .total .txt {
flex: 1;
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .pay-fee {
height: 81rpx;
line-height: 81rpx;
}
.order-bottom .pay-fee .label {
display: inline-block;
width: 140rpx;
color: #b4282d;
}
.order-bottom .pay-fee .txt {
display: inline-block;
width: 140rpx;
color: #b4282d;
}
.order-express {
margin-top: 20rpx;
width: 100%;
height: 100rpx;
background: #fff;
}
.order-express .expand {
/* margin-top: 20rpx; */
width: 100%;
height: 100rpx;
background: #fff;
/* border: 10rpx #a78845; */
}
.order-express .title {
float: left;
margin-bottom: 20rpx;
padding: 10rpx;
}
.order-express .ti {
float: right;
width: 52rpx;
height: 52rpx;
margin-right: 16rpx;
margin-top: 28rpx;
}
.order-express .t {
font-size: 29rpx;
margin-left: 10.25rpx;
color: #a78845;
}
.order-express .b {
font-size: 29rpx;
margin-left: 10.25rpx;
color: #a78845;
}
.order-express .traces {
padding: 17.5rpx;
background: #fff;
border-bottom: 1rpx solid #f1e6cdcc;
}
.order-express .trace {
padding-bottom: 17.5rpx;
padding-top: 17.5rpx;
background: #fff;
}
.order-express .acceptTime {
margin-top: 20rpx;
margin-right: 40rpx;
text-align: right;
font-size: 26rpx;
}
.order-express .acceptStation {
font-size: 26rpx;
}
.menu-list-pro {
margin-top: 20rpx;
overflow-x: scroll;
white-space: nowrap;
text-overflow: ellipsis;
height: 260rpx;
width: 100%;
overflow: hidden;
border-bottom: 1rpx #cfc9ca;
background-color: #fff;
}
.menu-list-pro .h {
height: 93.75rpx;
line-height: 93.75rpx;
margin-left: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
padding-right: 31.25rpx;
}
.menu-list-pro .h .label {
float: left;
font-size: 30rpx;
color: #333;
}
.menu-list-pro .h .status {
float: right;
font-size: 30rpx;
color: #a78845;
}
.menu-list-pro .menu-list-item {
display: block;
float: left;
height: 110rpx;
width: 80rpx;
margin-top: 30rpx;
margin-bottom: 30rpx;
margin-left: 40rpx;
}
.menu-list-pro .icon {
height: 80rpx;
width: 80rpx;
border-radius: 12rpx;
box-shadow: 0px 4rpx 4rpx 0px #cfc9ca;
}
.menu-list-pro .txt {
display: block;
float: left;
width: 80rpx;
margin-top: 5rpx;
font-size: 22rpx;
color: #a78845;
}
var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
Page({
data: {
orderList: [],
showType: 0
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderList();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getOrderList() {
let that = this;
util.request(api.GroupOnMy, {
showType: that.data.showType
}).then(function(res) {
if (res.errno === 0) {
that.setData({
orderList: res.data.data
});
}
});
},
switchTab: function(event) {
let showType = event.currentTarget.dataset.index;
this.setData({
showType: showType
});
this.getOrderList();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
this.getOrderList();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
})
\ No newline at end of file
{
"navigationBarTitleText": "我的团购",
"usingComponents": {
"zan-capsule": "../../../dist/capsule/index"
}
}
\ No newline at end of file
<view class="container">
<view class="orders-switch">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
<view class="txt">发起的团购</view>
</view>
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
<view class="txt">参加的团购</view>
</view>
</view>
<view class="no-order" wx:if="{{orderList.length <= 0}}">
<view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>尚未参加任何团购</text>
</view>
</view>
<view class="orders">
<navigator url="../grouponDetail/grouponDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id">
<view class="h">
<view class="l">订单编号:{{item.orderSn}}</view>
<view class="r">{{item.orderStatusText}}</view>
</view>
<view class="j">
<view class="l">团购立减:¥{{item.rules.discount}}</view>
<view class="r">参与时间:{{item.groupon.addTime}}</view>
</view>
<view class="i">
<view class="l">团购要求:{{item.rules.discountMember}}人</view>
<view class="r">当前参与:{{item.joinerCount}}</view>
</view>
<view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem">
<view class="img">
<image src="{{gitem.picUrl}}"></image>
</view>
<view class="info">
<text class="name">{{gitem.goodsName}}</text>
<text class="number">共{{gitem.number}}件商品</text>
</view>
<view class="status"></view>
</view>
<view class="b">
<view class="l">实付:¥{{item.actualPrice}}</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="状态" rightText="{{item.joinerCount>=item.rules.discountMember?'已达成':'团购中'}}" />
</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="发起" rightText="{{item.creator}}" wx:if="{{!item.isCreator}}" />
</view>
</view>
</navigator>
</view>
</view>
\ No newline at end of file
page {
height: 100%;
width: 100%;
background: #f4f4f4;
}
.capsule-tag {
float: right;
/* padding-right: 10rpx; */
}
.zan-capsule + .zan-capsule {
margin-left: 5px;
}
.orders-switch {
width: 100%;
background: #fff;
height: 84rpx;
border-bottom: 1px solid #a78845;
}
.orders-switch .item {
display: inline-block;
height: 82rpx;
width: 50%;
padding: 0 15rpx;
text-align: center;
}
.orders-switch .item .txt {
display: inline-block;
height: 82rpx;
padding: 0 20rpx;
line-height: 82rpx;
color: #333;
font-size: 30rpx;
width: 100%;
}
.orders-switch .item.active .txt {
color: #a78845;
border-bottom: 4rpx solid #a78845;
}
.no-order {
width: 100%;
height: auto;
margin: 0 auto;
}
.no-order .c {
width: 100%;
height: auto;
margin-top: 200rpx;
}
.no-order .c image {
margin: 0 auto;
display: block;
text-align: center;
width: 258rpx;
height: 258rpx;
}
.no-order .c text {
margin: 0 auto;
display: block;
width: 258rpx;
height: 29rpx;
line-height: 29rpx;
text-align: center;
font-size: 29rpx;
color: #999;
}
.orders {
height: auto;
width: 100%;
overflow: hidden;
}
.order {
margin-top: 20rpx;
background: #fff;
}
.order .h {
height: 83.3rpx;
line-height: 83.3rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order .h .l {
float: left;
color: #a78845;
font-size: 26rpx;
}
.order .h .r {
float: right;
color: #a78845;
font-size: 26rpx;
}
.order .i {
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order .i .l {
float: left;
color: #a78845;
font-size: 26rpx;
}
.order .i .r {
float: right;
color: #a78845;
font-size: 26rpx;
}
.order .j {
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
}
.order .j .l {
float: left;
font-size: 26rpx;
color: #a78845;
}
.order .j .r {
float: right;
color: #a78845;
font-size: 26rpx;
}
.order .goods {
display: flex;
align-items: center;
height: 199rpx;
margin-left: 31.25rpx;
}
.order .goods .img {
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
}
.order .goods .img image {
height: 145.83rpx;
width: 145.83rpx;
}
.order .goods .info {
height: 145.83rpx;
flex: 1;
padding-left: 20rpx;
}
.order .goods .name {
margin-top: 30rpx;
display: block;
height: 44rpx;
line-height: 44rpx;
color: #333;
font-size: 30rpx;
}
.order .goods .number {
display: block;
height: 37rpx;
line-height: 37rpx;
color: #666;
font-size: 25rpx;
}
.order .goods .status {
width: 105rpx;
color: #a78845;
font-size: 25rpx;
}
.order .b {
height: 103rpx;
line-height: 103rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-top: 1px solid #f4f4f4;
font-size: 30rpx;
color: #333;
}
.order .b .l {
float: left;
}
.order .b .r {
float: right;
}
.order .b .btn {
margin-top: 19rpx;
height: 64.5rpx;
line-height: 64.5rpx;
text-align: center;
padding: 0 20rpx;
border-radius: 5rpx;
font-size: 28rpx;
color: #fff;
background: #a78845;
}
......@@ -3,13 +3,15 @@ const api = require('../../config/api.js');
const user = require('../../utils/user.js');
//获取应用实例
const app = getApp()
const app = getApp();
Page({
data: {
newGoods: [],
hotGoods: [],
topics: [],
brands: [],
groupons: [],
floorGoods: [],
banner: [],
channel: []
......@@ -41,6 +43,7 @@ Page({
brands: res.data.brandList,
floorGoods: res.data.floorGoodsList,
banner: res.data.banner,
groupons: res.data.grouponList,
channel: res.data.channel
});
}
......@@ -53,8 +56,32 @@ Page({
//这个scene的值存在则证明首页的开启来源于朋友圈分享的图,同时可以通过获取到的goodId的值跳转导航到对应的详情页
var scene = decodeURIComponent(options.scene);
console.log("scene:" + scene);
let info_arr = [];
info_arr = scene.split(',');
let _type = info_arr[0];
let id = info_arr[1];
if (_type == 'goods') {
wx.navigateTo({
url: '../goods/goods?id=' + id
});
} else if (_type == 'groupon') {
wx.navigateTo({
url: '../goods/goods?grouponId=' + id
});
} else {
wx.navigateTo({
url: '../index/index'
});
}
}
// 页面初始化 options为页面跳转所带来的参数
if (options.grouponId) {
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../goods/goods?id=' + scene
url: '../goods/goods?grouponId=' + options.grouponId
});
}
......
{}
\ No newline at end of file
{
"navigationBarTitleText": "",
"usingComponents": {
"zan-capsule": "../../dist/capsule/index"
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment