增加商品分类选择

This commit is contained in:
Austin 2026-01-26 22:11:13 +08:00
parent 9e86d9a645
commit c01ddd45ad
8 changed files with 719 additions and 24 deletions

View File

@ -11,7 +11,6 @@
}, },
onLaunch() { onLaunch() {
// //
//
uni.setStorageSync('isAuth',true) uni.setStorageSync('isAuth',true)
const updateManager = uni.getUpdateManager(); const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function (res) { updateManager.onCheckForUpdate(function (res) {

View File

@ -29,10 +29,18 @@
BASE_IMG_URL:BASE_IMG_URL, BASE_IMG_URL:BASE_IMG_URL,
tablist:[ tablist:[
{ {
pagePath: "/pages/index/contract/contract", pagePath: "/pages/index/productSelect/productSelect",
iconPath: "https://hls.huhakeji.top/uploads/20260108/46d0feeaa65e6c2dbd47054fc333c467.png", iconPath: "https://hls.huhakeji.top/uploads/20260108/46d0feeaa65e6c2dbd47054fc333c467.png",
selectedIconPath: "https://hls.huhakeji.top/uploads/20260108/8cab46fc021348dc5cd7b2177206cb8a.png", selectedIconPath: "https://hls.huhakeji.top/uploads/20260108/8cab46fc021348dc5cd7b2177206cb8a.png",
text: "采购", text: "首页",
isTip:true,
num:0
},
{
pagePath: "/pages/index/contract/contract",
iconPath: BASE_IMG_URL+"tab1.png",
selectedIconPath: BASE_IMG_URL+"tab1_a.png",
text: "订单",
isTip:true, isTip:true,
num:0 num:0
}, },
@ -44,14 +52,14 @@
// isTip:true, // isTip:true,
// num:0 // num:0
// }, // },
{ // {
pagePath: "/pagesA/crm/customerManagement/customerManagement", // pagePath: "/pagesA/crm/customerManagement/customerManagement",
iconPath: BASE_IMG_URL+"tab2.png", // iconPath: BASE_IMG_URL+"tab2.png",
selectedIconPath: BASE_IMG_URL+"tab2_a.png", // selectedIconPath: BASE_IMG_URL+"tab2_a.png",
text: "门店", // text: "",
isTip:true, // isTip:true,
num:0 // num:0
}, // },
{ {
pagePath: "/pages/news/news", pagePath: "/pages/news/news",
iconPath: BASE_IMG_URL+"tab3.png", iconPath: BASE_IMG_URL+"tab3.png",

View File

@ -82,7 +82,7 @@
"quickapp" : {}, "quickapp" : {},
/* */ /* */
"mp-weixin" : { "mp-weixin" : {
"appid" : "wxf2b7106cda55602b", "appid" : "wxc4898617fbf7ab19",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"es6" : true, "es6" : true,

175
package-lock.json generated
View File

@ -14,6 +14,70 @@
"vue-jsonp": "^2.0.0" "vue-jsonp": "^2.0.0"
} }
}, },
"node_modules/@babel/helper-string-parser": {
"version": "7.27.1",
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
"integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-validator-identifier": {
"version": "7.28.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz",
"integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/parser": {
"version": "7.28.6",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.6.tgz",
"integrity": "sha512-TeR9zWR18BvbfPmGbLampPMW+uW1NZnJlRuuHso8i87QZNq2JRF9i6RgxRqtEq+wQGsS19NNTWr2duhnE49mfQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/types": "^7.28.6"
},
"bin": {
"parser": "bin/babel-parser.js"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@babel/types": {
"version": "7.28.6",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.6.tgz",
"integrity": "sha512-0ZrskXVEHSWIqZM/sQZ4EV3jZJXRkio/WCxaqKZP1g//CEWEPSfeZFcms4XeKBCHU0ZKnIkdJeU/kF+eRp5lBg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/helper-string-parser": "^7.27.1",
"@babel/helper-validator-identifier": "^7.28.5"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@vue/compiler-sfc": {
"version": "2.7.16",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz",
"integrity": "sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==",
"peer": true,
"dependencies": {
"@babel/parser": "^7.23.5",
"postcss": "^8.4.14",
"source-map": "^0.6.1"
},
"optionalDependencies": {
"prettier": "^1.18.2 || ^2.0.0"
}
},
"node_modules/argparse": { "node_modules/argparse": {
"version": "1.0.10", "version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@ -50,6 +114,13 @@
"resolved": "https://registry.npmjs.org/bmaplib.texticonoverlay/-/bmaplib.texticonoverlay-1.0.2.tgz", "resolved": "https://registry.npmjs.org/bmaplib.texticonoverlay/-/bmaplib.texticonoverlay-1.0.2.tgz",
"integrity": "sha512-4ZTWr4ZP3B6qEWput5Tut16CfZgII38YwM3bpyb4gFTQyORlKYryFp9WHWrwZZaHlOyYDAXG9SX0hka43jTADg==" "integrity": "sha512-4ZTWr4ZP3B6qEWput5Tut16CfZgII38YwM3bpyb4gFTQyORlKYryFp9WHWrwZZaHlOyYDAXG9SX0hka43jTADg=="
}, },
"node_modules/csstype": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
"license": "MIT",
"peer": true
},
"node_modules/dingtalk-jsapi": { "node_modules/dingtalk-jsapi": {
"version": "2.15.6", "version": "2.15.6",
"resolved": "https://registry.npmjs.org/dingtalk-jsapi/-/dingtalk-jsapi-2.15.6.tgz", "resolved": "https://registry.npmjs.org/dingtalk-jsapi/-/dingtalk-jsapi-2.15.6.tgz",
@ -91,11 +162,103 @@
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==" "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
}, },
"node_modules/nanoid": {
"version": "3.3.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"peer": true,
"bin": {
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC",
"peer": true
},
"node_modules/postcss": {
"version": "8.5.6",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
"integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/postcss"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
"source-map-js": "^1.2.1"
},
"engines": {
"node": "^10 || ^12 || >=14"
}
},
"node_modules/prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"license": "MIT",
"optional": true,
"peer": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/promise-polyfill": { "node_modules/promise-polyfill": {
"version": "7.1.2", "version": "7.1.2",
"resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-7.1.2.tgz", "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-7.1.2.tgz",
"integrity": "sha512-FuEc12/eKqqoRYIGBrUptCBRhobL19PS2U31vMNTfyck1FxPyMfgsXyW4Mav85y/ZN1hop3hOwRlUDok23oYfQ==" "integrity": "sha512-FuEc12/eKqqoRYIGBrUptCBRhobL19PS2U31vMNTfyck1FxPyMfgsXyW4Mav85y/ZN1hop3hOwRlUDok23oYfQ=="
}, },
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"license": "BSD-3-Clause",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/source-map-js": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"license": "BSD-3-Clause",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/sprintf-js": { "node_modules/sprintf-js": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
@ -106,6 +269,18 @@
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
}, },
"node_modules/vue": {
"version": "2.7.16",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.7.16.tgz",
"integrity": "sha512-4gCtFXaAA3zYZdTp5s4Hl2sozuySsgz4jy1EnpBHNfpMa9dK1ZCG7viqBPCwXtmgc8nHqUsAu3G4gtmXkkY3Sw==",
"deprecated": "Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details.",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/compiler-sfc": "2.7.16",
"csstype": "^3.1.0"
}
},
"node_modules/vue-baidu-map": { "node_modules/vue-baidu-map": {
"version": "0.21.22", "version": "0.21.22",
"resolved": "https://registry.npmjs.org/vue-baidu-map/-/vue-baidu-map-0.21.22.tgz", "resolved": "https://registry.npmjs.org/vue-baidu-map/-/vue-baidu-map-0.21.22.tgz",

View File

@ -3,6 +3,14 @@
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
}, },
"pages": [ "pages": [
{
"path": "pages/index/productSelect/productSelect",
"style": {
"navigationBarTitleText": "选择商品",
"navigationBarBackgroundColor": "#008EFF",
"navigationStyle": "custom"
}
},
{ {
"path": "pages/index/contract/contract", "path": "pages/index/contract/contract",
"style": { "style": {
@ -141,13 +149,13 @@
"navigationBarTitleText": "编辑费用" "navigationBarTitleText": "编辑费用"
} }
}, },
{ // {
"path": "pages/index/contract/contract", // "path": "pages/index/contract/contract",
"style": { // "style": {
"navigationBarTitleText": "采购列表", // "navigationBarTitleText": "采购列表",
"navigationBarBackgroundColor": "#008EFF" // "navigationBarBackgroundColor": "#008EFF"
} // }
}, // },
{ {
"path": "pages/examine/examine", "path": "pages/examine/examine",
"style": { "style": {

View File

@ -0,0 +1,478 @@
<template>
<view class="product-select-page">
<!-- 固定顶部区域 -->
<view class="fixed-top" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="page-header" :style="{ height: navBarHeight + 'px' }">
<view class="header-title">选择商品</view>
</view>
<view class="search-row">
<view class="search-box">
<image :src="BASE_IMG_URL + 'search.png'" class="search-icon" mode=""></image>
<input type="text" placeholder="输入产品编号/名称搜索" @input="queryList" class="search-input" placeholder-style="color:#999;">
</view>
</view>
</view>
<view class="main-content" :style="{ marginTop: fixedTopHeight + 'px' }">
<!-- 左侧分类 -->
<scroll-view scroll-y class="category-list">
<view
class="category-item"
:class="{ active: typeCurrent === index }"
v-for="(item, index) in typeList"
:key="index"
@click="changeType(index)"
>
{{ item.name }}
</view>
</scroll-view>
<!-- 右侧商品列表 -->
<scroll-view scroll-y class="product-list">
<view class="product-items">
<view class="product-item" v-for="(item, index) in list" :key="index" @tap.stop="changeSelect(index)">
<view class="product-top">
<view class="product-name">{{ item.name }}</view>
<view class="product-num">{{ item.num }}</view>
</view>
<view class="product-info">
<view class="product-radio">
<radio color="#008EFF" :checked="item.select"></radio>
</view>
<image :src="item.img ? item.img : BASE_IMG_URL + 'img/index-4.png'" class="product-img" mode="aspectFill"></image>
<view class="product-detail">
<view class="detail-text">单位{{ item.unit }}</view>
<view class="detail-text">零售价{{ item.price }}</view>
<view class="detail-text">批发价{{ item.wholesale }}</view>
<view class="number-box" @tap.stop.prevent>
数量
<view class="number-input">
<uni-number-box :min="1" v-model="item.number" @change="(e) => { changeNumber(e, index) }"></uni-number-box>
</view>
</view>
</view>
</view>
</view>
<u-empty v-if="list.length === 0" text="暂无商品"></u-empty>
</view>
</scroll-view>
</view>
<!-- 底部操作栏 -->
<view class="bottom-bar">
<view class="left-box">
<view class="select-all" @click="selectAll">
<radio color="#008EFF" :checked="isAll"></radio>全选
</view>
<view class="select-count">已选{{ selectArr.length }}</view>
</view>
<view class="right-box">
<view class="btn-confirm" @click="confirmSelect">确认选择</view>
</view>
</view>
<!-- 底部导航 -->
<uniTabbar></uniTabbar>
</view>
</template>
<script>
import { netContractProduct, netProductTypeList } from '@/api/kehu.js'
import { BASE_IMG_URL } from '@/util/api.js'
import uniTabbar from '@/components/tabbar/tabbar.vue'
export default {
components: {
uniTabbar
},
data() {
return {
BASE_IMG_URL: BASE_IMG_URL,
name: '',
list: [],
isAll: false,
selectArr: [],
typeList: [],
typeCurrent: 0,
typeId: '',
selectedMap: {},
statusBarHeight: 0,
navBarHeight: 44,
fixedTopHeight: 0
}
},
onLoad() {
this.getSystemInfo()
this.init()
},
methods: {
getSystemInfo() {
const systemInfo = uni.getSystemInfoSync()
this.statusBarHeight = systemInfo.statusBarHeight || 0
// #ifdef MP-WEIXIN
const menuButton = uni.getMenuButtonBoundingClientRect()
this.navBarHeight = (menuButton.top - this.statusBarHeight) * 2 + menuButton.height
// #endif
// #ifndef MP-WEIXIN
this.navBarHeight = 44
// #endif
// + + (54px)
this.fixedTopHeight = this.statusBarHeight + this.navBarHeight + 54
},
async init() {
this.list = []
this.name = ''
this.isAll = false
this.selectArr = []
this.selectedMap = {}
this.typeId = ''
this.typeCurrent = 0
await this.getTypeList()
this.getProductList()
},
queryList(e) {
this.name = e.detail.value
this.getProductList()
},
getTypeList() {
return netProductTypeList().then(res => {
const data = res.data || []
const tabs = [{ id: '', name: '全部' }].concat(data.map(item => ({
...item,
name: item.name || item.title || item.cate_name || item.label || item.text
})))
this.typeList = tabs
})
},
getProductList() {
let params = {
name: this.name,
type_id: this.typeId
}
netContractProduct(params).then(res => {
let arr = res.data
arr.forEach(ele => {
const saved = this.selectedMap[ele.id]
if (saved) {
ele.select = true
ele.number = saved.number || 1
this.selectedMap[ele.id] = { ...ele }
} else {
ele.number = 1
ele.select = false
}
})
this.list = arr
this.refreshSelectedState()
})
},
changeType(index) {
this.typeCurrent = index
const current = this.typeList[index]
this.typeId = current && current.id ? current.id : ''
this.getProductList()
},
changeNumber(e, index) {
let obj = this.list[index]
if (e > 1) {
obj.select = true
}
obj.number = e
this.$set(this.list, index, obj)
this.handleSelect()
},
changeSelect(index) {
let obj = this.list[index]
obj.select = !obj.select
this.$set(this.list, index, obj)
this.handleSelect()
},
selectAll() {
this.isAll = !this.isAll
let arr = this.list
if (this.isAll) {
arr.forEach(ele => {
ele.select = true
this.selectedMap[ele.id] = { ...ele }
})
} else {
arr.forEach(ele => {
ele.select = false
delete this.selectedMap[ele.id]
})
}
this.list = arr
this.refreshSelectedState()
},
handleSelect() {
let arr = this.list
arr.forEach(ele => {
if (ele.select) {
this.selectedMap[ele.id] = { ...ele }
} else {
delete this.selectedMap[ele.id]
}
})
this.refreshSelectedState()
},
refreshSelectedState() {
this.selectArr = Object.keys(this.selectedMap)
this.isAll = this.list.length ? this.list.every(item => item.select) : false
},
confirmSelect() {
const selectedProducts = Object.values(this.selectedMap)
if (selectedProducts.length === 0) {
uni.showToast({
title: '请至少选择一个商品',
icon: 'none'
})
return
}
//
uni.setStorageSync('selectedProducts', JSON.stringify(selectedProducts))
uni.navigateTo({
url: '/pagesA/crm/contract/contract?fromProductSelect=1'
})
}
}
}
</script>
<style lang="scss" scoped>
.product-select-page {
display: flex;
flex-direction: column;
height: 100vh;
background: #f5f5f5;
}
.fixed-top {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
background: #008EFF;
}
.page-header {
display: flex;
align-items: center;
justify-content: center;
.header-title {
font-size: 34rpx;
color: #fff;
font-weight: 500;
}
}
.search-row {
display: flex;
align-items: center;
background: #008EFF;
padding: 16rpx 24rpx;
.search-box {
width: 100%;
display: flex;
align-items: center;
background: #fff;
border-radius: 34rpx;
padding: 0 24rpx;
height: 64rpx;
.search-icon {
width: 36rpx;
height: 36rpx;
margin-right: 12rpx;
flex-shrink: 0;
}
.search-input {
flex: 1;
font-size: 26rpx;
color: #333;
}
}
}
.main-content {
flex: 1;
display: flex;
height: calc(100vh - 200rpx);
}
.category-list {
width: 160rpx;
background: #fff;
height: 100%;
flex-shrink: 0;
.category-item {
padding: 28rpx 12rpx;
font-size: 24rpx;
color: #333;
text-align: center;
border-bottom: 1rpx solid #f5f5f5;
word-break: break-all;
&.active {
background: #f5f5f5;
color: #008EFF;
font-weight: 500;
position: relative;
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 40rpx;
background: #008EFF;
border-radius: 3rpx;
}
}
}
}
.product-list {
flex: 1;
height: 100%;
padding: 20rpx;
padding-bottom: 220rpx;
box-sizing: border-box;
}
.product-items {
padding-bottom: 40rpx;
.product-item {
background: #fff;
border-radius: 16rpx;
margin-bottom: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
padding: 20rpx;
.product-top {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 16rpx;
.product-name {
flex: 1;
font-size: 26rpx;
color: #333;
font-weight: 500;
line-height: 1.3;
margin-right: 16rpx;
}
.product-num {
font-size: 22rpx;
color: #999;
flex-shrink: 0;
}
}
.product-info {
display: flex;
align-items: center;
.product-radio {
margin-right: 16rpx;
flex-shrink: 0;
radio {
transform: scale(0.7);
}
}
.product-img {
width: 100rpx;
height: 100rpx;
border-radius: 12rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.product-detail {
flex: 1;
min-width: 0;
.detail-text {
font-size: 24rpx;
color: #666;
margin-bottom: 6rpx;
}
.number-box {
display: flex;
align-items: center;
font-size: 24rpx;
color: #666;
margin-top: 8rpx;
.number-input {
margin-left: 10rpx;
}
}
}
}
}
}
.bottom-bar {
position: fixed;
left: 0;
bottom: calc(100rpx + env(safe-area-inset-bottom) / 2);
width: 750rpx;
height: 100rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 30rpx;
border-top: 1rpx solid #f5f5f5;
box-sizing: border-box;
z-index: 99;
.left-box {
display: flex;
align-items: center;
.select-all {
display: flex;
align-items: center;
font-size: 28rpx;
color: #333;
radio {
transform: scale(0.8);
}
}
.select-count {
font-size: 28rpx;
color: #FE9440;
margin-left: 20rpx;
}
}
.right-box {
.btn-confirm {
background: #008EFF;
color: #fff;
font-size: 30rpx;
padding: 20rpx 50rpx;
border-radius: 40rpx;
}
}
}
</style>

View File

@ -197,7 +197,7 @@
uni.setStorageSync('userinfo',res.data.userinfo) uni.setStorageSync('userinfo',res.data.userinfo)
uni.setStorageSync('token',res.data.userinfo.token) uni.setStorageSync('token',res.data.userinfo.token)
uni.redirectTo({ uni.redirectTo({
url:'/pages/index/index' url:'/pages/index/productSelect/productSelect'
}) })
} }
} }

View File

@ -38,7 +38,7 @@
@changeData="changeOtherData"> @changeData="changeOtherData">
</form-item> </form-item>
<!-- 添加产品 --> <!-- 添加产品 -->
<view class="fllow_form" v-if="!isRequired"> <view class="fllow_form" v-if="!isRequired && !fromProductSelect">
<view style="padding-left:15rpx;">购买产品</view> <view style="padding-left:15rpx;">购买产品</view>
<view class="add_in" @click="addPart"> <view class="add_in" @click="addPart">
+添加产品 +添加产品
@ -221,6 +221,7 @@ export default {
businessObj: {}, // businessObj: {}, //
business_id: '', business_id: '',
isRequired: false, // isRequired: false, //
fromProductSelect: false, //
} }
}, },
onLoad(options) { onLoad(options) {
@ -236,6 +237,11 @@ export default {
// //
this.getBusinessProduct() this.getBusinessProduct()
} }
//
if (options.fromProductSelect == '1') {
this.fromProductSelect = true
this.loadSelectedProducts()
}
this.getNumber() this.getNumber()
// //
this.getCustomerList() this.getCustomerList()
@ -245,6 +251,26 @@ export default {
this.getdisType() this.getdisType()
}, },
methods: { methods: {
//
loadSelectedProducts() {
try {
const productsStr = uni.getStorageSync('selectedProducts')
if (productsStr) {
const products = JSON.parse(productsStr)
products.forEach(ele => {
ele.minprice = ele.price
ele.parts = []
ele.remark = ele.remark || ''
})
this.productList = products
this.handleTotalMoney()
//
uni.removeStorageSync('selectedProducts')
}
} catch (e) {
console.error('加载商品失败', e)
}
},
// //
changeRequired(e) { changeRequired(e) {
this.isRequired = e.detail.value this.isRequired = e.detail.value
@ -629,8 +655,9 @@ export default {
duration: 2000 duration: 2000
}) })
setTimeout(() => { setTimeout(() => {
uni.navigateBack({ //
delta: 1 uni.redirectTo({
url: '/pages/index/contract/contract'
}) })
}, 2000) }, 2000)
}) })