换系统
This commit is contained in:
parent
c890ad64a2
commit
9a53bca281
@ -4,7 +4,7 @@ Component({
|
|||||||
* 组件的属性列表
|
* 组件的属性列表
|
||||||
*/
|
*/
|
||||||
properties: {
|
properties: {
|
||||||
|
price:String
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,9 +19,10 @@ Component({
|
|||||||
*/
|
*/
|
||||||
methods: {
|
methods: {
|
||||||
sub() {
|
sub() {
|
||||||
wx.navigateTo({
|
// wx.navigateTo({
|
||||||
url: "/pages/order/order"
|
// url: "/pages/order/order"
|
||||||
})
|
// })
|
||||||
|
this.triggerEvent("sub")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -1,7 +1,7 @@
|
|||||||
<view class="bottom">
|
<view class="bottom">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<text>总计</text>
|
<text>总计</text>
|
||||||
<text class="pri">$0.00</text>
|
<text class="pri">${{price}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="right" bindtap="sub">结算</view>
|
<view class="right" bindtap="sub">结算</view>
|
||||||
</view>
|
</view>
|
@ -4,7 +4,10 @@ Component({
|
|||||||
* 组件的属性列表
|
* 组件的属性列表
|
||||||
*/
|
*/
|
||||||
properties: {
|
properties: {
|
||||||
|
title:String,
|
||||||
|
spec:String,
|
||||||
|
price:String,
|
||||||
|
img:String
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<view class="shopinfo">
|
<view class="shopinfo">
|
||||||
<image class="pic"></image>
|
<image class="pic" src="{{img}}"></image>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view class="shopname">产品产品产品产品产品产品产品产品产品产品产品产品产品</view>
|
<view class="shopname">{{title}}</view>
|
||||||
<view class="down">
|
<view class="down">
|
||||||
<view class="shopdesc">
|
<view class="shopdesc">
|
||||||
<text class="size">规格10ml</text>
|
<text class="size">{{spec}}</text>
|
||||||
<text> 0.04kg</text>
|
<!-- <text> 0.04kg</text> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="pri">¥657</view>
|
<view class="pri">¥{{price}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
@ -4,7 +4,7 @@ Component({
|
|||||||
* 组件的属性列表
|
* 组件的属性列表
|
||||||
*/
|
*/
|
||||||
properties: {
|
properties: {
|
||||||
|
price:String
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<view class="orderyf">
|
<view class="orderyf">
|
||||||
<view class="left">运费</view>
|
<view class="left">运费</view>
|
||||||
<view class="right">¥16</view>
|
<view class="right">¥{{price}}</view>
|
||||||
</view>
|
</view>
|
@ -28,7 +28,7 @@ Component({
|
|||||||
methods: {
|
methods: {
|
||||||
rm() {
|
rm() {
|
||||||
|
|
||||||
if (this.data.num == 0) {
|
if (this.data.num < 2) {
|
||||||
|
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
@ -39,7 +39,7 @@ Component({
|
|||||||
url:"Cart/updateNum",
|
url:"Cart/updateNum",
|
||||||
urldata:{
|
urldata:{
|
||||||
id:this.data.gid,
|
id:this.data.gid,
|
||||||
num:this.data.num - 1
|
num:this.data.num
|
||||||
}
|
}
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ Component({
|
|||||||
url:"Cart/updateNum",
|
url:"Cart/updateNum",
|
||||||
urldata:{
|
urldata:{
|
||||||
id:this.data.gid,
|
id:this.data.gid,
|
||||||
num:this.data.num + 1
|
num:this.data.num
|
||||||
}
|
}
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
|
|
||||||
|
@ -1,23 +1,110 @@
|
|||||||
// pages/orderconfirm/orderconfirm.js
|
// pages/order/order.js
|
||||||
Component({
|
import bin from "../../utils/bin"
|
||||||
/**
|
Page({
|
||||||
* 组件的属性列表
|
|
||||||
*/
|
|
||||||
properties: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
list: {}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
bin.getusetid().then((res) => {
|
||||||
|
bin.request({
|
||||||
|
url: "Cart/cart2",
|
||||||
|
urldata: {
|
||||||
|
user_id: res
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
this.setData({
|
||||||
|
list: res.data.result
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件的方法列表
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
methods: {
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
sub() {
|
||||||
|
bin.getusetid().then((res) => {
|
||||||
|
bin.request({
|
||||||
|
url: "Cart/cart3",
|
||||||
|
urldata: {
|
||||||
|
act: "",
|
||||||
|
submit_order: "",
|
||||||
|
user_id: res,
|
||||||
|
address_id: this.data.list.addressList.address_id,
|
||||||
|
user_money: 0,
|
||||||
|
pay_points: 0,
|
||||||
|
couponTypeSelect: 1,
|
||||||
|
coupon_id: 0,
|
||||||
|
pay_code: "weixin",
|
||||||
|
couponCode: ""
|
||||||
|
}
|
||||||
|
}).then((r) => {
|
||||||
|
console.log(r)
|
||||||
|
let { timeStamp, nonceStr, signType, sign } = r.data.data.wdata
|
||||||
|
// timeStamp = timeStamp
|
||||||
|
timeStamp = timeStamp.toString()
|
||||||
|
console.log(timeStamp)
|
||||||
|
wx.requestPayment({
|
||||||
|
timeStamp, nonceStr, package:r.data.data.wdata.package, signType, paySign:sign,
|
||||||
|
success(res) {console.log("成功")},
|
||||||
|
fail(res) {console.log(res)}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -1,11 +1,12 @@
|
|||||||
<view class="orderconfirm">
|
<view class="orderconfirm">
|
||||||
<shopinfo></shopinfo>
|
<shopinfo wx:for="{{list.cartList}}" title="{{item.goods_name}}" price="{{item.goods_price}}" spec="{{item.spec_key_name?item.spec_key_name:'默认规格'}}" img="{{item.image}}"></shopinfo>
|
||||||
|
<!-- <shopinfo></shopinfo> -->
|
||||||
<chooseway></chooseway>
|
<chooseway></chooseway>
|
||||||
<chooseaddr></chooseaddr>
|
<chooseaddr></chooseaddr>
|
||||||
<orderyf></orderyf>
|
<orderyf price="{{list.express_price}}"></orderyf>
|
||||||
<agree></agree>
|
<agree></agree>
|
||||||
<view class="bottom">
|
<view class="bottom">
|
||||||
<bottom></bottom>
|
<bottom price="{{list.totalPrice.total_fee}}" bind:sub="sub"></bottom>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
@ -7,7 +7,8 @@ Page({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
array: ['20粒', '30粒', '50粒', '100粒'],
|
array: ['20粒', '30粒', '50粒', '100粒'],
|
||||||
userid:0
|
userid:0,
|
||||||
|
specs:{item:'默认规格'}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +48,7 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
goods_id: this.data.shopid,
|
goods_id: this.data.shopid,
|
||||||
goods_num: 1,
|
goods_num: 1,
|
||||||
goods_spec:"",
|
goods_spec:this.data.info.goods.goods_spec_list?this.data.info.goods.goods_spec_list[0][e.detail.value].item_id:'',
|
||||||
user_id:this.data.userid
|
user_id:this.data.userid
|
||||||
},
|
},
|
||||||
name:"session_id"
|
name:"session_id"
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
</swiper>
|
</swiper>
|
||||||
<text class="title">{{info.goods.goods_name}}</text>
|
<text class="title">{{info.goods.goods_name}}</text>
|
||||||
<text class="menery">$ {{info.goods.shop_price}}</text>
|
<text class="menery">$ {{info.goods.shop_price}}</text>
|
||||||
<picker bindchange="bindPickerChange" value="{{item.item_id?item.item_id:0}}" range="{{info.goods.goods_spec_list?info.goods.goods_spec_list:['默认规格']}}">
|
<picker bindchange="bindPickerChange" range="{{info.goods.goods_spec_list?info.goods.goods_spec_list[0]:specs}}" range-key="item">
|
||||||
<view class="add">加入购物车</view>
|
<view class="add">加入购物车</view>
|
||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
@ -13,10 +13,19 @@ Page({
|
|||||||
},
|
},
|
||||||
sel(a) {
|
sel(a) {
|
||||||
console.log(a)
|
console.log(a)
|
||||||
this.setData({
|
request({
|
||||||
[`select[${a.detail.index}]`]: !a.detail.select
|
url: "Cart/updateSelect",
|
||||||
|
urldata: {
|
||||||
|
id: this.data.list[a.detail.index].goods_id,
|
||||||
|
select: this.data[`select[${a.detail.index}]`] ? 1 : 0
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
this.setData({
|
||||||
|
[`select[${a.detail.index}]`]: !a.detail.select
|
||||||
|
})
|
||||||
|
this.num();
|
||||||
})
|
})
|
||||||
this.num();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +34,7 @@ Page({
|
|||||||
getlist() {
|
getlist() {
|
||||||
request({
|
request({
|
||||||
url: "Cart/cartList/session_id/" + wx.getStorageSync('openid'),
|
url: "Cart/cartList/session_id/" + wx.getStorageSync('openid'),
|
||||||
data: {
|
urldata: {
|
||||||
user_id: this.data.userid
|
user_id: this.data.userid
|
||||||
}
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
@ -33,7 +42,8 @@ Page({
|
|||||||
this.setData({
|
this.setData({
|
||||||
list: res.data.result
|
list: res.data.result
|
||||||
})
|
})
|
||||||
this.num()
|
// this.num()
|
||||||
|
this.calls();
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -50,9 +60,20 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
sub() {
|
sub() {
|
||||||
wx.navigateTo({
|
let sel = 0;
|
||||||
url: "/pages/orderconfirm/orderconfirm"
|
for (let i in this.data.select) {
|
||||||
})
|
// console.log(i)
|
||||||
|
if (this.data.select[i]) {
|
||||||
|
// num += parseFloat(this.data.list[i].goods_price) * 100
|
||||||
|
sel++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sel > 0) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: "/pages/orderconfirm/orderconfirm"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
@ -138,16 +159,54 @@ Page({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sel == this.data.list.length) {
|
if (sel == this.data.list.length) {
|
||||||
this.setData({
|
request({
|
||||||
all: false,
|
url: "Cart/updateAllSelect",
|
||||||
select: []
|
urldata: {
|
||||||
|
open_id: wx.getStorageSync("openid"),
|
||||||
|
selected: 0
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
this.setData({
|
||||||
|
all: false,
|
||||||
|
select: []
|
||||||
|
})
|
||||||
|
this.num()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.setData({
|
request({
|
||||||
all: true,
|
url: "Cart/updateAllSelect",
|
||||||
select
|
urldata: {
|
||||||
|
open_id: wx.getStorageSync("openid"),
|
||||||
|
selected: 1
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
this.setData({
|
||||||
|
all: true,
|
||||||
|
select
|
||||||
|
})
|
||||||
|
this.num()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
calls() {
|
||||||
|
let sel = 0;
|
||||||
|
let select = []
|
||||||
|
for (let i in this.data.list) {
|
||||||
|
console.log(i)
|
||||||
|
|
||||||
|
select[i] = true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
all: true,
|
||||||
|
select
|
||||||
|
})
|
||||||
this.num()
|
this.num()
|
||||||
|
|
||||||
},
|
},
|
||||||
|
15
utils/bin.js
15
utils/bin.js
@ -14,7 +14,7 @@ let request = function (obj){
|
|||||||
url="http://daigou.sdbairui.com/index.php/WXAPI/" + url
|
url="http://daigou.sdbairui.com/index.php/WXAPI/" + url
|
||||||
let text = ""
|
let text = ""
|
||||||
for(let i in urldata){
|
for(let i in urldata){
|
||||||
if(urldata[i] == undefined){
|
if(urldata[i] === ''){
|
||||||
text += `/${i}`
|
text += `/${i}`
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
@ -51,7 +51,18 @@ let request = function (obj){
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
let getusetid = function(){
|
||||||
|
return new Promise((res,rej)=>{
|
||||||
|
request({
|
||||||
|
url:"User/validateOpenid"
|
||||||
|
|
||||||
|
}).then((r)=>{
|
||||||
|
res(r.data.data.user_id)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
request
|
request,getusetid
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user