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,393 @@
// pages/my/my_order/my_order.js
import { dateFormat } from '../../../utils/util'
var app = getApp();
let time = null;
Page({
/**
* 页面的初始数据
*/
data: {
ip: app.globalData.ipUrl,
type: 0,
page: 1,
num: 10,
orderList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 登录
wx.getStorage({
key: 'user',
success: data => {
this.setData({
userData: data.data,
login: true,
})
console.log('身份', this.data.userData)
},
})
if (options.state) {
console.log(options.state)
var type = options.state
this.setData({
type: type,
})
}
},
countDown(data) {
for (var i = 0; i < data.length; i++) {
if (data[i].orderRefundTimes && data[i].status == 63) {
let orderRefundTimes = new Date(data[i].orderRefundTimes.replace(/-/g, '/')).getTime();
let cDateTime = new Date().getTime();
let time = orderRefundTimes - cDateTime;
if (time > 0) {
let timeStr = dateFormat(time)
data[i]["timeStr"] = timeStr;
data[i]["time"] = time;
}
}
}
this.setData({
orderList: data
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
page: 1,
orderList: []
})
this.orderList();
},
//订单数据
orderList: function () {
if(time) {
clearTimeout(time);
}
console.log(11111)
wx.showLoading({
title: '加载中..',
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/order/getOrderList',
method: 'GET',
header: {
"content-type": "application/x-www-form-urlencoded",
},
data: {
userId: app.globalData.userId,
status: this.data.type,
page: this.data.page,
num: this.data.num
},
success: res => {
console.log(res)
wx.hideLoading()
if (res.data.code == 1) {
if (res.data.value.records.length > 0) {
var orderList = this.data.orderList;
var data = res.data.value.records;
for (var i = 0; i < data.length; i++) {
if (data[i].orderRefundTimes && data[i].status == 63) {
let orderRefundTimes = new Date(data[i].orderRefundTimes.replace(/-/g, '/')).getTime();
let cDateTime = new Date().getTime();
let time = orderRefundTimes - cDateTime;
if (time > 0) {
let timeStr = dateFormat(time)
console.log(timeStr)
data[i]["timeStr"] = timeStr;
data[i]["time"] = time;
}
}
for (var j = 0; j < data[i].goodsList.length; j++) {
if (data[i].goodsList[j].wisdGoodsSpec !== null) {
data[i].goodsList[j].price = data[i].goodsList[j].wisdGoodsSpec.specBulyPrice == null ? data[i].goodsList[j].wisdGoodsSpec.specPrice : data[i].goodsList[j].wisdGoodsSpec.specBulyPrice;
}
}
orderList.push(data[i])
}
this.setData({
orderList: orderList,
page: this.data.page + 1
})
time = setInterval(()=>{
this.countDown(orderList);
}, 1000)
} else {
if (this.data.page != 1) {
wx.showToast({
title: '暂无更多~',
icon: 'none'
})
}
}
} else {
wx.showModal({
title: '提示!',
content: res.data.message,
showCancel: false,
})
}
}
})
},
//type
type: function (e) {
var type = e.currentTarget.dataset.type;
this.setData({
type: type,
page: 1,
orderList: []
})
this.orderList();
},
//物流
express: function (e) {
app.globalData.expressData = JSON.stringify(e.currentTarget.dataset.item);
wx.navigateTo({
url: '/pages/expresswx/expresswx',
})
},
//查看进度
after: function (e) {
wx.navigateTo({
url: '/pages/my/after_sales/after_sales?num=' + e.currentTarget.dataset.num + '&id=' + e.currentTarget.dataset.id,
})
},
//退换货记录
jilu: function (e) {
let id = e.currentTarget.dataset.id;
let num = e.currentTarget.dataset.num;
let sq = e.currentTarget.dataset.sq;
wx.navigateTo({
url: '/pages/my/after_jilu/after_jilu?id=' + id + '&num=' + num + '&sq=' + sq,
})
},
//申请退款
apply1: function (e) {
let id = e.currentTarget.dataset.id;
wx.showModal({
title: '提示',
content: '确认申请退款?',
success: s => {
if (s.confirm) {
wx.showLoading({
title: '提交中',
mask: true,
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/order/afterSales',
method: 'POST',
header: {
"content-type": "application/x-www-form-urlencoded",
},
data: {
orderRefund: '',
orderId: id,
orderRefundImg: '',
status: 62
},
success: res => {
console.log(res)
wx.hideLoading()
if (res.data.code == 1) {
wx.showToast({
title: '提交成功',
icon: 'success',
success: sss => {
setTimeout(() => {
this.setData({
page: 1,
orderList: []
})
this.orderList();
}, 1000);
}
})
} else {
wx.showModal({
title: '获取数据失败!',
content: res.data.message,
showCancel: false,
})
}
}
})
}
}
})
},
//申请售后
apply: function (e) {
let id = e.currentTarget.dataset.id;
let num = e.currentTarget.dataset.num;
let sq = e.currentTarget.dataset.sq;
wx.navigateTo({
url: '/pages/my/applyAfter_sales/applyAfter_sales?id=' + id + '&num=' + num + '&sq=' + sq,
})
},
//支付订单
pay: function (e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/pages/pay/pay?id=' + id,
})
},
// 删除订单
del(e) {
let index = e.currentTarget.dataset.index
let orderId = this.data.orderList[index].id
wx.showModal({
title: '提示信息',
content: '您确认删除当前订单吗?',
success: ee => {
if (ee.confirm) {
wx.request({
url: app.globalData.ip + '/wisdommining/api/order/delOrder',
method: 'POST',
header: {
"content-type": "application/x-www-form-urlencoded",
},
data: {
orderId: orderId,
},
success: res => {
console.log(res)
wx.hideLoading()
if (res.data.code == 1) {
wx.showToast({
title: '删除成功~',
icon: 'none',
success: eee => {
setTimeout((t) => {
this.setData({
page: 1,
orderList: [],
})
this.orderList();
}, 1000);
}
})
} else {
wx.showModal({
title: '提示!',
content: res.data.message,
showCancel: false,
})
}
}
})
}
}
})
},
//确认收货
confirm: function (e) {
wx.showModal({
title: '提示!',
content: '确认已收到商品吗?',
success: s => {
if (s.confirm) {
wx.showLoading({
title: '加载中..',
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/order/confirmOrder',
method: 'POST',
header: {
"content-type": "application/x-www-form-urlencoded",
},
data: {
orderId: e.currentTarget.dataset.id
},
success: res => {
console.log(res)
wx.hideLoading()
if (res.data.code == 1) {
wx.showToast({
title: '收货成功~',
icon: 'none',
success: ss => {
setTimeout(() => {
this.setData({
page: 1,
orderList: [],
})
this.orderList();
}, 1000);
}
})
} else {
wx.showModal({
title: '确认失败!',
content: res.data.message,
showCancel: false,
})
}
}
})
}
}
})
},
//订单详情
toOrderDetail(e) {
wx.navigateTo({
url: '/pages/order_details/order_details?orderNumber=' + e.currentTarget.dataset.num,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.orderList()
},
})

