Initial Commit

This commit is contained in:
quantulr
2024-05-06 15:34:15 +08:00
commit e3a0666d5a
307 changed files with 28969 additions and 0 deletions

View File

@ -0,0 +1,398 @@
// pages/cartPay/cartPay.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
goods: [],
addressType: false,//收货方式
note: '',
addressId: '',//地址ID
address: '选择收货方式',//地址
province: '',
orderPick: 2,
date: '',
time: '',
startTime: '',
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (this.data.orderPick == 2) {
//收货地址
if (this.data.total && this.data.province != '') {
//订单个人信息获取
wx.showLoading({
title: '加载中',
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/order/getUserInfo',
method: 'GET',
header: {
"content-type": "application/x-www-form-urlencoded",
},
data: {
userId: app.globalData.userId
},
success: res => {
wx.hideLoading();
console.log(res)
if (res.data.code == 1) {
let dataList = res.data.value;
this.setData({
dataList: dataList,
pay: (parseFloat(this.data.payActual) * parseFloat(dataList.userVipDiscount) / 100).toFixed(2),
})
//运费获取
wx.request({
url: app.globalData.ip + '/wisdommining/api/order/getFreight',
method: 'GET',
header: {
"content-type": "application/x-www-form-urlencoded",
},
data: {
freightAddress: this.data.province,
price: this.data.total,
},
success: res => {
wx.hideLoading();
console.log(res)
if (res.data.code == 1) {
this.setData({
freight: res.data.value,
payActual: (parseFloat(this.data.total) + parseFloat(res.data.value) - parseFloat(this.data.discount)).toFixed(2),
payActualIntegral: parseFloat(this.data.total),
})
this.setData({
pay: (parseFloat(this.data.payActual) * parseFloat(this.data.dataList.userVipDiscount) / 100).toFixed(2),
})
} else {
wx.showModal({
title: '提示!',
content: res.data.message,
showCancel: false,
})
}
}
})
} else {
wx.showModal({
title: '提示!',
content: res.data.message,
showCancel: false,
})
}
}
})
}
} else {
// 自提点
this.setData({
freight: 0,
payActual: (parseFloat(this.data.total) - parseFloat(this.data.discount)).toFixed(2),
payActualIntegral: parseFloat(this.data.total),
})
this.setData({
pay: (parseFloat(this.data.payActual) * parseFloat(this.data.dataList.userVipDiscount) / 100).toFixed(2),
})
console.log(this.data.address)
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let myDate = new Date();
this.setData({
startTime: myDate.getFullYear() + '-' + (parseFloat(myDate.getMonth()) + 1) + '-' + (parseFloat(myDate.getDate()) + 3)
})
if (options.goods) {
let goods = JSON.parse(options.goods)
console.log(goods)
this.setData({
goods: goods,
packageId: options.packageId
})
this.userData()
}
},
userData() {
//订单个人信息获取
wx.showLoading({
title: '加载中',
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/order/getUserInfo',
method: 'GET',
header: {
"content-type": "application/x-www-form-urlencoded",
},
data: {
userId: app.globalData.userId
},
success: res => {
wx.hideLoading();
console.log(res)
if (res.data.code == 1) {
let dataList = res.data.value;
this.setData({
dataList: dataList,
})
if (dataList.wisdUserAddress && this.data.orderPick == 2) {
//默认地址ID
this.setData({
addressId: dataList.wisdUserAddress.id,
address: dataList.wisdUserAddress.addressProvince + dataList.wisdUserAddress.addressCity + dataList.wisdUserAddress.addressArea + dataList.wisdUserAddress.addressDetailed,
})
}
} else {
wx.showModal({
title: '提示!',
content: res.data.message,
showCancel: false,
})
}
}
})
},
//备注
note(e) {
this.setData({
note: e.detail.value
})
},
//选择地址类型
addressType() {
this.setData({
addressType: true,//收货
})
},
//选择收货地址
address() {
wx.navigateTo({
url: '/pages/my/my_address/my_address?orderAddress=true&addressId=' + this.data.addressId,
})
this.setData({
addressType: false,//收货
})
},
//选择自提点
ztd() {
wx.navigateTo({
url: '/pages/index/index_address/index_address?pay=true',
})
this.setData({
addressType: false,//收货
})
},
//收获 遮罩层
addressZzc() {
this.setData({
addressType: false,//收货
})
},
//选择优惠方式
reduceType() {
this.setData({
reduceType: true,//优惠
})
},
//立即支付
pay(e) {
if (this.data.addressId == '') {
wx.showToast({
title: '请选择收货方式',
icon: 'none'
})
return
}
if (this.data.orderPick == 1) {
if (this.data.date == '') {
wx.showToast({
title: '请选择提货日期',
icon: 'none'
})
return
}
if (this.data.time == '') {
wx.showToast({
title: '请选择提货时间',
icon: 'none'
})
return
}
}
wx.showModal({
title: '提示!',
content: '确认要购买吗',
success: sss => {
if (sss.confirm) {
let orderPick = this.data.orderPick;
let wisdOrderDetailList = [];
console.log(this.data.goods)
//商品信息
for (let i = 0; i < this.data.goods.length; i++) {
wisdOrderDetailList.push({
goodsId: this.data.goods[i].goodsId,
goodsNum: this.data.goods[i].num,
})
}
console.log(wisdOrderDetailList)
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/order/addOrder',
method: 'POST',
data: {
userId: app.globalData.userId,
addressId: this.data.addressId,
orderActualPay: 0, //微信支付的钱 其余传0
orderOtherPay: 0, //积分 现金券 折扣券 套餐0
orderPayWay: 3, //1纯微信支付 2积分支付 3套餐券 4现金券+微信支付) 5折扣券+微信支付)
orderPick: orderPick, //1自提 2物流
orderPickTime:orderPick==1?this.data.date+' '+this.data.time:'',
orderRemark: this.data.note,
orderFreight: 0,
wisdOrderDetailList: wisdOrderDetailList,
packageId: parseInt(this.data.packageId),
isCar: 0
},
success: res => {
wx.hideLoading();
console.log(res)
if (res.data.code == 1) {
//支付
this.payM({
orderNumber: res.data.value
})
} else {
wx.showModal({
title: '提示!',
content: res.data.message,
showCancel: false,
})
}
}
})
}
}
})
},
//支付
payM(options) {
wx.showLoading({
title: '支付中',
mask: true
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/pay/payOrder',
method: 'PUT',
header: {
"content-type": "application/x-www-form-urlencoded",
},
data: {
userId: app.globalData.userId,
orderNumber: options.orderNumber
},
success: res => {
wx.hideLoading();
console.log(res)
if (res.data.code == 2) {
//兑换成功
wx.showToast({
title: '兑换成功~',
icon: 'none',
duration: 1500,
success() {
setTimeout(() => {
wx.redirectTo({
url: '/pages/order_details/order_details?orderNumber=' + options.orderNumber,
})
}, 1000);
}
})
} else {
wx.showModal({
title: '提示!',
content: res.data.message,
showCancel: false,
success: sss => {
if (sss.confirm) {
wx.redirectTo({
url: '/pages/order_details/order_details?orderNumber=' + options.orderNumber,
})
}
}
})
}
}
})
},
bindDateChange: function (e) {
console.log('picker发送选择改变携带值为', e.detail.value)
this.setData({
date: e.detail.value
})
},
bindTimeChange: function (e) {
console.log('picker发送选择改变携带值为', e.detail.value)
this.setData({
time: e.detail.value
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "订单支付"
}

View File

@ -0,0 +1,104 @@
<!--pages/cartPay/cartPay.wxml-->
<!-- 倒计时 -->
<!-- <view class="djs">待支付剩余时间:<text>15:00:00</text></view> -->
<!-- 选择收货类型 -->
<view class="address display_J_B" catchtap="addressType">
<view class="address-l display_J_S display_A_C">
<image src="/icon/order-addrass.png"></image>
<view class="address-cont GStitleOne">{{address}}</view>
</view>
<view class="address-r display_A_C">
<image src="/icon/right.png"></image>
</view>
</view>
<view class="goods">
<view class="cont display_J_B" wx:for='{{goods}}' wx:key='index'>
<view class="cont-l">
<image src="{{item.goodsPhoto}}"></image>
</view>
<view class="cont-m">
<view class="name GStitleTwo">{{item.goodsName}}</view>
<view class="spec">规格:无</view>
<view class="price">¥0</view>
</view>
<view class="cont-r">x1</view>
</view>
</view>
<view class="data">
<view class="data-t display_J_B display_A_C">
<view class="t-l">商品合计</view>
<view class="t-r t-r__1">¥0</view>
</view>
<view class="data-t display_J_B display_A_C">
<view class="t-l">运费</view>
<view class="t-r t-r__2">{{orderPick==1?'自提':'包邮'}}</view>
</view>
<view class="data-t display_J_B display_A_C">
<view class="t-l">优惠</view>
<view class="t-r t-r__3 display_A_C" ><text style="color:#333;">套餐券</text></view>
</view>
<view class="data-t display_J_B display_A_C">
<view class="t-l">备注</view>
<view class="t-r t-r__2">
<input type="text" value="{{note}}" bindinput="note" placeholder="请填写备注"></input>
</view>
</view>
<view class="data-t data-t_last display_J_B display_A_C">
<view class="t-l">实际支付</view>
<view class="t-r t-r__4">¥0</view>
</view>
</view>
<!-- 自提时间 -->
<view class="ztTime display_J_B" wx:if="{{orderPick==1}}">
<view class="ztt_l">自提时间<text>*</text></view>
<view class="ztt_r display_J_E display_A_C">
<picker mode="date" value="{{date}}" start="{{startTime}}" bindchange="bindDateChange">
<view class="display_A_C display_J_E" style="width:250rpx;">
<text class="{{date!=''?'ztt_r_time':''}}">{{date==''?'选择提货日期':date}}</text>
<image src="/icon/c-down.png"></image>
</view>
</picker>
<picker mode="time" value="{{time}}" bindchange="bindTimeChange">
<view class="display_A_C display_J_E" style="width:250rpx;">
<text style="margin-left: 30rpx;" class="{{time!=''?'ztt_r_time':''}}">{{time==''?'选择提货时间':time}}</text>
<image src="/icon/c-down.png"></image>
</view>
</picker>
</view>
</view>
<view class="ztTimeTs" wx:if="{{orderPick==1}}">由于进货和配货需要时间您的提货时间要3天后开始选择</view>
<view class="height100"></view>
<view class="height100"></view>
<view class="pay display_J_A display_A_C">
<view class="pay-r" catchtap="pay">立即兑换</view>
</view>
<!-- 收货方式 -->
<view wx:if='{{addressType}}'>
<view class="reduce-zzc" catchtap="addressZzc"></view>
<view class="reduce-cont">
<view class="reduce-title">选择收货方式</view>
<view class="reduce-c display_J_B" catchtap="address">
<view class="reduce-c__l display_A_C">
<image src="/icon/order-addrass.png"></image>我的收货地址
</view>
<view class="reduce-c__r display_A_C">
<image src="/icon/right.png"></image>
</view>
</view>
<!-- <view class="reduce-c display_J_B" catchtap="ztd">
<view class="reduce-c__l display_A_C">
<image src="/icon/address.png" style="width:30rpx;margin:0 66rpx 0 7rpx;"></image>自提点
</view>
<view class="reduce-c__r display_A_C">
<image src="/icon/right.png"></image>
</view>
</view> -->
</view>
</view>

View File

@ -0,0 +1,378 @@
/* pages/cartPay/cartPay.wxss */
page {
background-color: #f5f5f5;
}
.djs {
font-size: 28rpx;
color: #333333;
width: 750rpx;
height: 80rpx;
background-color: #f7e0cd;
text-align: center;
line-height: 80rpx;
}
.djs text {
color: #ff372d;
margin-left: 10rpx;
}
.address {
margin-top: 34rpx;
width: 690rpx;
padding: 0 30rpx;
height: 156rpx;
background-color: #ffffff;
border-radius: 20rpx;
}
.address-l {
height: 100%;
}
.address-l image {
width: 46rpx;
height: 46rpx;
margin: 0 55rpx 0 15rpx;
}
.address-cont {
font-size: 32rpx;
color: #ee7b1e;
width: 500rpx;
}
.address-r {
height: 100%;
}
.address-r image {
width: 30rpx;
height: 30rpx;
}
.goods {
width: 690rpx;
padding: 0 30rpx;
background-color: #ffffff;
border-radius: 20rpx;
margin: 30rpx 0;
}
.cont {
padding: 30rpx 0;
border-bottom: 1rpx #dcdcdc solid;
}
.cont:last-child {
border-bottom: none;
}
.cont-l image {
width: 160rpx;
height: 160rpx;
}
.cont-m {
width: 400rpx;
padding: 10rpx 0;
display: flex;
flex-wrap: wrap;
align-content: space-between;
}
.name {
font-size: 28rpx;
color: #333333;
}
.spec {
width: 100%;
font-size: 24rpx;
color: #999999;
}
.price {
width: 100%;
font-size: 36rpx;
color: #ff291e;
}
.price text {
font-size: 24rpx;
color: #999999;
text-decoration: line-through;
margin-left: 11rpx;
}
.cont-r {
display: flex;
align-items: flex-end;
font-size: 32rpx;
color: #0b0b0b;
height: 130rpx;
}
.data {
width: 690rpx;
padding: 10rpx 30rpx 0;
background-color: #ffffff;
border-radius: 20rpx;
}
.data-t {
height: 70rpx;
}
.data-t_last {
padding-top: 20rpx;
border-top: 1rpx #d9d9d9 solid;
margin-top: 30rpx;
}
.t-l {
font-size: 28rpx;
letter-spacing: 1rpx;
color: #444444;
}
.t-r {
font-size: 28rpx;
letter-spacing: 1rpx;
height: 70rpx;
line-height: 70rpx;
}
.t-r__1 {
color: #333333;
font-weight: bold;
}
.t-r__2 {
color: #999999;
}
.t-r__3 {
color: #ff291e;
}
.t-r__4 {
color: #333333;
font-weight: bold;
font-size: 34rpx;
}
t-r__5 {
color: #ff291e;
font-weight: bold;
font-size: 34rpx;
}
.t-r input {
font-size: 28rpx;
letter-spacing: 1rpx;
color: #999999;
width: 500rpx;
text-align: right;
line-height: 70rpx;
height: 70rpx;
border: none;
}
.t-r image {
width: 30rpx;
height: 30rpx;
}
.pay-type {
width: 690rpx;
padding: 0 30rpx;
height: 100rpx;
background-color: #ffffff;
border-radius: 20rpx;
margin-top: 20rpx;
}
.pay-type__l {
height: 100%;
font-size: 28rpx;
color: #333333;
}
.pay-type__l image {
width: 50rpx;
height: 50rpx;
margin-right: 20rpx;
}
.pay-type__r {
height: 100%;
font-size: 24rpx;
letter-spacing: 1rpx;
color: #ff291e;
}
.pay-type__r image {
width: 30rpx;
height: 30rpx;
margin-left: 20rpx;
}
.pay {
width: 690rpx;
padding: 0 30rpx;
height: 100rpx;
background-color: #ffffff;
line-height: 56rpx;
position: fixed;
bottom: 0;
left: 0;
}
.pay-l i {
padding-right: 32rpx;
font-size: 28rpx;
color: #333333;
}
.pay-l {
padding-left: 90rpx;
font-size: 28rpx;
color: #ff291e;
}
.pay-l text {
font-size: 40rpx;
color: #ff291e;
}
.pay-r {
width: 690rpx;
height: 64rpx;
background-color: #ee7b1e;
border-radius: 32rpx;
font-size: 28rpx;
color: #ffffff;
text-align: center;
line-height: 64rpx;
}
.reduce-zzc {
width: 100vw;
height: 100vh;
position: fixed;
left: 0;
top: 0;
z-index: 9;
background-color: rgba(0, 0, 0, 0.6);
}
.reduce-cont {
position: fixed;
left: 0;
bottom: 0;
z-index: 9;
width: 690rpx;
padding: 0 30rpx 50rpx;
background-color: #ffffff;
border-radius: 20rpx 20rpx 0px 0px;
}
.reduce-title {
font-size: 36rpx;
color: #333333;
border-bottom: 1rpx solid #d2d2d2;
height: 106rpx;
line-height: 106rpx;
text-align: center;
margin-bottom: 40rpx;
}
.reduce-c {
width: 690rpx;
height: 100rpx;
background-color: #ffffff;
border-radius: 20rpx;
margin-bottom: 30rpx;
}
.reduce-c__l {
font-size: 36rpx;
color: #333333;
}
.reduce-c__l text {
color: #ff291e;
}
.reduce-c__l text text {
font-size: 24rpx;
}
.reduce-c__l {
height: 100%;
}
.reduce-c__l image {
width: 46rpx;
height: 46rpx;
margin-right: 58rpx;
}
.reduce-c__r {
height: 100%;
}
.reduce-c__r image {
width: 42rpx;
height: 42rpx;
}
.ztTime{
box-sizing: border-box;
padding: 0 30rpx;
margin-top: 30rpx;
width: 750rpx;
height: 100rpx;
background-color: #ffffff;
border-radius: 20rpx;
}
.ztt_l{
font-size: 28rpx;
line-height: 100rpx;
letter-spacing: 1rpx;
color: #333333;
}
.ztt_l text{
color: #ff0000;
margin-left: 20rpx;
display: inline-block;
position: relative;
top: 6rpx;
}
.ztt_r{
font-size: 28rpx;
line-height: 100rpx;
letter-spacing: 1rpx;
color: #999999;
width:500rpx;
}
.ztt_r_time{
color: #333333;
}
.ztt_r image{
width: 14rpx;
height: 8rpx;
margin-left: 20rpx;
}
.ztTimeTs{
font-size: 24rpx;
line-height: 35rpx;
letter-spacing: 1rpx;
color: #ff0000;
text-align: center;
margin-top: 20rpx;
}