Commit 5e6cdfae by zhangxw

首页联调

1 parent fd4f8178
...@@ -13,5 +13,19 @@ module.exports = { ...@@ -13,5 +13,19 @@ module.exports = {
method: 'scrm.api.shopmall.app.stockroom.goods.detail', method: 'scrm.api.shopmall.app.stockroom.goods.detail',
...data ...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 \ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<view class="text">请确认信息无误</view> <view class="text">请确认信息无误</view>
<view class="input-box"> <view class="input-box">
<view class="input-label">姓名</view> <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>
<view class="input-box"> <view class="input-box">
<view class="input-label">手机号</view> <view class="input-label">手机号</view>
......
...@@ -44,4 +44,3 @@ ...@@ -44,4 +44,3 @@
</view> </view>
</template> </template>
</view> </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 \ No newline at end of file
...@@ -6,31 +6,7 @@ Page({ ...@@ -6,31 +6,7 @@ Page({
*/ */
data: { data: {
pageParams: {}, pageParams: {},
goodsList: [{ 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'
}]
}, },
/** /**
......
...@@ -38,16 +38,16 @@ ...@@ -38,16 +38,16 @@
<view class="text"> <view class="text">
<view class="name"> <view class="name">
<view class="text-hide"> <view class="text-hide">
{{item.goodsName}} {{item.goodsSkuName}}
</view> </view>
<view class="text-hide description">{{item.specificationData || ''}}</view> <view class="text-hide description">{{item.specificationData || ''}}</view>
</view> </view>
<view class="price-box"> <view class="price-box">
<view class="price"> <view class="price">
{{item.retailPrice}} {{item.redeemPoints}}
<text>积分</text> <text>积分</text>
</view> </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> </view>
</view> </view>
......
...@@ -212,4 +212,6 @@ ...@@ -212,4 +212,6 @@
} }
.btn_primary { .btn_primary {
color: #FC5B32; color: #FC5B32;
font-size: 34rpx;
font-weight: 700;
} }
\ No newline at end of file \ No newline at end of file
...@@ -14,24 +14,18 @@ Page({ ...@@ -14,24 +14,18 @@ Page({
*/ */
onLoad(options) { onLoad(options) {
wx.p.router.getRouterParams(options).then(params => { wx.p.router.getRouterParams(options).then(params => {
params = { this.countdown()
orderCode: '22232'
}
this.countdown(params.orderCode)
this.setData({
paramsData: params
})
}).catch(err => { }).catch(err => {
console.error('参数获取失败:', err) console.error('参数获取失败:', err)
}) })
}, },
countdown(orderCode) { countdown() {
this.timer = setInterval(() => { this.timer = setInterval(() => {
let { count } = this.data let { count } = this.data
if (count == 0) { if (count == 0) {
clearInterval(this.timer) clearInterval(this.timer)
// wx.p.router.reLaunch('/packageMine/pages/order/detail/detail', {orderCode}) wx.p.router.reLaunch('/packageMine/pages/order/index/index')
return return
} }
this.setData({ this.setData({
...@@ -41,8 +35,8 @@ Page({ ...@@ -41,8 +35,8 @@ Page({
}, },
viewOrderDetail() { viewOrderDetail() {
let { paramsData } = this.data clearInterval(this.timer)
wx.p.router.reLaunch('/packageMine/pages/order/detail/detail', {orderCode: paramsData.orderCode}) wx.p.router.reLaunch('/packageMine/pages/order/index/index')
}, },
/** /**
......
import NP from "number-precision";
import cartApi from '~/api/module/cart.js'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -6,18 +8,29 @@ Component({ ...@@ -6,18 +8,29 @@ Component({
show: Boolean, show: Boolean,
address: Array, address: Array,
type: String, 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, defaultAddress: Object,
defaultAds: String, defaultAds: String,
staffShop:Boolean,
canPay:Boolean, canPay:Boolean,
clickType: String clickType: String
}, },
data: { data: {
currentIndex: 0, currentIndex: 0,
goodsNumber: 1, goodsNumber: 1,
showJfModal:false, showJfModal: false,
jfCount:0 jfCount: 0,
detailInfo: {}
}, },
/** /**
...@@ -25,9 +38,8 @@ Component({ ...@@ -25,9 +38,8 @@ Component({
*/ */
methods: { methods: {
computeJf(num) { computeJf(num) {
let {goods,jfCount,staffShop} = this.data let {detailInfo, jfCount} = this.data
if(!staffShop)return jfCount = NP.times(detailInfo.redeemPoints || 0, num)
jfCount = NP.times(goods.redeemPoints,num)
this.setData({ this.setData({
jfCount jfCount
}) })
...@@ -38,6 +50,24 @@ Component({ ...@@ -38,6 +50,24 @@ Component({
}) })
this.triggerEvent('cancelSku') 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) { changeCount(e) {
this.triggerEvent('getCount', e.detail) this.triggerEvent('getCount', e.detail)
this.computeJf(e.detail) this.computeJf(e.detail)
...@@ -51,45 +81,47 @@ Component({ ...@@ -51,45 +81,47 @@ Component({
showAddress: true showAddress: true
}) })
}, },
getAddress(e) {
this.setData({
defaultAds: e.detail.contactAddress,
defaultAddress: e.detail.defaultAddress
})
this.triggerEvent('sameAddress', e.detail)
},
intRemain(e) { intRemain(e) {
this.setData({ this.setData({
remain: e.detail.value remain: e.detail.value
}) })
}, },
toCreatedOrder() { toCreatedOrder() {
let { clickType } = this.data let { clickType, remain, detailInfo, defaultAddress, goodsNumber } = this.data
if (clickType != 'pay') { const userInfo = wx.p.storage.get('userInfo')
if (!['pay', 'join'].includes(clickType)) {
return this.cancel() 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){ if(!defaultAddress.receiveName){
return wx.p.wxApi.showToast('请选择收货地址') return wx.p.wxApi.showToast('请选择收货地址')
} }
// 跳转到确认订单 // 跳转到确认订单
let query = { let query = {
receiveName: defaultAddress.receiveName, defaultAddress,
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,
buyerMsg: remain, buyerMsg: remain,
orderGoodsList: [{ goodsList: [{...detailInfo}],
goodsSkuCode: goods.goodsSkuCode,
goodsSkuName: goods.goodsSkuName,
sellQty: goodsNumber,
}],
} }
wx.p.router.go('/packageIndex/pages/confirmOrder/index', query) wx.p.router.go('/packageIndex/pages/confirmOrder/index', query)
} }
......
...@@ -84,21 +84,24 @@ ...@@ -84,21 +84,24 @@
flex-wrap: wrap; flex-wrap: wrap;
.sku { .sku {
padding: 6rpx 20rpx; padding: 6rpx 20rpx;
background: #F7F8FA; background: #F7F8FA;
border-radius: 4rpx; font-weight: 400;
margin-right: 16rpx; font-size: 24rpx;
margin-bottom: 20rpx; border-radius: 12rpx;
margin-right: 16rpx;
margin-bottom: 20rpx;
} }
.sku_active { .sku_active {
background: #fc5b320f; background: #fc5b320f;
border: 2rpx solid #FC5B32; border: 2rpx solid #FC5B32;
border-radius: 4rpx;
font-weight: 400;
font-size: 24rpx;
color: #FC5B32; color: #FC5B32;
} }
.disabled{
background-color: #B1B1B3 !important;
color: #000000!important;
}
} }
} }
......
...@@ -4,34 +4,39 @@ ...@@ -4,34 +4,39 @@
<view class="container"> <view class="container">
<view class="goods-box flex_sc"> <view class="goods-box flex_sc">
<view class="cover"> <view class="cover">
<glsx-image class="cover" src="{{goods.imageResponses[0].imgUrl}}" /> <glsx-image class="cover" src="{{detailInfo.imageResponses[0].imgUrl}}" />
</view> </view>
<view class="right-box"> <view class="right-box">
<view class="price-box"> <view class="price-box">
<text class="price">{{goods.sellPrice}}</text><text>积分</text> <text class="price">{{detailInfo.redeemPoints}}</text><text>积分</text>
</view> </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> <view wx:else class="stock">暂无存货</view>
<block> <block>
<view wx:if="{{goods.goodsSource == '2'}}" class="selct-box">已选:{{goods.specificationData}}</view> <view wx:if="{{detailInfo.goodsSource == 1}}" class="selct-box">已选:{{goodsNumber}}{{detailInfo.goodsUnit}}</view>
<view wx:else class="selct-box">已选:{{goodsNumber}}{{goods.goodsUnit}}</view> <view wx:else class="selct-box">已选:{{detailInfo.specificationData}}</view>
</block> </block>
</view> </view>
</view> </view>
<view class="sku-box"> <view class="sku-box">
<view class="title">规格</view> <view class="title">规格</view>
<view class="sku-list"> <view class="sku-list" wx:if="{{detailInfo.goodsSource == 1}}">
<block wx:for="{{goods.specificationResponses}}" wx:key="index"> <block wx:for="{{detailInfo.specificationResponses}}" wx:key="index">
<view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view> <view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view>
</block> </block>
</view> </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>
<view class="count-box flex_scb"> <view class="count-box flex_scb">
<view class="title">数量</view> <view class="title">数量</view>
<view class="right flex_sc"> <view class="right flex_sc">
<!-- <view class="tip">至少购买{{goods.startQty}}{{goods.goodsUnit}}</view> --> <!-- <view class="tip">至少购买{{goods.startQty}}{{goods.goodsUnit}}</view> -->
<view class="stepper"> <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> </view>
</view> </view>
......
...@@ -2,10 +2,7 @@ const navStyle = 'background-color: transparent;' ...@@ -2,10 +2,7 @@ const navStyle = 'background-color: transparent;'
let navBarHeight = 38 let navBarHeight = 38
import homeApi from '~/api/module/home.js' import homeApi from '~/api/module/home.js'
import cartApi from '~/api/module/cart.js' import cartApi from '~/api/module/cart.js'
// import { mineApi, shopmallApi } from '~/api/api' import mineApi from '~/api/module/mine.js'
// import MineApi from '~/api/mineApi/index'
// import NP from 'number-precision'
// import USERAPI from '~/api/usersApi/index'
Page({ Page({
data: { data: {
navStyle, navStyle,
...@@ -23,70 +20,23 @@ Page({ ...@@ -23,70 +20,23 @@ Page({
payWayActions: [{ name: '金额支付', type: 1, disabled: false }, { name: '积分兑换', type: 2, disabled: false }], payWayActions: [{ name: '金额支付', type: 1, disabled: false }, { name: '积分兑换', type: 2, disabled: false }],
detailInfo: {}, detailInfo: {},
addressList: [{ addressList: [{
id: 1, "userId" : 91713345,
receiveName: '何瑶1', "cityId" : null,
receiveMobile: '15044526870', "areaId" : 440305,
provinceName: '广东省', "createTime" : 1755922362000,
cityName: '深圳市', "provinceId" : null,
countyName: '南山区', "cityName" : "深圳市",
address: '南山智园崇文园区1号楼14层', "countyName" : "南山区",
isDefault: 1 "postCode" : "518000",
}, { "receiveName" : "qw",
id: 2, "provinceName" : "广东省",
receiveName: '何瑶2', "address" : "广东省深圳市南山区南山街道学府路30号",
receiveMobile: '15044526870', "updateTime" : null,
provinceName: '广东省', "isDefault" : 1,
cityName: '深圳市', "phoneNumber" : "18555558878",
countyName: '南山区', "id" : 58
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
}], }],
defaultAddress: {id: 3} defaultAddress: {}
}, },
appHide() { appHide() {
wx.offAppHide() wx.offAppHide()
...@@ -126,7 +76,8 @@ Page({ ...@@ -126,7 +76,8 @@ Page({
}) })
}, },
goodsActionClick(e) { 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) this.showSkuModal(e.detail)
}, },
onLoad(options) { onLoad(options) {
...@@ -135,7 +86,7 @@ Page({ ...@@ -135,7 +86,7 @@ Page({
}).catch(err => { }).catch(err => {
console.error('参数获取失败:', err) console.error('参数获取失败:', err)
}) })
// this.getPlatFormAddress() this.getPlatFormAddress()
}, },
showSkuModal(type) { showSkuModal(type) {
this.setData({ this.setData({
...@@ -149,57 +100,54 @@ Page({ ...@@ -149,57 +100,54 @@ Page({
}) })
}, },
// 获取默认的地址 // 获取默认的地址
getPlatFormAddress(satff) { getPlatFormAddress() {
// wx.showLoading() let res = this.data.addressList
let para = {} let _isSetDefault = false, contactAddress = '', defaultAddress = {}
// if (staff) { if (res && res.length) {
// para.businessType = 1 res.forEach(el => {
// }else{ if (el.isDefault == 1) {
// const SID = wx.p.util.getSessionId() contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
// 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,
defaultAddress = el 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({ this.setData({
addressList: res || [],
contactAddress, contactAddress,
defaultAddress defaultAddress
}) })
// shopmallApi.platformAddressList(para).then(data => { return
// wx.hideLoading() wx.p.wxApi.showLoading()
// let contactAddress = '', defaultAddress = {} mineApi.platformAddressList({}).then(res => {
// let _isSetDefault = false wx.hideLoading()
// if (data && data.length) { let _isSetDefault = false, contactAddress = '', defaultAddress = {}
// data.forEach(el => { if (res && res.length) {
// if (el.isDefault == 1) { res.forEach(el => {
// contactAddress = el.provinceName + el.cityName + el.countyName + el.address, if (el.isDefault == 1) {
// defaultAddress = el contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
// _isSetDefault = true defaultAddress = el
// } _isSetDefault = true
// }) }
// if (!_isSetDefault) { })
// let _first = data[0] if (!_isSetDefault) {
// contactAddress = _first.provinceName + _first.cityName + _first.countyName + _first.address, let _first = res[0] || {}
// defaultAddress = _first contactAddress = _first.provinceName + _first.cityName + _first.countyName + _first.address,
// } defaultAddress = _first
// } }
// this.setData({ }
// addressList: data, this.setData({
// contactAddress, addressList: res || [],
// defaultAddress contactAddress,
// }) defaultAddress
// }) })
console.log(defaultAddress, '222')
})
}, },
// 显示地址选择弹窗 // 显示地址选择弹窗
toShowAddressModal() { toShowAddressModal() {
...@@ -232,13 +180,18 @@ Page({ ...@@ -232,13 +180,18 @@ Page({
}, },
// 获取详情 // 获取详情
getDetail(options) { 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) { if (res && res.specificationResponses?.length) {
this.toGetSpecString(res, res.startQty) this.toGetSpecString(res, res.startQty)
} }
if (res && res.platformGlGoodsSpecifications?.length) { if (res && res.platformGlGoodsSpecifications?.length) {
let item = res.platformGlGoodsSpecifications[0] || {}
res.redeemPoints = item.retailPrice
res.goodsStock = item.stock
res.specificationData = item.specificationData
this.setData({ this.setData({
activeSku: res.platformGlGoodsSpecifications[0].specificationData activeSku: item.specificationData
}) })
} }
this.setData({ this.setData({
...@@ -257,7 +210,8 @@ Page({ ...@@ -257,7 +210,8 @@ Page({
}) })
}, },
getCount(e) { 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 this.count = e.detail
}, },
// 添加购物车 // 添加购物车
...@@ -267,12 +221,13 @@ Page({ ...@@ -267,12 +221,13 @@ Page({
const PARAMS = { const PARAMS = {
goodsId: detailInfo.id, goodsId: detailInfo.id,
sellQty: this.count || detailInfo.startQty, sellQty: this.count || detailInfo.startQty,
goodsSkuCode: detailInfo.goodsSkuCode, goodsSource: detailInfo.goodsSource || 1,
goodsSource: detailInfo.goodsSource, scoreSource: userInfo?.channelSource,
scoreSource: userInfo?.channelSource specificationData: detailInfo?.specificationData,
merchantId: userInfo?.merchantId
} }
cartApi.addToCart(PARAMS).then(res => { cartApi.addToCart(PARAMS).then(res => {
wx.$api.showToast('加入购物车成功') wx.p.wxApi.showToast('加入购物车成功')
}) })
}, },
// 同步选择的地址 // 同步选择的地址
...@@ -331,6 +286,5 @@ Page({ ...@@ -331,6 +286,5 @@ Page({
title, title,
path path
} }
}, }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<text>剩余 {{detailInfo.remaining}}</text> | <text>销售 {{detailInfo.saleNum}}</text> <text>剩余 {{detailInfo.remaining}}</text> | <text>销售 {{detailInfo.saleNum}}</text>
</view> </view>
</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>
<view class="container-item select-params-box"> <view class="container-item select-params-box">
<view class="cell" bind:tap="showSkuModal" data-type="choose"> <view class="cell" bind:tap="showSkuModal" data-type="choose">
...@@ -79,9 +79,24 @@ ...@@ -79,9 +79,24 @@
</view> </view>
<view class="goods-detail-box"> <view class="goods-detail-box">
<view class="title">商品详情</view> <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> <mp-html content="{{detailInfo.goodsDescribe}}"></mp-html>
</view> </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> </view>
</view> </view>
...@@ -111,5 +126,5 @@ ...@@ -111,5 +126,5 @@
<block wx:if="{{navHeight}}"> <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> <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> </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> <address address="{{addressList}}" defaultAddress="{{defaultAddress}}" bind:getAddress="getAddress" show="{{showAddress}}"></address>
\ No newline at end of file \ No newline at end of file
// packageIndex/pages/selfGoodsDetail/index.js // packageIndex/pages/selfGoodsDetail/index.js
import homeApi from '~/api/module/home.js' import homeApi from '~/api/module/home.js'
import mineApi from '~/api/module/mine.js'
const navStyle = 'background-color: transparent;' const navStyle = 'background-color: transparent;'
let navBarHeight = 38 let navBarHeight = 38
Page({ Page({
...@@ -12,70 +13,23 @@ Page({ ...@@ -12,70 +13,23 @@ Page({
goodsFlag: true, goodsFlag: true,
goodsInfo: {}, goodsInfo: {},
addressList: [{ addressList: [{
id: 1, "userId" : 91713345,
receiveName: '何瑶1', "cityId" : null,
receiveMobile: '15044526870', "areaId" : 440305,
provinceName: '广东省', "createTime" : 1755922362000,
cityName: '深圳市', "provinceId" : null,
countyName: '南山区', "city" : "深圳市",
address: '南山智园崇文园区1号楼14层', "area" : "南山区",
isDefault: 1 "postCode" : "518000",
}, { "receiveName" : "qw",
id: 2, "province" : "广东省",
receiveName: '何瑶2', "address" : "广东省深圳市南山区南山街道学府路30号",
receiveMobile: '15044526870', "updateTime" : null,
provinceName: '广东省', "isDefault" : 1,
cityName: '深圳市', "phoneNumber" : "18555558878",
countyName: '南山区', "id" : 139
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
}], }],
defaultAddress: {id: 2} defaultAddress: {}
}, },
/** /**
...@@ -172,16 +126,42 @@ Page({ ...@@ -172,16 +126,42 @@ Page({
getDetail(options) { getDetail(options) {
homeApi.getGoodsDetailInfo({id: options.id}).then(res => { homeApi.getGoodsDetailInfo({id: options.id}).then(res => {
console.log(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 getPlatFormAddress(staff) {
goodsInfo.skuPrice = goodsInfo.specificationDetailList[0].retailPrice wx.p.wxApi.showLoading()
} mineApi.platformAddressList({}).then(data => {
this.setData({ console.log(data)
goodsInfo, wx.hideLoading()
activeSku 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({ ...@@ -139,6 +139,7 @@ Page({
delete obj.createTime; delete obj.createTime;
delete obj.updateTime; delete obj.updateTime;
} }
console.log(obj, '===')
wx.p.api.mineApi[target](obj).then(() => { wx.p.api.mineApi[target](obj).then(() => {
wx.p.wxApi.showToast("操作成功"); wx.p.wxApi.showToast("操作成功");
setTimeout(() => { setTimeout(() => {
......
...@@ -36,6 +36,7 @@ Page({ ...@@ -36,6 +36,7 @@ Page({
contactAddress, contactAddress,
contactName: item.receiveName, contactName: item.receiveName,
contactPhone: item.phoneNumber, contactPhone: item.phoneNumber,
id: item.id
}, },
isDefault: item.isDefault == 1, isDefault: item.isDefault == 1,
}); });
......
import cartApi from '~/api/module/cart.js' import cartApi from '~/api/module/cart.js'
import NP from "number-precision";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
count: 0, count: 0,
goodsList: [{ 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,
}],
shoppingcartFlag: true shoppingcartFlag: true
}, },
goodsActionReady(e) { goodsActionReady(e) {
...@@ -94,26 +16,36 @@ Page({ ...@@ -94,26 +16,36 @@ Page({
}, },
changeCount(e) { changeCount(e) {
let count = e.detail let count = e.detail
let { userInfo } = this.data
let { let {
index, index,
item item
} = e.currentTarget.dataset } = e.currentTarget.dataset
if (item.goodsNumber == count) return if (item.sellQty == count) return
let { userInfo } = this.data
this.setData({
[`goodsList[${index}].goodsNumber`]: count
})
this.cheackAll()
wx.p.wxApi.showLoading('正在加载...')
let para = { let para = {
goodsId: 1, goodsId: item.goodsId,
sellQty: count,
goodsSource: item?.goodsSource, goodsSource: item?.goodsSource,
scoreSource: userInfo?.channelSource, scoreSource: userInfo?.channelSource,
merchantId: userInfo?.merchantId,
specificationData: item?.specificationData specificationData: item?.specificationData
} }
cartApi.updateGoodsFormCart(para).then(res => { this.setData({
wx.hideLoading() [`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) { choose(e) {
...@@ -146,8 +78,8 @@ Page({ ...@@ -146,8 +78,8 @@ Page({
} }
goodsList?.map(e => { goodsList?.map(e => {
if (e.active) { if (e.active) {
count += e.goodsNumber count += e.sellQty
sum += e.retailPrice * e.goodsNumber sum += e.redeemPoints * e.sellQty
} }
}) })
this.setData({ this.setData({
...@@ -190,31 +122,31 @@ Page({ ...@@ -190,31 +122,31 @@ Page({
let params = { let params = {
goodsList: data goodsList: data
} }
wx.p.router.go('/packageIndex/pages/confirmOrder/index', {...params}) wx.p.router.go('/packageIndex/pages/confirmOrder/index', params)
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let userInfo = wx.p.storage.get(userInfo) let userInfo = wx.p.storage.get('userInfo')
this.setData({userInfo}) this.setData({userInfo})
// this.getShoppingcartList() this.getShoppingcartList()
}, },
getShoppingcartList() { getShoppingcartList() {
wx.p.wxApi.showLoading('加载中...') wx.p.wxApi.showLoading()
let userInfo = wx.p.storage.get('userInfo')
let para = { let para = {
cartType: 1 scoreSource: userInfo?.channelSource,
merchantId: userInfo?.merchantId
} }
cartApi.getCartList(para) cartApi.getCartList(para)
.then(data => { .then(data => {
data.map(e => {
e.list.map(i => (i.retailPrice = Number(i.retailPrice).toFixed(2)))
})
this.setData({ this.setData({
goodsList: data, goodsList: data?.goodsList || [],
shoppingcartFlag: true, shoppingcartFlag: true,
count: 0, count: 0,
sum: 0 sum: 0,
allActive: false
}) })
wx.hideLoading() wx.hideLoading()
}) })
...@@ -225,23 +157,27 @@ Page({ ...@@ -225,23 +157,27 @@ Page({
}) })
}, },
del(e) { del(e) {
wx.p.wxApi.showLoading('请稍后...') wx.p.wxApi.showLoading()
let { let {
target target
} = e.target.dataset } = e.target.dataset
let { userInfo } = this.data let { userInfo } = this.data
// 删除调用减少商品数量接口
let para = { let para = {
goodsId: 1, goodsId: target.goodsId,
sellQty: 0, sellQty: target.sellQty,
goodsSource: target?.goodsSource, goodsSource: target?.goodsSource,
scoreSource: userInfo?.channelSource, scoreSource: userInfo?.channelSource,
merchantId: userInfo?.merchantId,
specificationData: target.specificationData specificationData: target.specificationData
} }
wx.p.wxApi.showLoading()
cartApi.updateGoodsFormCart(para).then(res => { cartApi.updateGoodsFormCart(para).then(res => {
wx.hideLoading()
wx.p.wxApi.showToast('删除成功') wx.p.wxApi.showToast('删除成功')
setTimeout(() => { setTimeout(() => {
this.getShoppingcartList() this.getShoppingcartList()
}, 1.5 * 1000) }, 0.5 * 1000)
}) })
}, },
/** /**
...@@ -251,7 +187,9 @@ Page({ ...@@ -251,7 +187,9 @@ Page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () {}, onShow: function () {
this.getShoppingcartList()
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
......
...@@ -25,17 +25,17 @@ ...@@ -25,17 +25,17 @@
<view wx:else class="invalid-icon">失效</view> <view wx:else class="invalid-icon">失效</view>
<view class="goods-info"> <view class="goods-info">
<view class="preview"> <view class="preview">
<image webp src="{{item.goodsImage}}"></image> <image webp src="{{item.goodsImageUrl}}"></image>
</view> </view>
<view class="text"> <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="specification" wx:if="{{item.specificationData}}">{{item.specificationData}}</view>
<view class="price-box" wx:if="{{!item.flag}}"> <view class="price-box" wx:if="{{!item.flag}}">
<view class="price"> <view class="price">
{{item.retailPrice || 0}} {{item.redeemPoints || 0}}
<text>积分</text> <text>积分</text>
</view> </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> data-index="{{index}}" data-item="{{item}}"></stepper>
</view> </view>
<view wx:else class="invalid">该商品已下架/库存不足</view> <view wx:else class="invalid">该商品已下架/库存不足</view>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<scroll-view scroll-x class="fixed-tabs" scroll-into-view="{{to}}"> <scroll-view scroll-x class="fixed-tabs" scroll-into-view="{{to}}">
<block wx:for="{{tab}}" wx:key="index"> <block wx:for="{{tab}}" wx:key="index">
<view <view
class="tab-item {{activeTab === item.id ? 'active' : ''}}" class="tab-item {{activeTab == item.id ? 'active' : ''}}"
bindtap="handleFixedTabChange" bindtap="handleFixedTabChange"
data-value="{{item.id}}" data-value="{{item.id}}"
id="to-{{item.id}}" id="to-{{item.id}}"
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<scroll-view scroll-x class="dynamic-tabs" scroll-into-view="{{subTo}}"> <scroll-view scroll-x class="dynamic-tabs" scroll-into-view="{{subTo}}">
<block wx:for="{{subTab}}" wx:key="index"> <block wx:for="{{subTab}}" wx:key="index">
<view <view
class="tab-item {{activeSubTab === item.id ? 'active' : ''}}" class="tab-item {{activeSubTab == item.id ? 'active' : ''}}"
bindtap="handleDynamicTabChange" bindtap="handleDynamicTabChange"
data-value="{{item.id}}" data-value="{{item.id}}"
id="to-{{item.id}}" id="to-{{item.id}}"
......
...@@ -35,22 +35,7 @@ Page({ ...@@ -35,22 +35,7 @@ Page({
id: '4', id: '4',
label: '200-300积分' label: '200-300积分'
}], }],
subTab: [{ subTab: [],
id: '',
label: '全部品类'
}, {
id: '1',
label: '汽车保养'
}, {
id: '2',
label: '车载设备'
}, {
id: '3',
label: '个护清洁'
}, {
id: '4',
label: '休闲零食'
}],
activeTab: '', activeTab: '',
frontendCategoryId: '', frontendCategoryId: '',
goodsList: [] goodsList: []
...@@ -111,6 +96,7 @@ Page({ ...@@ -111,6 +96,7 @@ Page({
this.setData({loginPageFlag: params?.loginPageFlag}, () => { this.setData({loginPageFlag: params?.loginPageFlag}, () => {
this.getPointsWallet() this.getPointsWallet()
this.getGoodsList() this.getGoodsList()
this.getCategory()
}) })
}).catch(err => { }).catch(err => {
console.error('参数获取失败:', err) console.error('参数获取失败:', err)
...@@ -155,6 +141,22 @@ Page({ ...@@ -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() { getGoodsList() {
let { pageNum, goodsList, goodsSkuName, frontendCategoryId, activeTab } = this.data let { pageNum, goodsList, goodsSkuName, frontendCategoryId, activeTab } = this.data
...@@ -163,7 +165,8 @@ Page({ ...@@ -163,7 +165,8 @@ Page({
pageNum, pageNum,
pageSize: 4, pageSize: 4,
goodsSkuName, goodsSkuName,
frontendCategoryId frontendCategoryId,
businessType: 1
} }
if (activeTab == 1) { // 我能兑换 if (activeTab == 1) { // 我能兑换
params.canExchange = 1, params.canExchange = 1,
...@@ -175,10 +178,6 @@ Page({ ...@@ -175,10 +178,6 @@ Page({
params.storeEnd = activeTab == 2 ? 100 : activeTab == 3 ? 200 : activeTab == 4 ? 300 : '' params.storeEnd = activeTab == 2 ? 100 : activeTab == 3 ? 200 : activeTab == 4 ? 300 : ''
} }
homeApi.getGoodsStockroomList(params).then(res => { homeApi.getGoodsStockroomList(params).then(res => {
res?.list?.forEach((val, index) => {
if (index == 0 ) val.goodsSource = 2
else val.goodsSource = 1
})
this.setData({ this.setData({
goodsList: pageNum == 1 ? res?.list || [] : [...goodsList, ...res?.list], goodsList: pageNum == 1 ? res?.list || [] : [...goodsList, ...res?.list],
pages: res.pages, pages: res.pages,
......
...@@ -106,7 +106,6 @@ page { ...@@ -106,7 +106,6 @@ page {
.user-info { .user-info {
display: flex; display: flex;
align-items: center;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
...@@ -186,6 +185,12 @@ page { ...@@ -186,6 +185,12 @@ page {
padding: 0 24rpx; padding: 0 24rpx;
display: flex; display: flex;
align-items: center; align-items: center;
.name {
max-width: 280rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.change_icon { .change_icon {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</view> </view>
<view class="phone">{{username}}{{userInfo.phone}}</view> <view class="phone">{{username}}{{userInfo.phone}}</view>
<view class="merchant_box" bindtap="changeMerchant"> <view class="merchant_box" bindtap="changeMerchant">
{{userInfo.merchantName}} <view class="name">{{userInfo.merchantName}}</view>
<view class="change_icon"> <view class="change_icon">
<glsx-image src="/mine/change.png"></glsx-image> <glsx-image src="/mine/change.png"></glsx-image>
</view> </view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!