View File

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

View File

@ -0,0 +1,110 @@
<!--pages/my/my_order/my_order.wxml-->
<view style="width:750rpx;background-color: #ffffff;">
<view class="typeAll display_J_S">
<view class="type {{type==0?'type_xz':''}}" catchtap="type" data-type="0">
<view class="type_s">全部</view>
<view class="typeXz" wx:if='{{type==0}}'></view>
</view>
<view class="type {{type==1?'type_xz':''}}" catchtap="type" data-type="1">
<view class="type_s">待支付</view>
<view class="typeXz" wx:if='{{type==1}}'></view>
</view>
<view class="type {{type==2?'type_xz':''}}" catchtap="type" data-type="2">
<view class="type_s">待发货</view>
<view class="typeXz" wx:if='{{type==2}}'></view>
</view>
<view class="type {{type==3?'type_xz':''}}" catchtap="type" data-type="3">
<view class="type_s">待收货</view>
<view class="typeXz" wx:if='{{type==3}}'></view>
</view>
<view class="type {{type==6?'type_xz':''}}" catchtap="type" data-type="6">
<view class="type_s">退款售后</view>
<view class="typeXz" wx:if='{{type==6}}'></view>
</view>
<view class="type {{type==4?'type_xz':''}}" catchtap="type" data-type="4">
<view class="type_s">已完成</view>
<view class="typeXz" wx:if='{{type==4}}'></view>
</view>
</view>
</view>
<view class="orderAll">
<view class="order" wx:for="{{orderList}}" wx:key='index' data-num="{{item.orderNumber}}" catchtap="toOrderDetail">
<view class="state" wx:if="{{item.status<6}}">
{{item.status==5?'已取消':item.status==1?'待支付':item.status==2?'待发货':item.status==3?'待收货':item.status==4?'已完成':''}}
</view>
<view class="state" wx:if="{{item.status>5}}">
{{
item.status==61?'换货审核中'
:item.status==62?'退货审核中'
:item.status==63&&item.orderRefundType==1?'换货申请成功'
:item.status==63&&item.orderRefundType==2?'退货申请成功'
:item.status==64&&item.orderRefundType==1?'换货待商家收货'
:item.status==64&&item.orderRefundType==2?'退货待商家收货'
:item.status==65&&item.orderRefundType==1?'换货完成'
:item.status==65&&item.orderRefundType==2?'退货完成'
:item.status==65&&item.orderRefundType==3?'退款完成'
:item.status==66&&item.orderRefundType==1?'换货失败'
:item.status==66&&item.orderRefundType==2?'退货失败'
:''
}}
</view>
<view class="number">订单编号:<text>{{item.orderNumber}}</text></view>
<view class="goods display_J_B" wx:for="{{item.goodsList}}" wx:for-item="goods" wx:key='index'>
<view class="goodsL">
<image src="{{goods.goodsPhoto}}"></image>
</view>
<view class="goodsM">
<view class="goodsTitle GStitleTwo">{{goods.goodsName}}</view>
<view class="goodsPrice" wx:if='{{item.orderPayWay!=3}}'>
{{item.orderPayWay!=2?'¥'+goods.price:goods.price+'积分'}}
</view>
<view class="goodsPrice" wx:if='{{item.orderPayWay==3}}'>¥0</view>
</view>
<view class="goodsR display_A_E">x <text>{{goods.goodsNum}}</text></view>
</view>
<view class="total display_J_E">
<view class="total1" wx:if="{{item.orderPick==1}}">自提</view>
<view class="total1" wx:if="{{item.orderPick!=1&&item.orderFreight==0}}">免运费</view>
<view class="total2" wx:if="{{item.orderPick!=1&&item.orderFreight!=0}}">
运费<text><text>¥</text>{{item.orderFreight}}</text>
</view>
<view class="total3">合计<text>{{item.orderPayWay!=2?'¥'+item.orderActualPay:item.orderOtherPay+'积分'}}</text></view>
</view>
<view wx:if="{{item.timeStr}}" style="font-size: 28rpx">
您需要在<text style="color:#ee7b1e;">{{item.timeStr}}</text>内处理
</view>
<view class="btn display_J_E">
<view class="btn1" wx:if="{{item.status==3}}" data-item='{{item}}' catchtap="express">物流查询</view>
<view class="btn1 btn2" wx:if="{{item.status==3}}" data-id='{{item.id}}' catchtap="confirm">确认收货</view>
<view class="btn1" wx:if="{{item.status==1}}">立即支付</view>
<view class="btn1" wx:if="{{item.status==4||item.status==5}}" catchtap="del" data-id='{{item.id}}'
data-index="{{index}}">删除订单</view>
<!-- 退货流程 -->
<!-- 待发货 申请 -->
<view class="btn1 btn2" wx:if="{{item.status==2}}" data-id='{{item.id}}' catchtap="apply1">
申请退款</view>
<!-- 待收货申请 -->
<view class="btn1 btn2" wx:if="{{item.status==3}}" data-id='{{item.id}}' data-num='{{item.orderNumber}}'
data-s='{{item.status}}' data-sq='1' catchtap="apply">申请退货</view>
<view class="btn1 btn2" wx:if="{{item.status==3}}" data-id='{{item.id}}' data-num='{{item.orderNumber}}'
data-s='{{item.status}}' data-sq='2' catchtap="apply">申请换货</view>
<!-- 申请中 -->
<view class="btn1 btn2" wx:if="{{item.status==61||item.status==62||item.status==63||item.status==66}}"
data-id='{{item.id}}' data-num='{{item.orderNumber}}' catchtap="after">查看进度</view>
<!-- 退货待商家收货 完成 -->
<view class="btn1 btn2" wx:if="{{(item.status==64||item.status==65)&&item.orderRefundType!=3}}"
data-id='{{item.id}}' data-num='{{item.orderNumber}}' data-sq='{{item.orderRefundType==1?2:1}}' catchtap="jilu">
退换货记录</view>
</view>
</view>
</view>
<view class="empty" wx:if="{{orderList.length==0}}">
<view class="emptyImg">
<image src="/icon/order_none.png"></image>
</view>
<view class="emptyTitle">暂无订单~</view>
</view>

