Commit 9c79d042 by wangzhihui

Merge branch 'SAAS+V4.56.0-0908' of http://192.168.3.233:8090/saas/mini-program/…

…points-mall into SAAS+V4.56.0-0908
2 parents c0d80c49 5e6cdfae
......@@ -13,5 +13,19 @@ module.exports = {
method: 'scrm.api.shopmall.app.stockroom.goods.detail',
...data
})
},
/**获取前端分类 */
getHomeCategoryList(data) {
return api.post({
method: 'scrm.api.shopmall.scrm.frontendcategory.listAll',
...data
})
},
/**确认订单下单 */
createOrder(data) {
return api.post({
method: 'scrm.api.shopmall.points.order.create',
...data
})
}
}
\ No newline at end of file
......@@ -24,7 +24,7 @@
<view class="text">请确认信息无误</view>
<view class="input-box">
<view class="input-label">姓名</view>
<input bindinput="input" data-target="name" maxlength="10" value="{{walletObj.name}}" type="text" placeholder="请输入"/>
<input bindinput="input" data-target="name" maxlength="20" value="{{walletObj.name}}" type="text" placeholder="请输入"/>
</view>
<view class="input-box">
<view class="input-label">手机号</view>
......
......@@ -44,4 +44,3 @@
</view>
</template>
</view>
<sku bind:cancelSku="closeSku" bind:getCount="getCount" bind:sameAddress="resetAddress" wx:if="{{showSku}}" show="{{showSku}}" clickType="{{'join'}}"></sku>
\ No newline at end of file
......@@ -6,36 +6,189 @@ export const ToolList = Object.freeze([
},
]);
export const ORDER_LIST = [
{
export const OrderStatusEnum = {
ALL: "0",
PAY_PENDING: "10000", //待支付
WAIT_DELIVER: "10001", //待发货
WAIT_RECEIVE: "10002", //待收货
COMPLETED: "10003", //已完成
AFTER_SALE: "10004", //售后 (没有这个状态 显示用)
AFTER_SALE_PENDING_REVIEW: "10005", //售后中 -待审核
AFTER_SALE_WAIT_RECEIVE: "10006", //售后中 -待收货(审核通过)
AFTER_SALE_REJECTED: "10007", //售后审核不通过
AFTER_SALE_REFUNDED: "10008", //已退款
AFTER_SALE_REFUNDED_FAILED: "10009", //退款失败
};
export const OrderStatusTypes = {
QUERY_TAB: "QUERY_TAB",// 查询订单列表TAB项
MY_ORDER: "MY_ORDER",// 我的 页面 我的订单 显示的项目
};
export const GoodsSource = {
YZH: 1, //云中鹤订单
SELF: 2, //自营订单
};
export const OrderActionButtons = {
AFTER_SALE: {
text: "售后",
type: "cancelOrder",
class: "btn",
handler: "onAfterSale",
},
CONFIRM_RECEIVE: {
text: "确认收货",
type: "confirmReceive",
class: "btn",
handler: "onConfirmReceive",
},
SHOW_EXPRESS: {
text: "查看物流",
type: "showExpress",
class: "btn",
handler: "onShowExpress",
},
AFTER_SALE_DETAIL: {
text: "售后详情",
type: "after_sale_detail",
class: "btn",
handler: "onAfterSaleDetail",
},
AFTER_SALE_REJECTED: {
text: "审核不通过",
type: "after_sale_rejected",
class: "btn",
handler: "onAfterSaleDetail",
},
};
export const ORDER_STATUS = {
[OrderStatusEnum.ALL]: {
text: "全部",
code: 0,
status: OrderStatusEnum.ALL,
index: 0, // 查询订单列表TAB高亮的索引
requestType: 0, // 查询订单列表TAB查询参数
type: OrderStatusTypes.QUERY_TAB, // 查询订单列表显示的TAB项
},
{
[OrderStatusEnum.PAY_PENDING]: {
text: "待支付",
image: "noPay",
code: 1,
status: OrderStatusEnum.PAY_PENDING,
index: 1, // 查询订单列表TAB高亮的索引
requestType: 2,// 查询订单列表TAB查询参数
buttons: null,
type: OrderStatusTypes.MY_ORDER,//我的 页面 我的订单 显示的项目
},
{
[OrderStatusEnum.WAIT_DELIVER]: {
text: "待发货",
image: "noTakeCommodity",
code: 2,
},
{
status: OrderStatusEnum.WAIT_DELIVER,
index: 2,// 查询订单列表TAB高亮的索引
requestType: 6,// 查询订单列表TAB查询参数
type: OrderStatusTypes.MY_ORDER,//我的 页面 我的订单 显示的项目
buttons: {
[GoodsSource.SELF]: [OrderActionButtons.AFTER_SALE], //自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [OrderActionButtons.AFTER_SALE],//云中鹤商品 在商品列表对应的按钮
},
},
[OrderStatusEnum.WAIT_RECEIVE]: {
text: "待收货",
image: "takeCommodity",
code: 3,
},
{
status: 1008,
index: 3,// 查询订单列表TAB高亮的索引
requestType: 1,// 查询订单列表TAB查询参数
type: OrderStatusTypes.MY_ORDER,//我的 页面 我的订单 显示的项目
buttons: {
[GoodsSource.SELF]: [//自营商品 在商品列表对应的按钮
OrderActionButtons.AFTER_SALE,
OrderActionButtons.CONFIRM_RECEIVE,
OrderActionButtons.SHOW_EXPRESS,
],
[GoodsSource.YZH]: [//云中鹤商品 在商品列表对应的按钮
OrderActionButtons.AFTER_SALE,
OrderActionButtons.CONFIRM_RECEIVE,
OrderActionButtons.SHOW_EXPRESS,
],
},
},
[OrderStatusEnum.COMPLETED]: {
text: "已完成",
code: 4,
},
{
text: "售后",
status: OrderStatusEnum.COMPLETED,
index: 4,// 查询订单列表TAB高亮的索引
requestType: 4,// 查询订单列表TAB查询参数
type: OrderStatusTypes.QUERY_TAB,// 查询订单列表显示的TAB项
buttons: {
[GoodsSource.SELF]: [//自营商品 在商品列表对应的按钮
OrderActionButtons.SHOW_EXPRESS,
OrderActionButtons.AFTER_SALE,
],
[GoodsSource.YZH]: [//云中鹤商品 在商品列表对应的按钮
OrderActionButtons.SHOW_EXPRESS,
OrderActionButtons.AFTER_SALE,
],
},
},
[OrderStatusEnum.AFTER_SALE]: {
text: "退货/售后",
my_order_text: "售后",
image: "aftermarket",
code: 5,
},
];
status: OrderStatusEnum.AFTER_SALE,
index: 5,// 查询订单列表TAB高亮的索引
requestType: 3,// 查询订单列表TAB查询参数
buttons: null,
type: OrderStatusTypes.MY_ORDER,//我的 页面 我的订单 显示的项目
},
[OrderStatusEnum.AFTER_SALE_PENDING_REVIEW]: {
text: "售后中",
status: OrderStatusEnum.AFTER_SALE_PENDING_REVIEW,
tips: "您可以尝试再次提交退款申请", //售后详情提示语
image: "mine/order/error.png",//售后详情页面显示的状态图标
buttons: {
[GoodsSource.SELF]: [OrderActionButtons.AFTER_SALE_DETAIL],//自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [OrderActionButtons.AFTER_SALE_DETAIL],//云中鹤商品 在商品列表对应的按钮
},
},
[OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE]: {
text: "售后中",
status: OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE,
tips: "您可以尝试再次提交退款申请", //售后详情提示语
image: "mine/order/error.png",//售后详情页面显示的状态图标
buttons: {
[GoodsSource.SELF]: [OrderActionButtons.AFTER_SALE_DETAIL],//自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [OrderActionButtons.AFTER_SALE_DETAIL],//云中鹤商品 在商品列表对应的按钮
},
},
[OrderStatusEnum.AFTER_SALE_REJECTED]: {
text: "审核不通过",
status: OrderStatusEnum.AFTER_SALE_REJECTED,
tips: "您可以尝试再次提交退款申请",//售后详情提示语
image: "mine/order/error.png",//售后详情页面显示的状态图标
buttons: {
[GoodsSource.SELF]: [OrderActionButtons.AFTER_SALE_REJECTED],//自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [OrderActionButtons.AFTER_SALE_REJECTED],//云中鹤商品 在商品列表对应的按钮
},
},
[OrderStatusEnum.AFTER_SALE_REFUNDED]: {
text: "已退款",
status: OrderStatusEnum.AFTER_SALE_REFUNDED,
tips: "您可以尝试再次提交退款申请",//售后详情提示语
image: "mine/order/error.png",//售后详情页面显示的状态图标
buttons: {
[GoodsSource.SELF]: [OrderActionButtons.AFTER_SALE_DETAIL],//自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [OrderActionButtons.AFTER_SALE_DETAIL],//云中鹤商品 在商品列表对应的按钮
},
},
[OrderStatusEnum.AFTER_SALE_REFUNDED_FAILED]: {
text: "退款失败",
status: OrderStatusEnum.AFTER_SALE_REFUNDED_FAILED,
tips: "您可以尝试再次提交退款申请",//售后详情提示语
image: "mine/order/error.png",//售后详情页面显示的状态图标
buttons: {
[GoodsSource.SELF]: [OrderActionButtons.AFTER_SALE_DETAIL],//自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [OrderActionButtons.AFTER_SALE_DETAIL],//云中鹤商品 在商品列表对应的按钮
},
},
};
export const RefundReason = [
{
......@@ -214,60 +367,60 @@ export const OrderStatus = [
title: "待付款",
value: "1",
image: "mine/order-wait.png",
tips:'待付款'
tips: "待付款",
},
{
title: "已支付",
value: "2",
image: "mine/order-receiving.png",
tips:'已支付'
tips: "已支付",
},
{
title: "已关闭",
value: "3",
image: "mine/order-close.png",
tips:'已关闭'
tips: "已关闭",
},
{
title: "已发货",
value: "4",
image: "mine/order-receiving.png",
tips:'已发货'
tips: "已发货",
},
{
title: "已收货",
value: "5",
image: "mine/order-success.png",
tips:'已收货'
tips: "已收货",
},
{
title: "待发货",
value: "6",
image: "mine/order-wait.png",
tips:'待发货'
tips: "待发货",
},
{
title: "待安装",
value: "7",
image: "mine/order-wait.png",
tips:'待安装'
tips: "待安装",
},
{
title: "已安装",
value: "8",
image: "mine/order-success.png",
tips:'已安装'
tips: "已安装",
},
{
title: "售后中",
value: "9",
image: "mine/order-wait.png",
tips:'售后中'
tips: "售后中",
},
{
title: "售后完成",
value: "10",
image: "mine/order-close.png",
tips:'售后完成'
tips: "售后完成",
},
];
......@@ -6,31 +6,7 @@ Page({
*/
data: {
pageParams: {},
goodsList: [{
goodsId: '1',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: 'Tempo得宝手帕纸',
salePoints: '10',
marketPrice: '15.9'
}, {
goodsId: '2',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '维达抽纸超韧整箱M码家用实惠装面巾纸',
salePoints: '69.9',
marketPrice: '79.9'
}, {
goodsId: '3',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '5100西藏冰川矿泉水整箱',
salePoints: '10',
marketPrice: '15.9'
}, {
goodsId: '4',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '洁柔Face纸巾抽纸3层',
salePoints: '10',
marketPrice: '15.9'
}]
goodsList: []
},
/**
......
......@@ -38,16 +38,16 @@
<view class="text">
<view class="name">
<view class="text-hide">
{{item.goodsName}}
{{item.goodsSkuName}}
</view>
<view class="text-hide description">{{item.specificationData || ''}}</view>
</view>
<view class="price-box">
<view class="price">
{{item.retailPrice}}
{{item.redeemPoints}}
<text>积分</text>
</view>
<stepper data-item="{{item}}" count="{{item.goodsNumber}}" max="{{item.goodsStock}}" data-id="{{item.goodsId}}" bindchange="changeCount" data-index="{{index}}"></stepper>
<stepper data-item="{{item}}" count="{{item.sellQty}}" max="{{item.goodsStock}}" data-id="{{item.id}}" bindchange="changeCount" data-index="{{index}}"></stepper>
</view>
</view>
</view>
......
......@@ -212,4 +212,6 @@
}
.btn_primary {
color: #FC5B32;
font-size: 34rpx;
font-weight: 700;
}
\ No newline at end of file
......@@ -14,24 +14,18 @@ Page({
*/
onLoad(options) {
wx.p.router.getRouterParams(options).then(params => {
params = {
orderCode: '22232'
}
this.countdown(params.orderCode)
this.setData({
paramsData: params
})
this.countdown()
}).catch(err => {
console.error('参数获取失败:', err)
})
},
countdown(orderCode) {
countdown() {
this.timer = setInterval(() => {
let { count } = this.data
if (count == 0) {
clearInterval(this.timer)
// wx.p.router.reLaunch('/packageMine/pages/order/detail/detail', {orderCode})
wx.p.router.reLaunch('/packageMine/pages/order/index/index')
return
}
this.setData({
......@@ -41,8 +35,8 @@ Page({
},
viewOrderDetail() {
let { paramsData } = this.data
wx.p.router.reLaunch('/packageMine/pages/order/detail/detail', {orderCode: paramsData.orderCode})
clearInterval(this.timer)
wx.p.router.reLaunch('/packageMine/pages/order/index/index')
},
/**
......
import NP from "number-precision";
import cartApi from '~/api/module/cart.js'
Component({
/**
* 组件的属性列表
......@@ -6,18 +8,29 @@ Component({
show: Boolean,
address: Array,
type: String,
goods: Object,
goods: {
type: Object,
observer: function(n) {
this.setData({
detailInfo: JSON.parse(JSON.stringify(n))
}, () => {
this.setData({
['detailInfo.platformGlGoodsSpecifications[0].active']: true
})
})
}
},
defaultAddress: Object,
defaultAds: String,
staffShop:Boolean,
canPay:Boolean,
clickType: String
},
data: {
currentIndex: 0,
goodsNumber: 1,
showJfModal:false,
jfCount:0
showJfModal: false,
jfCount: 0,
detailInfo: {}
},
/**
......@@ -25,9 +38,8 @@ Component({
*/
methods: {
computeJf(num) {
let {goods,jfCount,staffShop} = this.data
if(!staffShop)return
jfCount = NP.times(goods.redeemPoints,num)
let {detailInfo, jfCount} = this.data
jfCount = NP.times(detailInfo.redeemPoints || 0, num)
this.setData({
jfCount
})
......@@ -38,6 +50,24 @@ Component({
})
this.triggerEvent('cancelSku')
},
choose(e) {
let { target } = e.currentTarget.dataset
let { detailInfo } = this.data
detailInfo?.platformGlGoodsSpecifications?.forEach(val => {
val.active = false
if (val.specificationData == target.specificationData) val.active = true
})
this.setData({
detailInfo,
['detailInfo.redeemPoints']: target.retailPrice,
['detailInfo.goodsStock']: target.stock,
['detailInfo.specificationData']: target.specificationData
})
const thisPage = wx.p.router.getPageInstance()
thisPage.setData({
activeSku: target.specificationData
})
},
changeCount(e) {
this.triggerEvent('getCount', e.detail)
this.computeJf(e.detail)
......@@ -51,45 +81,47 @@ Component({
showAddress: true
})
},
getAddress(e) {
this.setData({
defaultAds: e.detail.contactAddress,
defaultAddress: e.detail.defaultAddress
})
this.triggerEvent('sameAddress', e.detail)
},
intRemain(e) {
this.setData({
remain: e.detail.value
})
},
toCreatedOrder() {
let { clickType } = this.data
if (clickType != 'pay') {
let { clickType, remain, detailInfo, defaultAddress, goodsNumber } = this.data
const userInfo = wx.p.storage.get('userInfo')
if (!['pay', 'join'].includes(clickType)) {
return this.cancel()
}
const { remain, goods, goodsNumber, defaultAddress,staffShop } = this.data
detailInfo.sellQty = goodsNumber || detailInfo.sellQty
detailInfo?.platformGlGoodsSpecifications?.forEach(val => {
if (val.active) detailInfo.specificationData = val.specificationData
})
if (clickType == 'join') {
// 加入购物车
const PARAMS = {
goodsId: detailInfo.id,
sellQty: goodsNumber || detailInfo.startQty,
goodsSource: detailInfo.goodsSource,
scoreSource: userInfo?.channelSource,
specificationData: detailInfo?.specificationData,
merchantId: userInfo?.merchantId
}
wx.p.wxApi.showLoading()
cartApi.addToCart(PARAMS).then(res => {
wx.hideLoading()
wx.p.wxApi.showToast('加入购物车成功')
this.cancel()
})
return
}
if(!defaultAddress.receiveName){
return wx.p.wxApi.showToast('请选择收货地址')
}
// 跳转到确认订单
let query = {
receiveName: defaultAddress.receiveName,
receiveMobile: defaultAddress.receiveMobile,
provinceId: defaultAddress.provinceId,
provinceName: defaultAddress.provinceName,
cityId: defaultAddress.cityId,
cityName: defaultAddress.cityName,
countyId: defaultAddress.countyId,
countyName: defaultAddress.countyName,
address: defaultAddress.address,
customerOpenId:staffShop?userStorage.weChatOpenId:userInfo.openId,
defaultAddress,
buyerMsg: remain,
orderGoodsList: [{
goodsSkuCode: goods.goodsSkuCode,
goodsSkuName: goods.goodsSkuName,
sellQty: goodsNumber,
}],
goodsList: [{...detailInfo}],
}
wx.p.router.go('/packageIndex/pages/confirmOrder/index', query)
}
......
......@@ -84,21 +84,24 @@
flex-wrap: wrap;
.sku {
padding: 6rpx 20rpx;
background: #F7F8FA;
border-radius: 4rpx;
margin-right: 16rpx;
margin-bottom: 20rpx;
padding: 6rpx 20rpx;
background: #F7F8FA;
font-weight: 400;
font-size: 24rpx;
border-radius: 12rpx;
margin-right: 16rpx;
margin-bottom: 20rpx;
}
.sku_active {
background: #fc5b320f;
border: 2rpx solid #FC5B32;
border-radius: 4rpx;
font-weight: 400;
font-size: 24rpx;
color: #FC5B32;
}
.disabled{
background-color: #B1B1B3 !important;
color: #000000!important;
}
}
}
......
......@@ -4,34 +4,39 @@
<view class="container">
<view class="goods-box flex_sc">
<view class="cover">
<glsx-image class="cover" src="{{goods.imageResponses[0].imgUrl}}" />
<glsx-image class="cover" src="{{detailInfo.imageResponses[0].imgUrl}}" />
</view>
<view class="right-box">
<view class="price-box">
<text class="price">{{goods.sellPrice}}</text><text>积分</text>
<text class="price">{{detailInfo.redeemPoints}}</text><text>积分</text>
</view>
<view wx:if="{{goods.stock}}" class="stock">有货(库存{{goods.stock}})</view>
<view wx:if="{{detailInfo.stock}}" class="stock">有货(库存{{detailInfo.stock}})</view>
<view wx:else class="stock">暂无存货</view>
<block>
<view wx:if="{{goods.goodsSource == '2'}}" class="selct-box">已选:{{goods.specificationData}}</view>
<view wx:else class="selct-box">已选:{{goodsNumber}}{{goods.goodsUnit}}</view>
<view wx:if="{{detailInfo.goodsSource == 1}}" class="selct-box">已选:{{goodsNumber}}{{detailInfo.goodsUnit}}</view>
<view wx:else class="selct-box">已选:{{detailInfo.specificationData}}</view>
</block>
</view>
</view>
<view class="sku-box">
<view class="title">规格</view>
<view class="sku-list">
<block wx:for="{{goods.specificationResponses}}" wx:key="index">
<view class="sku-list" wx:if="{{detailInfo.goodsSource == 1}}">
<block wx:for="{{detailInfo.specificationResponses}}" wx:key="index">
<view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view>
</block>
</view>
<view class="sku-list" wx:else>
<block wx:for="{{detailInfo.platformGlGoodsSpecifications}}" wx:key="index">
<view class="sku flex_cc {{item.active ? 'sku_active' : ''}} {{i.stock ===0?'disabled':''}}" bindtap="choose" data-target="{{item}}">{{item.specificationData}}</view>
</block>
</view>
</view>
<view class="count-box flex_scb">
<view class="title">数量</view>
<view class="right flex_sc">
<!-- <view class="tip">至少购买{{goods.startQty}}{{goods.goodsUnit}}</view> -->
<view class="stepper">
<stepper count="{{goodsNumber}}" min="{{goods.startQty}}" max="{{goods.goodsStock}}" catchchange="changeCount"></stepper>
<stepper count="{{goodsNumber}}" max="{{detailInfo.goodsStock}}" catchchange="changeCount"></stepper>
</view>
</view>
</view>
......
......@@ -2,10 +2,7 @@ const navStyle = 'background-color: transparent;'
let navBarHeight = 38
import homeApi from '~/api/module/home.js'
import cartApi from '~/api/module/cart.js'
// import { mineApi, shopmallApi } from '~/api/api'
// import MineApi from '~/api/mineApi/index'
// import NP from 'number-precision'
// import USERAPI from '~/api/usersApi/index'
import mineApi from '~/api/module/mine.js'
Page({
data: {
navStyle,
......@@ -23,70 +20,23 @@ Page({
payWayActions: [{ name: '金额支付', type: 1, disabled: false }, { name: '积分兑换', type: 2, disabled: false }],
detailInfo: {},
addressList: [{
id: 1,
receiveName: '何瑶1',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 1
}, {
id: 2,
receiveName: '何瑶2',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 3,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 4,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 5,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 6,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 7,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
"userId" : 91713345,
"cityId" : null,
"areaId" : 440305,
"createTime" : 1755922362000,
"provinceId" : null,
"cityName" : "深圳市",
"countyName" : "南山区",
"postCode" : "518000",
"receiveName" : "qw",
"provinceName" : "广东省",
"address" : "广东省深圳市南山区南山街道学府路30号",
"updateTime" : null,
"isDefault" : 1,
"phoneNumber" : "18555558878",
"id" : 58
}],
defaultAddress: {id: 3}
defaultAddress: {}
},
appHide() {
wx.offAppHide()
......@@ -126,7 +76,8 @@ Page({
})
},
goodsActionClick(e) {
if (e.detail == 'join') return this.toAddShopCar()
let { detailInfo } = this.data
if (e.detail == 'join' && detailInfo.goodsSource == 1) return this.toAddShopCar()
this.showSkuModal(e.detail)
},
onLoad(options) {
......@@ -135,7 +86,7 @@ Page({
}).catch(err => {
console.error('参数获取失败:', err)
})
// this.getPlatFormAddress()
this.getPlatFormAddress()
},
showSkuModal(type) {
this.setData({
......@@ -149,57 +100,54 @@ Page({
})
},
// 获取默认的地址
getPlatFormAddress(satff) {
// wx.showLoading()
let para = {}
// if (staff) {
// para.businessType = 1
// }else{
// const SID = wx.p.util.getSessionId()
// if (!SID) return wx.hideLoading()
// }
let contactAddress = '', defaultAddress = {}
let _isSetDefault = false
this.data.addressList?.forEach(el => {
if (el.isDefault == 1) {
contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
getPlatFormAddress() {
let res = this.data.addressList
let _isSetDefault = false, contactAddress = '', defaultAddress = {}
if (res && res.length) {
res.forEach(el => {
if (el.isDefault == 1) {
contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
defaultAddress = el
_isSetDefault = true
_isSetDefault = true
}
})
if (!_isSetDefault) {
let _first = res[0] || {}
contactAddress = _first.provinceName + _first.cityName + _first.countyName + _first.address,
defaultAddress = _first
}
})
if (!_isSetDefault) {
let _first = this.data.addressList[0]
contactAddress = _first.provinceName + _first.cityName + _first.countyName + _first.address,
defaultAddress = _first
}
this.setData({
addressList: res || [],
contactAddress,
defaultAddress
})
// shopmallApi.platformAddressList(para).then(data => {
// wx.hideLoading()
// let contactAddress = '', defaultAddress = {}
// let _isSetDefault = false
// if (data && data.length) {
// data.forEach(el => {
// if (el.isDefault == 1) {
// contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
// defaultAddress = el
// _isSetDefault = true
// }
// })
// if (!_isSetDefault) {
// let _first = data[0]
// contactAddress = _first.provinceName + _first.cityName + _first.countyName + _first.address,
// defaultAddress = _first
// }
// }
// this.setData({
// addressList: data,
// contactAddress,
// defaultAddress
// })
// })
return
wx.p.wxApi.showLoading()
mineApi.platformAddressList({}).then(res => {
wx.hideLoading()
let _isSetDefault = false, contactAddress = '', defaultAddress = {}
if (res && res.length) {
res.forEach(el => {
if (el.isDefault == 1) {
contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
defaultAddress = el
_isSetDefault = true
}
})
if (!_isSetDefault) {
let _first = res[0] || {}
contactAddress = _first.provinceName + _first.cityName + _first.countyName + _first.address,
defaultAddress = _first
}
}
this.setData({
addressList: res || [],
contactAddress,
defaultAddress
})
console.log(defaultAddress, '222')
})
},
// 显示地址选择弹窗
toShowAddressModal() {
......@@ -232,13 +180,18 @@ Page({
},
// 获取详情
getDetail(options) {
homeApi.getGoodsDetailInfo({id: options.id}).then(res => {
homeApi.getGoodsDetailInfo({id: options.id, businessType: 1}).then(res => {
res.goodsSource = options.goodsSource
if (res && res.specificationResponses?.length) {
this.toGetSpecString(res, res.startQty)
}
if (res && res.platformGlGoodsSpecifications?.length) {
let item = res.platformGlGoodsSpecifications[0] || {}
res.redeemPoints = item.retailPrice
res.goodsStock = item.stock
res.specificationData = item.specificationData
this.setData({
activeSku: res.platformGlGoodsSpecifications[0].specificationData
activeSku: item.specificationData
})
}
this.setData({
......@@ -257,7 +210,8 @@ Page({
})
},
getCount(e) {
this.toGetSpecString(this.data.detailInfo, e.detail)
let { detailInfo } = this.data
if (detailInfo?.goodsSource == 1) this.toGetSpecString(this.data.detailInfo, e.detail)
this.count = e.detail
},
// 添加购物车
......@@ -267,12 +221,13 @@ Page({
const PARAMS = {
goodsId: detailInfo.id,
sellQty: this.count || detailInfo.startQty,
goodsSkuCode: detailInfo.goodsSkuCode,
goodsSource: detailInfo.goodsSource,
scoreSource: userInfo?.channelSource
goodsSource: detailInfo.goodsSource || 1,
scoreSource: userInfo?.channelSource,
specificationData: detailInfo?.specificationData,
merchantId: userInfo?.merchantId
}
cartApi.addToCart(PARAMS).then(res => {
wx.$api.showToast('加入购物车成功')
wx.p.wxApi.showToast('加入购物车成功')
})
},
// 同步选择的地址
......@@ -331,6 +286,5 @@ Page({
title,
path
}
},
}
})
\ No newline at end of file
......@@ -48,7 +48,7 @@
<text>剩余 {{detailInfo.remaining}}</text> | <text>销售 {{detailInfo.saleNum}}</text>
</view>
</view>
<view class="goods-title">{{detailInfo.brandName}}{{detailInfo.goodsSkuName}}</view>
<view class="goods-title"><text wx:if="{{detailInfo.goodsSource == 1}}">{{detailInfo.brandName}}</text>{{detailInfo.goodsSkuName}}</view>
</view>
<view class="container-item select-params-box">
<view class="cell" bind:tap="showSkuModal" data-type="choose">
......@@ -79,9 +79,24 @@
</view>
<view class="goods-detail-box">
<view class="title">商品详情</view>
<view class="image-list-wrap">
<view class="image-list-wrap" wx:if="{{detailInfo.goodsSource == 1}}">
<mp-html content="{{detailInfo.goodsDescribe}}"></mp-html>
</view>
<view wx:else>
<block wx:for="{{goodsInfo.goodsDescList}}" wx:key="index">
<view class="content">
<block wx:if="{{item.resType == 1}}">
<image webp src="{{item.content}}" mode="widthFix" bindtap="previewImage" data-current="{{item.content}}" data-item="{{goodsInfo.goodsDescList}}" lazy-load></image>
</block>
<block wx:elif="{{item.resType == 2}}">
{{item.content}}
</block>
<block wx:else>
<video src="{{item.content}}" style="height:{{item.height}}px;width:100%"></video>
</block>
</view>
</block>
</view>
</view>
</view>
</view>
......@@ -111,5 +126,5 @@
<block wx:if="{{navHeight}}">
<goods-action platformShop="{{true}}" bindready="goodsActionReady" pay-disabled="{{false}}" upgradeSet="{{!detailInfo.retailPrice&&detailInfo.exchangeIntegral}}" stock="{{detailInfo.goodsStock===0}}" buyFlag="{{false}}" bindclick="goodsActionClick" hideShop="{{false}}"></goods-action>
</block>
<sku bind:cancelSku="closeSku" bind:getCount="getCount" bind:sameAddress="resetAddress" show="{{showSku}}" defaultAds="{{contactAddress}}" goods="{{detailInfo}}" clickType="{{clickType}}" address="{{addressList}}"></sku>
<sku bind:cancelSku="closeSku" bind:getCount="getCount" bind:sameAddress="resetAddress" show="{{showSku}}" defaultAds="{{contactAddress}}" goods="{{detailInfo}}" clickType="{{clickType}}" address="{{addressList}}" defaultAddress="{{defaultAddress}}"></sku>
<address address="{{addressList}}" defaultAddress="{{defaultAddress}}" bind:getAddress="getAddress" show="{{showAddress}}"></address>
\ No newline at end of file
// packageIndex/pages/selfGoodsDetail/index.js
import homeApi from '~/api/module/home.js'
import mineApi from '~/api/module/mine.js'
const navStyle = 'background-color: transparent;'
let navBarHeight = 38
Page({
......@@ -12,70 +13,23 @@ Page({
goodsFlag: true,
goodsInfo: {},
addressList: [{
id: 1,
receiveName: '何瑶1',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 1
}, {
id: 2,
receiveName: '何瑶2',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 3,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 4,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 5,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 6,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 7,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
"userId" : 91713345,
"cityId" : null,
"areaId" : 440305,
"createTime" : 1755922362000,
"provinceId" : null,
"city" : "深圳市",
"area" : "南山区",
"postCode" : "518000",
"receiveName" : "qw",
"province" : "广东省",
"address" : "广东省深圳市南山区南山街道学府路30号",
"updateTime" : null,
"isDefault" : 1,
"phoneNumber" : "18555558878",
"id" : 139
}],
defaultAddress: {id: 2}
defaultAddress: {}
},
/**
......@@ -172,16 +126,42 @@ Page({
getDetail(options) {
homeApi.getGoodsDetailInfo({id: options.id}).then(res => {
console.log(res)
if (res && res.platformGlGoodsSpecifications?.length) {
this.setData({
activeSku: res.platformGlGoodsSpecifications[0].specificationData,
['goodsInfo.redeemPoints']: res.platformGlGoodsSpecifications[0].retailPrice
})
}
})
let { goodsInfo } = this.data
let activeSku = null
if (goodsInfo.specificationList && goodsInfo.specificationList.length) {
activeSku = goodsInfo.specificationDetailList[0].specificationData
goodsInfo.skuPrice = goodsInfo.specificationDetailList[0].retailPrice
}
this.setData({
goodsInfo,
activeSku
},
// 获取地址
getPlatFormAddress(staff) {
wx.p.wxApi.showLoading()
mineApi.platformAddressList({}).then(data => {
console.log(data)
wx.hideLoading()
let contactAddress = '', defaultAddress = {}
let _isSetDefault = false
if (data && data.length) {
data.forEach(el => {
if (el.isDefault == 1) {
contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
defaultAddress = el
_isSetDefault = true
}
})
if (!_isSetDefault) {
let _first = data[0]
contactAddress = _first.provinceName + _first.cityName + _first.countyName + _first.address,
defaultAddress = _first
}
}
this.setData({
addressList: data,
contactAddress,
defaultAddress
})
})
},
......
......@@ -139,6 +139,7 @@ Page({
delete obj.createTime;
delete obj.updateTime;
}
console.log(obj, '===')
wx.p.api.mineApi[target](obj).then(() => {
wx.p.wxApi.showToast("操作成功");
setTimeout(() => {
......
......@@ -36,6 +36,7 @@ Page({
contactAddress,
contactName: item.receiveName,
contactPhone: item.phoneNumber,
id: item.id
},
isDefault: item.isDefault == 1,
});
......
......@@ -35,12 +35,16 @@ const GoodsSource ={
'SELF':2
};
// const ActionMaps = {
// [GoodsSource.SELF]:[
// {text: '核验', type: 'verification', class: 'btn', handler: this.onVerification.bind(this)}
// ]
// };
const ActionMaps = {
[GoodsSource.SELF]:{
},
[GoodsSource.YZH]:{
}
};
import { ORDER_STATUS , OrderStatusEnum} from "~/constants/mine.js";
Component({
/**
* 组件的属性列表
......@@ -49,9 +53,10 @@ Component({
item: {
type: Object,
value: {},
observer: function () {
observer: function (d) {
console.log(d)
// 当item变化时重新计算按钮
this.updateButtons();
d?.id && this.updateButtons();
},
},
hasUserInfo: {
......@@ -59,7 +64,7 @@ Component({
value: false,
observer: function () {
// 当hasUserInfo变化时重新计算按钮
this.updateButtons();
// this.updateButtons();
},
},
},
......@@ -76,6 +81,33 @@ Component({
* 组件的方法列表
*/
methods: {
orderStatus(){
//订单状态 orderStatus (1001:待支付 1002:待审核,1003:审核不通过,1004:已取消(交易失败) ,1005:订单异常,1006:待处理,1007: 待发货,1008:已发货,1009:已完成(交易成功),1010:售后处理中,1012 订单关闭
//退换货状态 returnStatus (1000:待审核,1001:待收货,1002:已收货,1003:已退款,1004:已生成新订单,1005:已取消,1006:退款异常,1007:商品退回,1008:审核不通过,1010:换货新订单待收货,1011:换货新订单已签收)
//退款状态 refundStatus (1000:待审核,1001:待退款,1002:已退款,1003:已取消,1004:退款异常,1005:审核不通过)
//订单取消状态 cancelStatus(1000:取消成功,1010:取消审核中)
//退款状态 returnOrderStatus(1000:待审核,1001:审核通过,1002:已收货,1003:已退款,1004:已生成新订单,1005:审核不通过)
//goodsSource 1.云中鹤 2.平台商品
console.log(this.data.item)
const {orderStatus,goodsSource,cancelStatus,returnStatus,refundStatus,returnOrderStatus} = this.data.item
if([1002,1006,1007].includes(orderStatus) && (!cancelStatus || cancelStatus==1010)) {
return OrderStatusEnum.WAIT_DELIVER //待发货 order_status属于(1002,1006,1007)且cancel_status不存在或者审核中(1010)
} else if(orderStatus==1008 && (!cancelStatus || cancelStatus==1010)){
return OrderStatusEnum.WAIT_RECEIVE //待收货 order_status属于(1008)且cancel_status不存在或者审核中(1010)
} else if (orderStatus==1009 && (!cancelStatus || cancelStatus==1010)){
return OrderStatusEnum.COMPLETED //已完成 order_status属于(1009)且cancel_status不存在或者审核中(1010)
} else if((returnOrderStatus==1000 && returnStatus==1000) || (returnOrderStatus==1000 && refundStatus==1000)){
return OrderStatusEnum.AFTER_SALE_PENDING_REVIEW //售后---待审核 退款退货的return_order_status:1000:待审批且return_status退换货状态(1000:待审核) 仅退款的return_order_status:1000:待审批且refund_status 退款状态(1000:待审核
} else if(returnOrderStatus==1001 && returnStatus==1001){
return OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE//售后---待收货(审核通过) 退款退货的return_order_status:1001:审核通过 且return_status退换货状态(1001:待收货),仅退款的直接到退款完成/退款失败
} else if((returnOrderStatus==1005 && returnStatus==1008) || (returnOrderStatus==1005 && refundStatus==1008)){
return OrderStatusEnum.AFTER_SALE_REJECTED //售后 -- 审核不通过 退款退货的return_order_status:1005:审核不通过且return_status退换货状态(1008:审核不通过), 仅退款的return_order_status:1005 且refund_status 退款状态(1008:审核不通过
} else if((returnOrderStatus==1003 && [1002,1003].includes(returnStatus))|| (returnOrderStatus==1003 && refundStatus==1002)){
return OrderStatusEnum.AFTER_SALE_REFUNDED // 已退款 退款退货的订单return_order_status:1003:已退款且return_status退换货状态(1002:已收货,1003:已退款),仅退款订单 return_order_status:1003:已退款且refund_status 退款状态1002:已退款,
} else if((returnOrderStatus==1003 && returnStatus==1006) || (returnOrderStatus==1003 && refundStatus==1004)){
return OrderStatusEnum.AFTER_SALE_REFUNDED_FAILED // 退款失败 退款退货的return_order_status:1003:已退款 return_status退换货状态(1006:退款异常 ,,仅退款的return_order_status:1003:已退款 且refund_status 退款状态,1004:退款异常
}
},
// 获取当前订单应该显示的按钮
getButtons() {
const { item, hasUserInfo } = this.data;
......@@ -173,9 +205,9 @@ Component({
) {
buttons.push({
text: "确认收货",
type: "confirmReceipt",
type: "confirmReceive",
class: "btn confirm",
handler: this.onConfirmReceipt.bind(this),
handler: this.onConfirmReceive.bind(this),
});
}
......@@ -260,7 +292,7 @@ Component({
// 更新按钮
updateButtons() {
const buttons = this.getButtons();
const buttons = ORDER_STATUS[this.orderStatus()].buttons[2]//this.getButtons();
this.setData({
buttons,
orderItem: this.data.item,
......@@ -368,7 +400,7 @@ Component({
},
// 确认收货
onConfirmReceipt(e) {
onConfirmReceive(e) {
let { orderCode } =
e.currentTarget.dataset.item || e.currentTarget.dataset;
wx.showModal({
......
import cartApi from '~/api/module/cart.js'
import NP from "number-precision";
Page({
/**
* 页面的初始数据
*/
data: {
count: 0,
goodsList: [{
payeeMerchantId: 44184606,
payeeMerchantName: "广联嘀加平台超级管理员",
platform: false,
upgrade: false,
activityId: null,
activityPrice: null,
cartType: 1,
deliveryType: 2,
flag: 2,
specificationData: '象牙白',
depositPrice: null,
expressFee: 10,
goodsId: 34,
goodsImage: "https://scrm.test.glsx.com.cn/group1/M00/00/3F/wKgD3mF3f--AEfHQAAC-XmaLhCs352.png",
goodsName: "贝得车载吸尘器(蓝色)",
goodsNumber: 1,
goodsSkuCode: null,
goodsSource: null,
goodsStock: 9975,
id: 355,
memberPrice: null,
paymentType: null,
retailPrice: "32",
retainagePrice: null,
specificationKey: null,
userMerchantId: null,
}, {
payeeMerchantId: 44184606,
payeeMerchantName: "广联嘀加平台超级管理员",
platform: false,
upgrade: false,
activityId: null,
activityPrice: null,
cartType: 1,
deliveryType: 2,
depositPrice: null,
expressFee: 10,
goodsId: 34,
goodsImage: "https://scrm.test.glsx.com.cn/group1/M00/00/3F/wKgD3mF3f--AEfHQAAC-XmaLhCs352.png",
goodsName: "贝得车载吸尘器(蓝色)",
goodsNumber: 1,
goodsSkuCode: null,
goodsSource: null,
goodsStock: 9975,
id: 356,
memberPrice: null,
paymentType: null,
retailPrice: "32",
retainagePrice: null,
specificationData: null,
specificationKey: null,
userMerchantId: null,
}, {
payeeMerchantId: 44184606,
payeeMerchantName: "广联嘀加平台超级管理员",
platform: false,
upgrade: false,
activityId: null,
activityPrice: null,
cartType: 1,
deliveryType: 2,
depositPrice: null,
expressFee: 10,
goodsId: 34,
goodsImage: "https://scrm.test.glsx.com.cn/group1/M00/00/3F/wKgD3mF3f--AEfHQAAC-XmaLhCs352.png",
goodsName: "贝得车载吸尘器(蓝色)",
goodsNumber: 1,
goodsSkuCode: null,
goodsSource: null,
goodsStock: 9975,
id: 357,
memberPrice: null,
paymentType: null,
retailPrice: "32",
retainagePrice: null,
specificationData: '等方式尽快发',
specificationKey: null,
userMerchantId: null,
}],
goodsList: [],
shoppingcartFlag: true
},
goodsActionReady(e) {
......@@ -94,26 +16,36 @@ Page({
},
changeCount(e) {
let count = e.detail
let { userInfo } = this.data
let {
index,
item
} = e.currentTarget.dataset
if (item.goodsNumber == count) return
let { userInfo } = this.data
this.setData({
[`goodsList[${index}].goodsNumber`]: count
})
this.cheackAll()
wx.p.wxApi.showLoading('正在加载...')
if (item.sellQty == count) return
let para = {
goodsId: 1,
sellQty: count,
goodsId: item.goodsId,
goodsSource: item?.goodsSource,
scoreSource: userInfo?.channelSource,
merchantId: userInfo?.merchantId,
specificationData: item?.specificationData
}
cartApi.updateGoodsFormCart(para).then(res => {
wx.hideLoading()
this.setData({
[`goodsList[${index}].sellQty`]: count
}, () => {
this.cheackAll()
wx.p.wxApi.showLoading()
// 调用添加购物车接口
if (count > item.sellQty) {
para.sellQty = NP.minus(count, item.sellQty) // 修改后数量减去之前数量
cartApi.addToCart(para).then(() => {
wx.hideLoading()
})
} else { // 调用减少物车商品接口
para.sellQty = NP.minus(item.sellQty, count)
cartApi.updateGoodsFormCart(para).then(res => {
wx.hideLoading()
})
}
})
},
choose(e) {
......@@ -146,8 +78,8 @@ Page({
}
goodsList?.map(e => {
if (e.active) {
count += e.goodsNumber
sum += e.retailPrice * e.goodsNumber
count += e.sellQty
sum += e.redeemPoints * e.sellQty
}
})
this.setData({
......@@ -190,31 +122,31 @@ Page({
let params = {
goodsList: data
}
wx.p.router.go('/packageIndex/pages/confirmOrder/index', {...params})
wx.p.router.go('/packageIndex/pages/confirmOrder/index', params)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let userInfo = wx.p.storage.get(userInfo)
let userInfo = wx.p.storage.get('userInfo')
this.setData({userInfo})
// this.getShoppingcartList()
this.getShoppingcartList()
},
getShoppingcartList() {
wx.p.wxApi.showLoading('加载中...')
wx.p.wxApi.showLoading()
let userInfo = wx.p.storage.get('userInfo')
let para = {
cartType: 1
scoreSource: userInfo?.channelSource,
merchantId: userInfo?.merchantId
}
cartApi.getCartList(para)
.then(data => {
data.map(e => {
e.list.map(i => (i.retailPrice = Number(i.retailPrice).toFixed(2)))
})
this.setData({
goodsList: data,
goodsList: data?.goodsList || [],
shoppingcartFlag: true,
count: 0,
sum: 0
sum: 0,
allActive: false
})
wx.hideLoading()
})
......@@ -225,23 +157,27 @@ Page({
})
},
del(e) {
wx.p.wxApi.showLoading('请稍后...')
wx.p.wxApi.showLoading()
let {
target
} = e.target.dataset
let { userInfo } = this.data
// 删除调用减少商品数量接口
let para = {
goodsId: 1,
sellQty: 0,
goodsId: target.goodsId,
sellQty: target.sellQty,
goodsSource: target?.goodsSource,
scoreSource: userInfo?.channelSource,
merchantId: userInfo?.merchantId,
specificationData: target.specificationData
}
wx.p.wxApi.showLoading()
cartApi.updateGoodsFormCart(para).then(res => {
wx.hideLoading()
wx.p.wxApi.showToast('删除成功')
setTimeout(() => {
this.getShoppingcartList()
}, 1.5 * 1000)
}, 0.5 * 1000)
})
},
/**
......@@ -251,7 +187,9 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
onShow: function () {
this.getShoppingcartList()
},
/**
* 生命周期函数--监听页面隐藏
*/
......
......@@ -25,17 +25,17 @@
<view wx:else class="invalid-icon">失效</view>
<view class="goods-info">
<view class="preview">
<image webp src="{{item.goodsImage}}"></image>
<image webp src="{{item.goodsImageUrl}}"></image>
</view>
<view class="text">
<view class="text-hide">{{item.goodsName}}</view>
<view class="text-hide">{{item.goodsSkuName}}</view>
<view class="specification" wx:if="{{item.specificationData}}">{{item.specificationData}}</view>
<view class="price-box" wx:if="{{!item.flag}}">
<view class="price">
{{item.retailPrice || 0}}
{{item.redeemPoints || 0}}
<text>积分</text>
</view>
<stepper count="{{item.goodsNumber}}" max="{{item.goodsStock}}" catchchange="changeCount"
<stepper count="{{item.sellQty}}" max="{{item.goodsStock}}" catchchange="changeCount"
data-index="{{index}}" data-item="{{item}}"></stepper>
</view>
<view wx:else class="invalid">该商品已下架/库存不足</view>
......
......@@ -4,7 +4,7 @@
<scroll-view scroll-x class="fixed-tabs" scroll-into-view="{{to}}">
<block wx:for="{{tab}}" wx:key="index">
<view
class="tab-item {{activeTab === item.id ? 'active' : ''}}"
class="tab-item {{activeTab == item.id ? 'active' : ''}}"
bindtap="handleFixedTabChange"
data-value="{{item.id}}"
id="to-{{item.id}}"
......@@ -19,7 +19,7 @@
<scroll-view scroll-x class="dynamic-tabs" scroll-into-view="{{subTo}}">
<block wx:for="{{subTab}}" wx:key="index">
<view
class="tab-item {{activeSubTab === item.id ? 'active' : ''}}"
class="tab-item {{activeSubTab == item.id ? 'active' : ''}}"
bindtap="handleDynamicTabChange"
data-value="{{item.id}}"
id="to-{{item.id}}"
......
......@@ -35,22 +35,7 @@ Page({
id: '4',
label: '200-300积分'
}],
subTab: [{
id: '',
label: '全部品类'
}, {
id: '1',
label: '汽车保养'
}, {
id: '2',
label: '车载设备'
}, {
id: '3',
label: '个护清洁'
}, {
id: '4',
label: '休闲零食'
}],
subTab: [],
activeTab: '',
frontendCategoryId: '',
goodsList: []
......@@ -111,6 +96,7 @@ Page({
this.setData({loginPageFlag: params?.loginPageFlag}, () => {
this.getPointsWallet()
this.getGoodsList()
this.getCategory()
})
}).catch(err => {
console.error('参数获取失败:', err)
......@@ -155,6 +141,22 @@ Page({
})
},
// 获取前端分类
getCategory() {
homeApi.getHomeCategoryList({}).then(res => {
res?.forEach(val => {
val.label = val.categoryName
})
res?.unshift({
id: '',
label: '全部分类'
})
this.setData({
subTab: res || []
})
})
},
// 获取商品数据
getGoodsList() {
let { pageNum, goodsList, goodsSkuName, frontendCategoryId, activeTab } = this.data
......@@ -163,7 +165,8 @@ Page({
pageNum,
pageSize: 4,
goodsSkuName,
frontendCategoryId
frontendCategoryId,
businessType: 1
}
if (activeTab == 1) { // 我能兑换
params.canExchange = 1,
......@@ -175,10 +178,6 @@ Page({
params.storeEnd = activeTab == 2 ? 100 : activeTab == 3 ? 200 : activeTab == 4 ? 300 : ''
}
homeApi.getGoodsStockroomList(params).then(res => {
res?.list?.forEach((val, index) => {
if (index == 0 ) val.goodsSource = 2
else val.goodsSource = 1
})
this.setData({
goodsList: pageNum == 1 ? res?.list || [] : [...goodsList, ...res?.list],
pages: res.pages,
......
// pages/tab/mine/components/myOrder/myOrder.js
import { ORDER_LIST } from '~/constants/mine.js';
import { ORDER_STATUS, OrderStatusTypes } from "~/constants/mine.js";
Component({
/**
......@@ -13,7 +13,20 @@ Component({
* 组件的初始数据
*/
data: {
orderList: Object.freeze(ORDER_LIST.filter((item) => item.image)),
orderList: Object.freeze(
Object.values(ORDER_STATUS).filter(
(item) => item.type == OrderStatusTypes.MY_ORDER
)
),
},
/**
* 组件生命周期
*/
lifetimes: {
attached() {
// 获取订单状态对应的图片
this.getOrderNumberList();
},
},
/**
......@@ -22,10 +35,25 @@ Component({
methods: {
goOrder(e) {
// 直接使用 ORDER_LIST 中的索引作为 tabIndex
const code = e.currentTarget.dataset.code;
const index = e.currentTarget.dataset.index;
wx.p.router.go("/packageMine/pages/order/index/index", {
code,
index,
});
},
getOrderNumberList() {
const loginStatus = !wx.p.isLogin;
if (loginStatus) return;
wx.p.api.mineApi.getOrderNumberList().then((res) => {
this.setData({
orderNumberList: [
res.unPayCount,
res.unShippedCount,
res.unReceivedCount,
res.unServiceCount,
],
});
});
},
},
});
\ No newline at end of file
});
......@@ -11,11 +11,11 @@
</view>
<view class="btnBox">
<view class="independentBox" wx:for="{{orderList}}" wx:key="index">
<view bindtap="goOrder" data-code="{{item.code}}">
<view bindtap="goOrder" data-index="{{item.index}}">
<view class="order-img">
<glsx-image webp src="/mine/{{item.image}}.png"></glsx-image>
</view>
<text class="order-content">{{item.text}}</text>
<text class="order-content">{{item.my_order_text||item.text}}</text>
<text class="order-number" wx:if="{{orderNumberList[index] != 0 && orderNumberList}}">{{orderNumberList[index]}}</text>
</view>
</view>
......
......@@ -162,7 +162,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.getOrderNumberList();
this.toCheckMember();
// this.getOrderNumberList();
// this.toCheckMember();
},
});
\ No newline at end of file
......@@ -106,7 +106,6 @@ page {
.user-info {
display: flex;
align-items: center;
position: relative;
overflow: hidden;
}
......@@ -186,6 +185,12 @@ page {
padding: 0 24rpx;
display: flex;
align-items: center;
.name {
max-width: 280rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.change_icon {
width: 32rpx;
height: 32rpx;
......
......@@ -27,7 +27,7 @@
</view>
<view class="phone">{{username}}{{userInfo.phone}}</view>
<view class="merchant_box" bindtap="changeMerchant">
{{userInfo.merchantName}}
<view class="name">{{userInfo.merchantName}}</view>
<view class="change_icon">
<glsx-image src="/mine/change.png"></glsx-image>
</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!