师傅入驻页面,完成三分之一

This commit is contained in:
donqi 2022-05-18 01:08:05 +08:00
parent 85e2d3b54e
commit 90d85ca1b7
8 changed files with 266 additions and 28 deletions

View File

@ -7,9 +7,11 @@ export default {
uni.addInterceptor('request', {
invoke(args) {
// request 触发前拼接 url
// args.url = 'http://www.opsoul.com' + args.url;
args.url = 'https://www.opsoul.com' + args.url;
args.data.deptId = globalData.deptId
// args.url = 'https://www.opsoul.com' + args.url;
args.url = 'http://127.0.0.1:80' + args.url;
if (args.data) {
args.data.deptId = globalData.deptId;
}
// console.log("停止触发");
// return false;
},
@ -138,5 +140,13 @@ export default {
data: params
})
return res[1].data;
},
async areaListByStep(params = { parentCode: null }) {
let res = await uni.request({
url: '/system/area/list',
method: 'POST',
data: params
})
return res[1].data;
}
}

View File

@ -4,8 +4,8 @@
<text>{{label}}</text>
</view>
<view class="uni-combox__input-box">
<input class="uni-combox__input" type="text" :placeholder="placeholder"
placeholder-class="uni-combox__input-plac" v-model="inputVal.name" @input="onInput" @focus="onFocus"
<input class="uni-combox__input" type="text" :placeholder="placeholder"
placeholder-class="uni-combox__input-plac" v-model="inputVal[showField]" @input="onInput" @focus="onFocus"
@blur="onBlur" />
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector">
</uni-icons>
@ -18,7 +18,7 @@
</view>
<view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index"
@click="onSelectorClick(index)">
<text>{{item.name}}</text>
<text>{{item[showField]}}</text>
</view>
</scroll-view>
</view>
@ -63,19 +63,23 @@
return []
}
},
showField: {
type: String,
default: 'name'
},
emptyTips: {
type: String,
default: '无匹配项'
},
// #ifndef VUE3
value: {
type: [String, Number],
type: [Object, String, Number],
default: ''
},
// #endif
// #ifdef VUE3
modelValue: {
type: [String, Number],
type: [Object, String, Number],
default: ''
},
// #endif
@ -138,7 +142,7 @@
this.inputVal = this.filterCandidates[index]
this.showSelector = false
this.$emit('input', this.inputVal)
this.$emit('update:modelValue', this.inputVal.name)
this.$emit('update:modelValue', this.inputVal[this.showField])
},
onInput() {
setTimeout(() => {

View File

@ -8,7 +8,8 @@ import globalFun from './common/js/glogalFun.js';
import validate from './common/js/validate.js';
import dateUtil from './common/js/dateUtil.js';
import commonFun from './common/js/commonFun.js';
import request from './common/js/request.js';
import request from './common/js/request.js';
import globalData from './common/js/globalData.js';
Vue.component('cu-custom', CuCustom)
Vue.component('confirm-modal', ConfirmModal);
@ -21,7 +22,8 @@ const data = type => {
request.addInterceptor();
Vue.prototype.$api = {
data
}
}
Vue.prototype.$globalData = globalData;
Vue.prototype.$globalFun = globalFun;
Vue.prototype.$validate = validate;
Vue.prototype.$dateUtil = dateUtil;

View File

@ -1,6 +1,7 @@
{
"pages": [{
"path": "pages/index/index"
// "path": "pages/index/index"
"path": "pages/my/master-occupancy"
}],
"subPackages": [{
"root": "pages/area-proxy/",
@ -25,14 +26,18 @@
}, {
"path": "finish-order"
}]
}, {
"root": "pages/my/",
"pages": [{
"path": "new-serv"
}, {
"path": "goods-manage"
}]
}],
}
// {
// "root": "pages/my/",
// "pages": [{
// "path": "new-serv"
// }, {
// "path": "goods-manage"
// }, {
// "path": "master-occupancy"
// }]
// }
],
"globalStyle": {
"navigationStyle": "custom",
"navigationBarTextStyle": "black"

View File

@ -20,7 +20,7 @@
data() {
return {
moduleBarInfos: [],
curPageCode: 'myPage'
curPageCode: 'indexPage'
}
},
onLoad() {

View File

@ -0,0 +1,189 @@
<template>
<view>
<!-- 顶部操作条 -->
<cu-custom :bgColor="'bg-main-color'" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">师傅入驻信息填写</block>
</cu-custom>
<!-- 步骤条 -->
<view class="bg-white padding">
<view class="cu-steps">
<view class="cu-item" :class="index>curStep?'':'text-main-color'" v-for="(stepName, index) in stepList">
<text class='cuIcon-radioboxfill'></text> {{stepName}}
</view>
</view>
</view>
<view v-if="curStep === 0">
<view class="margin-bottom-with-bar">
<view class="bg-white margin-top-sm" v-for="(item, index) in servArea">
<view class="cu-bar padding-lr solid-bottom">
<view class="text-lg">
<text class="cuIcon-titles"></text>
<text>服务区域{{index + 1}}(将按服务范围派单)</text>
</view>
<view @click="delServArea(index)">
<text class="text-main-color">删除</text>
</view>
</view>
<view class="padding">
<view class="flex">
<my-uni-combox class="flex-sub margin-right-xs" :candidates="provinceList"
:showField="'areaName'" placeholder="选择省份" v-model="servArea[index].provinceObj"
@input="chooseRegion($event, 0, index)"></my-uni-combox>
<my-uni-combox class="flex-sub margin-right-xs" :candidates="servArea[index].cityList"
:showField="'areaName'" placeholder="选择城市" v-model="servArea[index].cityObj"
@input="chooseRegion($event, 1, index)"></my-uni-combox>
<my-uni-combox class="flex-sub" :candidates="servArea[index].districtList"
:showField="'areaName'" placeholder="选择地区" v-model="servArea[index].districtObj"
@input="chooseRegion($event, 2, index)"></my-uni-combox>
</view>
<checkbox-group @change="checkStreet($event, index)" class="grid col-2 margin-top-xs">
<view v-for="(item0, index0) in servArea[index].streetList" class="margin-tb-xs">
<checkbox style="transform:scale(1)" class="main-color margin-right-xs" :value="item0.areaCode" :checked="servArea[index].streetIds.indexOf(item0.areaCode) !== -1 ? true : false">
</checkbox>
<text>{{item0.areaName}}</text>
</view>
</checkbox-group>
</view>
</view>
<view class="text-center margin-top">
<button class="cu-btn bg-main-color light" @click="addServArea">
<text class="margin-right-xs"><text class="cuIcon-add"></text></text>
<text>继续添加服务区域</text>
</button>
</view>
</view>
<!-- 下一步 -->
<view class="cu-bar tabbar border shop fixed-bottom-bar bg-back">
<button class="bg-main-color long-btn margin-lr" form-type="submit">下一步</button>
</view>
</view>
<view v-if="curStep === 1" class="margin-top-sm">
</view>
<view v-if="curStep === 2" class="margin-top-sm">
</view>
</view>
</template>
<script>
import myUniCombox from '@/components/uni-combox/my-uni-combox.vue';
export default {
components: {
myUniCombox
},
onLoad() {
this.loadData();
},
data() {
return {
curStep: 0,
stepList: ['服务范围', '服务技能', '特殊技能'],
provinceList: [],
servArea: [{
cityList: [],
districtList: [],
streetList: [],
provinceObj: {},
cityObj: {},
districtObj: {},
streetIds: []
}]
}
},
methods: {
loadData() {
this.loadProvinceList();
},
async loadProvinceList() {
let res = await this.$request.areaListByStep();
this.provinceList = res.data;
},
async chooseRegion(e, type, index) {
let that = this;
let res = await this.$request.areaListByStep({
parentCode: e.areaCode
});
if (res.code == 0) {
// if (index > this.servArea.length - 1) {
// this.servArea.push({
// cityList: [],
// districtList: [],
// streetList: [],
// provinceObj: e,
// cityObj: {},
// districtObj: {},
// streetIds: []
// });
// }
switch (type) {
case 0: {
this.servArea[index].cityList = res.data;
this.servArea[index].districtList = [];
this.servArea[index].streetList = [];
this.servArea[index].cityObj = {};
this.servArea[index].districtObj = {};
this.servArea[index].streetIds = [];
}
break;
case 1: {
this.servArea[index].districtList = res.data;
this.servArea[index].streetList = [];
this.servArea[index].districtObj = {};
this.servArea[index].streetIds = [];
}
break;
case 2: {
this.servArea[index].streetList = res.data;
this.servArea[index].streetIds = [];
}
break;
default:
break;
}
}
},
checkStreet(e, index) {
// let that = this;
let checkedIndexArr = e.detail.value;
// let streetIds = [];
// checkedIndexArr.forEach((checkedIndex) => {
// console.log("areaCode:" + that.servArea[index].streetList[checkedIndex].areaCode);
// streetIds.push(that.servArea[index].streetList[checkedIndex].areaCode)
// });
console.log(checkedIndexArr)
this.servArea[index].streetIds = checkedIndexArr;
console.log(this.servArea[index].streetIds)
},
addServArea() {
this.servArea.push({
cityList: [],
districtList: [],
streetList: [],
provinceObj: {},
cityObj: {},
districtObj: {},
streetIds: []
});
},
delServArea(index) {
this.servArea.splice(index, 1);
console.log(this.servArea)
},
nextStep() {
this.curStep = this.curStep === this.stepList.length - 1 ? this.curStep : ++this.curStep
},
preStep() {
this.curStep = this.curStep === 0 ? 0 : --this.curStep
},
},
}
</script>
<style scoped>
/deep/ .uni-combox__selector {
z-index: 99 !important;
}
</style>

View File

@ -83,8 +83,8 @@
<view class="solid-top">
<view class="cu-form-group">
<view class="title">上架区域</view>
<picker :mode="'multiSelector'" @change="regionChange" :value="regionMultiIndex" :range-key="'name'" :range="regionList">
<input class="line-input radius-input" :value="formData.region && formData.region.length ? formData.region[0].name + '-' + formData.region[1].name : ''"
<picker :mode="'multiSelector'" @change="regionChange" @columnchange="regionColChange" :value="regionMultiIndex" :range-key="'areaName'" :range="regionList">
<input class="line-input radius-input" :value="formData.region && formData.region.length ? formData.region[0].areaName + '-' + formData.region[1].areaName : ''"
placeholder="请选择区域"></input>
</picker>
</view>
@ -92,7 +92,7 @@
<checkbox-group @change="checkDistirct" class="grid col-3">
<view v-for="(item, index) in formData.districtList" class="margin-tb-xs">
<checkbox style="transform:scale(1)" class="main-color margin-right-xs" :value="index" :checked="item.checked"></checkbox>
<text>{{item.name}}</text>
<text>{{item.areaName}}</text>
</view>
</checkbox-group>
</view>
@ -212,9 +212,10 @@
methods: {
async loadData(goodId) {
this.loadCategoryList();
this.loadRegionList();
// TODO goodIdgood
// this.categoryList = await this.$api.data('categoryList');
this.regionList = await this.$api.data('regionList');
// this.regionList = await this.$api.data('regionList');
},
async loadCategoryList(idArr) {
let typeList = await this.$request.listByStep();
@ -229,6 +230,17 @@
this.categoryList.push(subTypeList);
this.categoryList.push(subSubTypeList);
},
async loadRegionList() {
let regionList = await this.$request.areaListByStep();
regionList = regionList.data;
let subRegionList = [];
if (regionList && regionList.length > 0) {
subRegionList = await this.$request.areaListByStep({ parentCode: regionList[0].areaCode });
subRegionList = subRegionList.data;
}
this.regionList.push(regionList);
this.regionList.push(subRegionList);
},
async categoryChange(e) {
this.categoryMultiIndex = e.detail.value;
let chosenCategory = [];
@ -269,7 +281,20 @@
}
this.formData.region = chosenRegion;
this.formData.districtList = await this.$api.data('districtList');
//
let areaList = await this.$request.areaListByStep({parentCode: chosenRegion[1].areaCode});
this.formData.districtList = areaList.data;
},
async regionColChange(e) {
let colObj = e.detail;
if (colObj.column == 0) {
//
let subAreaList = await this.$request.areaListByStep({parentCode: this.regionList[0][colObj.value].areaCode});
subAreaList = subAreaList.data;
this.regionList.pop();
this.regionList.push(subAreaList);
this.regionMultiIndex = [colObj.value, 0];
}
},
checkSpecs(e) {
let checkedIndexArr = e.detail.value;
@ -296,7 +321,6 @@
this.formData.districtList[i].checked = false;
}
}
console.log(this.formData)
},
chooseImgList(e) {
uni.chooseImage({

View File

@ -1,3 +1,7 @@
.bg-back {
background-color: #f5f5f5;
}
.line-default {
color: #aaaaaa;
}
@ -39,6 +43,6 @@ radio.main-color.checked .uni-radio-input {
}
.cu-list.menu>.cu-item.bg-main-color.light {
color: #0081ff;
color: #0081ff;
background-color: #cce6ff;
}