换系统

This commit is contained in:
pplokijuhyg 2019-12-23 10:04:09 +08:00
parent c890ad64a2
commit 9a53bca281
205 changed files with 4897 additions and 4734 deletions

View File

@ -4,7 +4,7 @@ Component({
* 组件的属性列表
*/
properties: {
price:String
},
/**
@ -19,9 +19,10 @@ Component({
*/
methods: {
sub() {
wx.navigateTo({
url: "/pages/order/order"
})
// wx.navigateTo({
// url: "/pages/order/order"
// })
this.triggerEvent("sub")
}
}
})

View File

@ -1,7 +1,7 @@
<view class="bottom">
<view class="left">
<text>总计</text>
<text class="pri">$0.00</text>
<text class="pri">${{price}}</text>
</view>
<view class="right" bindtap="sub">结算</view>
</view>

View File

@ -4,7 +4,10 @@ Component({
* 组件的属性列表
*/
properties: {
title:String,
spec:String,
price:String,
img:String
},
/**

View File

@ -1,13 +1,13 @@
<view class="shopinfo">
<image class="pic"></image>
<image class="pic" src="{{img}}"></image>
<view class="right">
<view class="shopname">产品产品产品产品产品产品产品产品产品产品产品产品产品</view>
<view class="shopname">{{title}}</view>
<view class="down">
<view class="shopdesc">
<text class="size">规格10ml</text>
<text> 0.04kg</text>
<text class="size">{{spec}}</text>
<!-- <text> 0.04kg</text> -->
</view>
<view class="pri">¥657</view>
<view class="pri">¥{{price}}</view>
</view>
</view>
</view>

View File

@ -4,7 +4,7 @@ Component({
* 组件的属性列表
*/
properties: {
price:String
},
/**

View File

@ -1,4 +1,4 @@
<view class="orderyf">
<view class="left">运费</view>
<view class="right">¥16</view>
<view class="right">¥{{price}}</view>
</view>

View File

@ -28,7 +28,7 @@ Component({
methods: {
rm() {
if (this.data.num == 0) {
if (this.data.num < 2) {
return
} else {
@ -39,7 +39,7 @@ Component({
url:"Cart/updateNum",
urldata:{
id:this.data.gid,
num:this.data.num - 1
num:this.data.num
}
}).then((res)=>{
@ -55,7 +55,7 @@ Component({
url:"Cart/updateNum",
urldata:{
id:this.data.gid,
num:this.data.num + 1
num:this.data.num
}
}).then((res)=>{

View File

@ -1,23 +1,110 @@
// pages/orderconfirm/orderconfirm.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
// pages/order/order.js
import bin from "../../utils/bin"
Page({
/**
* 组件的初始数据
* 页面的初始数据
*/
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)}
})
})
})
}
})

View File

@ -1,11 +1,12 @@
<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>
<chooseaddr></chooseaddr>
<orderyf></orderyf>
<orderyf price="{{list.express_price}}"></orderyf>
<agree></agree>
<view class="bottom">
<bottom></bottom>
<bottom price="{{list.totalPrice.total_fee}}" bind:sub="sub"></bottom>
</view>
</view>

View File

@ -7,7 +7,8 @@ Page({
*/
data: {
array: ['20粒', '30粒', '50粒', '100粒'],
userid:0
userid:0,
specs:{item:'默认规格'}
},
/**
@ -47,7 +48,7 @@ Page({
data: {
goods_id: this.data.shopid,
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
},
name:"session_id"

View File

@ -18,7 +18,7 @@
</swiper>
<text class="title">{{info.goods.goods_name}}</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>
</picker>
</view>

View File

@ -13,10 +13,19 @@ Page({
},
sel(a) {
console.log(a)
this.setData({
[`select[${a.detail.index}]`]: !a.detail.select
request({
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() {
request({
url: "Cart/cartList/session_id/" + wx.getStorageSync('openid'),
data: {
urldata: {
user_id: this.data.userid
}
}).then((res) => {
@ -33,7 +42,8 @@ Page({
this.setData({
list: res.data.result
})
this.num()
// this.num()
this.calls();
})
},
@ -50,9 +60,20 @@ Page({
})
},
sub() {
wx.navigateTo({
url: "/pages/orderconfirm/orderconfirm"
})
let sel = 0;
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) {
this.setData({
all: false,
select: []
request({
url: "Cart/updateAllSelect",
urldata: {
open_id: wx.getStorageSync("openid"),
selected: 0
}
}).then((res) => {
this.setData({
all: false,
select: []
})
this.num()
})
} else {
this.setData({
all: true,
select
request({
url: "Cart/updateAllSelect",
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()
},

View File

@ -14,7 +14,7 @@ let request = function (obj){
url="http://daigou.sdbairui.com/index.php/WXAPI/" + url
let text = ""
for(let i in urldata){
if(urldata[i] == undefined){
if(urldata[i] === ''){
text += `/${i}`
}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 = {
request
request,getusetid
}