View File

@ -0,0 +1,215 @@
/* pages/my/my_order/my_order.wxss */
page {
background-color: #f5f5f5;
}
.typeAll {
width: 750rpx;
margin: 0 auto;
height: 90rpx;
line-height: 90rpx;
background-color: #fff;
position: relative;
font-size: 28rpx;
color: #9792a6;
margin-top: 10rpx;
overflow-y: hidden;
overflow-x: scroll;
}
.typeAll::-webkit-scrollbar {
display: none;
}
.type {
width: 140rpx;
text-align: center;
font-size: 32rpx;
color: #999999;
position: relative;
}
.type_s{
width: 140rpx;
}
.typeAll .type_xz {
color: #ee7b1e;
}
/* .typeXz {
width: 60rpx;
height: 6rpx;
background-color: #ee7b1e;
border-radius: 3rpx;
transform: left 0.5s;
} */
.typeXz {
width: 60rpx;
height: 6rpx;
background-color: #ee7b1e;
border-radius: 3rpx;
position: absolute;
bottom: 2rpx;
left: 40rpx;
}
.orderAll {
width: 750rpx;
border-radius: 20rpx;
margin-bottom: 30rpx;
}
.order {
width: 690rpx;
padding: 30rpx;
position: relative;
margin-top: 20rpx;
background: #fff;
}
.state {
font-size: 28rpx;
color: #ee7b1e;
position: absolute;
right: 30rpx;
top: 20rpx;
}
.number {
font-size: 32rpx;
color: #333333;
margin-bottom: 50rpx;
}
.number text {
color: #666666;
margin-left: 20rpx;
}
.goods {
margin-bottom: 30rpx;
}
.goodsL {
width: 160rpx;
height: 160rpx;
}
.goodsL image {
width: 160rpx;
height: 160rpx;
background-color: #fcfaf7;
border-radius: 10rpx;
}
.goodsM {
width: 400rpx;
}
.goodsTitle {
font-size: 32rpx;
color: #333333;
line-height: 50rpx;
height: 100rpx;
}
.goodsPrice {
line-height: 60rpx;
font-size: 36rpx;
color: #ee7b1e;
}
.goodsPrice text {
font-size: 24rpx;
color: #999999;
}
.goodsR {
font-size: 24rpx;
color: #212320;
}
.goodsR text {
font-size: 32rpx;
color: #0b0b0b;
}
.total {
border-top: 1rpx solid #eee;
height: 90rpx;
line-height: 90rpx;
}
.total1 {
font-size: 28rpx;
color: #333333;
}
.total2 {
font-size: 28rpx;
color: #333333;
}
.total2 text text {
font-size: 24rpx;
}
.total2 text {
font-size: 32rpx;
}
.total3 {
margin-left: 100rpx;
font-size: 28rpx;
color: #333333;
}
.total3>text {
margin-left: 30rpx;
font-size: 36rpx;
letter-spacing: 2rpx;
color: #ee7b1e;
}
.total3>text text {
font-size: 24rpx;
color: #999999;
}
.btn1 {
height: 48rpx;
line-height: 48rpx;
border-radius: 24rpx;
border: solid 1rpx #a0a0a0;
padding: 0 20rpx;
font-size: 24rpx;
color: #999999;
margin-left: 20rpx;
}
.btn .btn2 {
border: solid 1rpx #ee7b1e;
color: #ee7b1e;
}
.emptyImg {
width: 337rpx;
height: 164rpx;
margin: 200rpx auto 50rpx;
}
.emptyImg image {
width: 100%;
height: 100%;
}
.emptyTitle {
font-size: 28rpx;
letter-spacing: 3rpx;
color: #999;
text-align: center;
margin: 50rpx 0;
}