我要买列表

This commit is contained in:
itgaojian163 2025-06-10 15:58:05 +08:00
parent e32e376eb8
commit 180b28dee1
21 changed files with 417 additions and 90 deletions

View File

@ -129,7 +129,8 @@ swiper-item {
border-radius: 5px;
text-align: center;
}
.bottom-btn-green.active{
.bottom-btn-green.active {
background-color: var(--gray-bg-color);
color: var(--text-brown-color);
}
@ -165,10 +166,12 @@ swiper-item {
.mb-40 {
margin-bottom: 40rpx;
}
.mb-60{
.mb-60 {
margin-bottom: 60rpx;
}
.mb-80{
.mb-80 {
margin-bottom: 80rpx;
}
@ -319,16 +322,15 @@ swiper-item {
.no-more::after {
content: "";
flex: 1;
height: 1px;
height: 1rpx;
background-color: var(--divider-color);
}
.no-more-dot {
width: 8rpx;
height: 8rpx;
border-radius: 50%;
background-color: var(--divider-color);
margin: 0 20rpx;
color: var(--text-gray-hint-color);
font-size: 24rpx;
padding: 0 15rpx;
white-space: nowrap;
}
.weui-half-screen-dialog__ft {
@ -336,6 +338,6 @@ swiper-item {
padding: 0rpx 0rpx 50rpx;
}
.tip-margin{
.tip-margin {
margin-top: 80px;
}

View File

@ -18,6 +18,8 @@ const apiPath = {
areaList: "/api/area/listbyparentid/{pId}", //省市区树结构
saveOrder: '/api/order/save/{goodsId}', //新增订单
confirmOrder: '/api/order/confirm-pay/{orderId}', //确定付款
cancelOrder: '/api/order/save-cancel/{orderId}', //取消订单
mineBuyOrder: '/api/order/listpage-buy', //我的订单 ?
}
class Shop {
// 通用路径参数替换方法
@ -113,6 +115,16 @@ class Shop {
orderId: oId
})
}
//取消订单
static doCancelOrder(oId) {
return this.requestHandler(apiPath.cancelOrder, "PUT", null, {
orderId: oId
})
}
//我购买的
static doGetMineOrders(data) {
return this.requestHandler(apiPath.mineBuyOrder, "GET", data)
}
}
export default Shop;

View File

@ -70,7 +70,7 @@
</radio-group>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -79,7 +79,7 @@
</radio-group>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -64,7 +64,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -85,7 +85,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -98,7 +98,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -30,7 +30,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -22,7 +22,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -29,7 +29,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -41,7 +41,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -29,7 +29,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -41,7 +41,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -36,7 +36,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -48,7 +48,7 @@
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>

View File

@ -96,7 +96,7 @@
</view>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore && listLoading != 'empty'}}" class="no-more">
<view class="no-more-dot"></view>
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</view>

View File

@ -1,66 +1,121 @@
// pages/shop/purchaseGoods/purchaseGoods.js
import Shop from '../../../net/api/shop'
import {
sImgPrefix
}
from '../../../net/mainUrl'
Page({
/**
* 页面的初始数据
*/
data: {
/**
* 页面的初始数据
*/
data: {
pageData: {
page: 1,
rows: 10,
keywords: '',
startTime: '',
endTime: '',
orderStatus: ''
},
msgShow: false,
msgHint: '',
msgType: 'error',
loadingState: 'loading',
listRefreshTrig: false,
isLoadMore: false,
hasMore: true,
goodsList: []
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.setNavigationBarTitle({
title: '已经购买',
})
wx.setNavigationBarColor({
frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000
backgroundColor: '#FFFFFF', // 传递的颜色值,仅支持十六进制颜色
animation: { // 可选项
duration: 500,
timingFunc: 'easeIn'
}
})
this.doRefreshList()
},
inputKeywords(e) {
this.setData({
'pageData.keywords': e.detail.value
})
},
doSearch() {
this.doRefreshList()
},
doRefreshList() {
console.log('正在刷新...')
const _self = this
_self.setData({
listRefreshTrig: true,
loadingState: 'loading',
hasMore: true,
isLoadMore: false,
'pageData.page': 1,
})
_self.doGetMineOrders(true)
},
doLoadMore() {
//判断是否正在加载中 与是否存在更多数据
const _self = this
if (_self.data.isLoadMore || !_self.data.hasMore) {
return
}
_self.setData({
isLoadMore: true,
'pageData.page': ++_self.data.pageData.page,
})
_self.doGetMineOrders(false)
},
//获取列表
doGetMineOrders(isRefresh) {
const _self = this
_self.setData({
goodsList: isRefresh ? [] : _self.data.goodsList,
loadingState: isRefresh ? 'loading' : ''
})
Shop.doGetMineOrders(_self.data.pageData)
.then(res => {
console.log(res)
var status = 'success'
status = res.rows && res.rows.length > 0 ? 'success' : 'empty'
const list = _self.addPrefixToPreviewImgs(res.rows)
_self.setData({
loadingState: isRefresh ? status : '',
goodsList: _self.data.goodsList.concat(list),
listRefreshTrig: false,
isLoadMore: false
})
_self.setData({
hasMore: _self.data.goodsList.length < res.total
})
}, err => {
_self.setData({
loadingState: 'error',
listRefreshTrig: false,
isLoadMore: false,
hasMore: true
})
})
},
//为数据中图片添加前缀
addPrefixToPreviewImgs(data) {
const prefix = sImgPrefix
return data.map(item => {
if (item.goodsDTO.goodsPhoto && item.goodsDTO.goodsPhoto != '') {
item.goodsDTO.preImg = prefix + item.goodsDTO.goodsPhoto
}
return item;
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,3 +1,7 @@
{
"usingComponents": {}
"usingComponents": {
"mp-loading": "weui-miniprogram/loading/loading",
"container-loading": "/components/container-loading/container-loading",
"mp-toptips": "weui-miniprogram/toptips/toptips"
}
}

View File

@ -1,2 +1,51 @@
<!--pages/shop/purchaseGoods/purchaseGoods.wxml-->
<text>pages/shop/purchaseGoods/purchaseGoods.wxml</text>
<view class="page-container">
<view class="search-container-fixed" style="background-color: white;">
<view class="search-box">
<icon class="mr-10" type="search" size="20"></icon>
<input type="text" bindconfirm="doSearch" class="search-input" bindinput="inputKeywords" value="{{pageData.keywords}}" placeholder="请输入软著名称" />
<view bind:tap="doSearch">搜索</view>
</view>
</view>
<view class="container-box">
<container-loading loadingState="{{loadingState}}" style="height: 83vh;" bindrefresh="doRefreshList">
<scroll-view scroll-y="{{true}}" style="height: 83vh;" bindrefresherrefresh="doRefreshList" refresher-enabled refresher-triggered="{{listRefreshTrig}}" bindscrolltolower="doLoadMore" lower-threshold='30'>
<view style="display: flex;flex-direction: column;">
<view class="list-container">
<block wx:for="{{goodsList}}" wx:key="index">
<view class="list-item">
<view class="item-img-box">
<image src="{{item.goodsDTO.preImg}}" mode="scaleToFill" class="item-img"></image>
</view>
<view class="item-container">
<view class="item-goods-name-box">
<view class="item-goods-status {{tools.goodsOrderColor(item.orderStatus)}}">{{tools.goodsOrderStatus(item.orderStatus)}}</view>
<view class="item-goods-name">{{item.goodsDTO.goodsName}}</view>
</view>
<view class="item-price-box">
<view class="item-price-title">订单价格</view>
<rich-text class="item-price-price" nodes="{{tools.moneyTxt(12,item.payMoney)}}"></rich-text>
</view>
<view class="item-time-box">
<view class="item-time-item">
<view class="item-time-title">下单时间</view>
<view class="item-time-time">{{item.createTime}}</view>
</view>
<view class="item-time-item">
<view class="item-time-title">付款时间</view>
<view class="item-time-time">{{item.payTime==''? '未付款':item.payTime}}</view>
</view>
</view>
</view>
</view>
</block>
</view>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot">AI喵著</view>
</view>
</view>
</scroll-view>
</container-loading>
</view>
</view>
<wxs src="../../../utils/comm.wxs" module="tools"></wxs>

View File

@ -1 +1,165 @@
/* pages/shop/purchaseGoods/purchaseGoods.wxss */
/* pages/shop/purchaseGoods/purchaseGoods.wxss */
.search-container-fixed {
position: fixed;
top: 0;
left: 0;
display: flex;
flex-direction: column;
box-sizing: border-box;
width: 100%;
z-index: 99;
padding: 30rpx 0rpx;
}
.search-box {
background-color: var(--bg-gray-color);
display: flex;
flex-direction: row;
align-items: center;
margin: 0rpx 30rpx 0rpx 30rpx;
padding: 15rpx 20rpx;
border-radius: 60rpx;
font-size: 28rpx;
}
.search-input {
flex: 1;
}
.list-container {
display: flex;
flex-direction: column;
}
.container-box {
background-color: var(--white-color);
margin: 120rpx -30rpx 0rpx -30rpx;
padding: 30rpx;
min-height: 83vh;
}
.list-item {
display: flex;
flex-direction: row;
}
.list-item:nth-of-type(n+1) {
margin: 15rpx 0rpx;
padding-bottom: 20rpx;
border-bottom: 1rpx solid var(--bg-gray-input-color);
}
.list-item:last-child {
border-bottom: none;
}
.item-img-box {
background-color: var(--divider-color);
flex: 0.4;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 10rpx;
border-radius: 8rpx;
}
.item-img {
width: 68%;
height: 180rpx;
}
.item-container {
display: flex;
flex-direction: column;
flex: 1;
padding: 0rpx 15rpx;
}
.item-goods-name-box {
display: flex;
flex-direction: row;
align-items: center;
}
.item-goods-status {
font-size: 22rpx;
text-align: center;
line-height: 32rpx;
height: 32rpx;
white-space: nowrap;
padding: 3rpx 10rpx;
border-radius: 5rpx;
margin-right: 15rpx;
}
.item-goods-name {
font-size: 28rpx;
color: var(--text-color);
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
text-overflow: ellipsis;
}
.item-price-box {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 20rpx;
}
.item-price-title {
font-size: 28rpx;
color: var(--text-gray-hint-color);
}
.item-price-price {
margin-left: 20rpx;
color: var(--red-color);
font-weight: bold;
}
.item-time-box {
display: flex;
flex-direction: column;
margin-top: 15rpx;
}
.item-time-item {
display: flex;
flex-direction: row;
}
.item-time-title {
font-size: 24rpx;
color: var(--text-gray-hint-color)
}
.item-time-time {
font-size: 24rpx;
color: var(--text-gray-desc-color);
margin-left: 20rpx;
}
.col-gray {
background-color: var(--bg-gray-status-light-color);
color: var(--text-color);
}
.col-green {
background-color: var(--bg-green-status-light-color);
color: var(--text-color);
}
.col-primary {
background-color: var(--primary-color-light);
color: var(--text-color);
}
.col-red {
background-color: var(--bg-red-deep-color);
color: var(--white-color);
}

View File

@ -90,6 +90,45 @@ var invoiceStatus = function (status) {
}
return str
}
// 订单状态0:取消订单,1:待付款,2:待填写资料,3:过户中,4:平台下证
var goodsOrderStatus = function (status) {
var str = '已取消'
switch (status) {
case '0':
str = '已取消'
break
case '1':
str = '待付款'
break
case '2':
str = '写资料'
break
case '3':
str = '过户中'
break
case '4':
str = '已下证'
break
}
return str
}
var goodsOrderColor = function (status) {
var str = 'col-gray'
switch (status) {
case '0':
str = 'col-gray'
break
case '1':
case '2':
case '3':
str = 'col-primary'
break
case '4':
str = 'col-green'
break
}
return str
}
var coverTxt = function (price) {
return '<span style="font-size:12px;">¥</span>' + price
}
@ -383,5 +422,7 @@ module.exports = {
repairType: repairType,
repairKind: repairKind,
phoneNum: phoneNum,
includes: includes
includes: includes,
goodsOrderStatus: goodsOrderStatus,
goodsOrderColor: goodsOrderColor
};