分类接口对接
This commit is contained in:
parent
4103bc0d15
commit
47c638bac8
12
api/kehu.js
12
api/kehu.js
|
|
@ -234,10 +234,15 @@ export function netCrmContractList(data) {
|
|||
return myRequest('contract/getList',data)
|
||||
}
|
||||
|
||||
//添加 合同时 获取购买产品
|
||||
export function netContractProduct(data) {
|
||||
//添加 合同时 获取购买产品
|
||||
export function netContractProduct(data) {
|
||||
return myRequest('product/getSelectList',data)
|
||||
}
|
||||
}
|
||||
|
||||
//产品分类
|
||||
export function netProductTypeList(data) {
|
||||
return myRequest('product/getTypeList', data)
|
||||
}
|
||||
|
||||
//获取产品分类
|
||||
export function netProductClass(data) {
|
||||
|
|
@ -362,4 +367,3 @@ export function netQueryData(data) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@
|
|||
<image :src="BASE_IMG_URL+'search.png'" class="searchimg" mode=""></image>
|
||||
<input type="text" placeholder="输入产品编号/名称搜索" @input="queryList" class="selfinput">
|
||||
</view>
|
||||
<view class="type-tabs" v-if="typeList.length">
|
||||
<u-tabs name="name" :list="typeList" :is-scroll="true" active-color="#008EFF" :current="typeCurrent"
|
||||
@change="changeType"></u-tabs>
|
||||
</view>
|
||||
<scroll-view scroll-y class="scrollbox" lower-threshold="30">
|
||||
<view class="pop_list">
|
||||
<view class="pop_li" v-for="(item,index) in list" :key="index">
|
||||
|
|
@ -51,7 +55,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { netContractProduct } from '@/api/kehu.js'
|
||||
import { netContractProduct, netProductTypeList } from '@/api/kehu.js'
|
||||
import { BASE_IMG_URL } from '@/util/api.js'
|
||||
|
||||
export default{
|
||||
|
|
@ -71,32 +75,70 @@
|
|||
name:'',
|
||||
list:[],
|
||||
isAll:false,
|
||||
selectArr:[]
|
||||
selectArr:[],
|
||||
typeList:[],
|
||||
typeCurrent:0,
|
||||
typeId:'',
|
||||
selectedMap:{}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
queryList(e) {
|
||||
this.name = e.detail.value
|
||||
this.init()
|
||||
this.getProductList()
|
||||
},
|
||||
init() {
|
||||
async init() {
|
||||
this.$refs.popup.open()
|
||||
this.list = []
|
||||
this.name = ''
|
||||
this.isAll = false
|
||||
this.selectArr = []
|
||||
this.selectedMap = {}
|
||||
this.typeId = ''
|
||||
this.typeCurrent = 0
|
||||
if(!this.typeList.length){
|
||||
await this.getTypeList()
|
||||
}
|
||||
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
|
||||
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){
|
||||
|
|
@ -120,37 +162,38 @@
|
|||
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.handleSelect()
|
||||
this.refreshSelectedState()
|
||||
},
|
||||
closePopup() {
|
||||
this.$refs.popup.close()
|
||||
},
|
||||
handleSelect() {
|
||||
let arr = this.list
|
||||
let newdata = []
|
||||
arr.forEach(ele=>{
|
||||
if(ele.select){
|
||||
newdata.push(ele.id)
|
||||
this.selectedMap[ele.id] = {...ele}
|
||||
}else{
|
||||
delete this.selectedMap[ele.id]
|
||||
}
|
||||
})
|
||||
this.selectArr = newdata
|
||||
this.refreshSelectedState()
|
||||
},
|
||||
refreshSelectedState(){
|
||||
this.selectArr = Object.keys(this.selectedMap)
|
||||
this.isAll = this.list.length ? this.list.every(item=>item.select) : false
|
||||
},
|
||||
//确定
|
||||
sureSelectData() {
|
||||
let arr = this.list
|
||||
let newarr = []
|
||||
arr.forEach(ele=>{
|
||||
if(ele.select){
|
||||
newarr.push(ele)
|
||||
}
|
||||
})
|
||||
const newarr = Object.values(this.selectedMap)
|
||||
this.closePopup()
|
||||
this.$emit('selectList',newarr)
|
||||
}
|
||||
|
|
@ -189,6 +232,9 @@
|
|||
color:$uni-text-color;
|
||||
}
|
||||
}
|
||||
.type-tabs{
|
||||
padding:0 24rpx;
|
||||
}
|
||||
.scrollbox{
|
||||
width:100%;
|
||||
height:700rpx;
|
||||
|
|
|
|||
|
|
@ -1,111 +1,127 @@
|
|||
{
|
||||
"name": "crm",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "crm",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"argparse": {
|
||||
"dingtalk-jsapi": "^2.13.53",
|
||||
"vue-baidu-map": "^0.21.22",
|
||||
"vue-jsonp": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"requires": {
|
||||
"dependencies": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"bmaplib.curveline": {
|
||||
"node_modules/bmaplib.curveline": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bmaplib.curveline/-/bmaplib.curveline-1.0.0.tgz",
|
||||
"integrity": "sha512-9wcFMVhiYxNPqpvsLDAADn3qDhNzXp2mA6VyHSHg2XOAgSooC7ZiujdFhy0sp+0QYjTfJ/MjmLuNoUg2HHxH4Q=="
|
||||
},
|
||||
"bmaplib.heatmap": {
|
||||
"node_modules/bmaplib.heatmap": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/bmaplib.heatmap/-/bmaplib.heatmap-1.0.4.tgz",
|
||||
"integrity": "sha512-rmhqUARBpUSJ9jXzUI2j7dIOqnc38bqubkx/8a349U2qtw/ulLUwyzRD535OrA8G7w5cz4aPKm6/rNvUAarg/Q=="
|
||||
},
|
||||
"bmaplib.lushu": {
|
||||
"node_modules/bmaplib.lushu": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/bmaplib.lushu/-/bmaplib.lushu-1.0.7.tgz",
|
||||
"integrity": "sha512-LVvgpESPii6xGxyjnQjq8u+ic4NjvhdCPV/RiSS/PGTUdZKeTDS7prSpleJLZH3ES0+oc0gYn8bw0LtPYUSz2w=="
|
||||
},
|
||||
"bmaplib.markerclusterer": {
|
||||
"node_modules/bmaplib.markerclusterer": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/bmaplib.markerclusterer/-/bmaplib.markerclusterer-1.0.13.tgz",
|
||||
"integrity": "sha512-VrLyWSiuDEVNi0yUfwOhFQ6z1oEEHS4w36GNu3iASu6p52QIx9uAXMUkuSCHReNR0bj2Cp9SA1dSx5RpojXajQ==",
|
||||
"requires": {
|
||||
"dependencies": {
|
||||
"bmaplib.texticonoverlay": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"bmaplib.texticonoverlay": {
|
||||
"node_modules/bmaplib.texticonoverlay": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/bmaplib.texticonoverlay/-/bmaplib.texticonoverlay-1.0.2.tgz",
|
||||
"integrity": "sha512-4ZTWr4ZP3B6qEWput5Tut16CfZgII38YwM3bpyb4gFTQyORlKYryFp9WHWrwZZaHlOyYDAXG9SX0hka43jTADg=="
|
||||
},
|
||||
"dingtalk-jsapi": {
|
||||
"node_modules/dingtalk-jsapi": {
|
||||
"version": "2.15.6",
|
||||
"resolved": "https://registry.npmjs.org/dingtalk-jsapi/-/dingtalk-jsapi-2.15.6.tgz",
|
||||
"integrity": "sha512-804mFz2AFV/H9ysmo7dLqMjSGOQgREsgQIuep+Xg+yNQeQtnUOYntElEzlB798Sj/691e4mMKz9mtQ7v9qdjuA==",
|
||||
"requires": {
|
||||
"dependencies": {
|
||||
"promise-polyfill": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"entities": {
|
||||
"node_modules/entities": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
|
||||
"integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
|
||||
},
|
||||
"linkify-it": {
|
||||
"node_modules/linkify-it": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz",
|
||||
"integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==",
|
||||
"requires": {
|
||||
"dependencies": {
|
||||
"uc.micro": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"markdown-it": {
|
||||
"node_modules/markdown-it": {
|
||||
"version": "8.4.2",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz",
|
||||
"integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==",
|
||||
"requires": {
|
||||
"dependencies": {
|
||||
"argparse": "^1.0.7",
|
||||
"entities": "~1.1.1",
|
||||
"linkify-it": "^2.0.0",
|
||||
"mdurl": "^1.0.1",
|
||||
"uc.micro": "^1.0.5"
|
||||
},
|
||||
"bin": {
|
||||
"markdown-it": "bin/markdown-it.js"
|
||||
}
|
||||
},
|
||||
"mdurl": {
|
||||
"node_modules/mdurl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
|
||||
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
|
||||
},
|
||||
"promise-polyfill": {
|
||||
"node_modules/promise-polyfill": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-7.1.2.tgz",
|
||||
"integrity": "sha512-FuEc12/eKqqoRYIGBrUptCBRhobL19PS2U31vMNTfyck1FxPyMfgsXyW4Mav85y/ZN1hop3hOwRlUDok23oYfQ=="
|
||||
},
|
||||
"sprintf-js": {
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="
|
||||
},
|
||||
"uc.micro": {
|
||||
"node_modules/uc.micro": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
|
||||
},
|
||||
"vue-baidu-map": {
|
||||
"node_modules/vue-baidu-map": {
|
||||
"version": "0.21.22",
|
||||
"resolved": "https://registry.npmjs.org/vue-baidu-map/-/vue-baidu-map-0.21.22.tgz",
|
||||
"integrity": "sha512-WQMPCih4UTh0AZCKKH/OVOYnyAWjfRNeK6BIeoLmscyY5aF8zzlJhz/NOHLb3mdztIpB0Z6aohn4Jd9mfCSjQw==",
|
||||
"requires": {
|
||||
"dependencies": {
|
||||
"bmaplib.curveline": "^1.0.0",
|
||||
"bmaplib.heatmap": "^1.0.4",
|
||||
"bmaplib.lushu": "^1.0.7",
|
||||
"bmaplib.markerclusterer": "^1.0.13",
|
||||
"markdown-it": "^8.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^2.1.8"
|
||||
}
|
||||
},
|
||||
"vue-jsonp": {
|
||||
"node_modules/vue-jsonp": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.1.0.tgz",
|
||||
"integrity": "sha512-kezmjaAcMWdieO3tWxniC+82DitYUYjR1e2GsWIKHCTf+zhWUt2nPhN3dnmnAVhDQ+po3BspM7sKjiQaIhijUg=="
|
||||
|
|
|
|||
Loading…
Reference in New Issue