1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015 |
- <template>
- <view :class="mask ? 'tl-show': ''">
- <u-cell-group :border="false">
- <u-cell :border="false" center title="基础信息"></u-cell>
- </u-cell-group>
- <u--form labelPosition="left" :model="form" ref="form" labelWidth="150rpx"
- style="margin-top: 10rpx;margin-bottom: 150rpx;">
- <view style="width: calc(96%);margin: 0 auto;background-color: #fff;border-radius: 20rpx;">
- <view style="padding: 0 10rpx;">
- <u-form-item label="客户名称" prop="cname" borderBottom>
- <u-input v-model="form.cname" inputAlign="right" border="none" placeholder="请输入客户名称" />
- </u-form-item>
- <u-form-item :label="form.number?'联系人('+form.number+')':'联系人'" prop="attn" borderBottom>
- <u-input v-model="form.attn" inputAlign="right" border="none" placeholder="请输入联系人" />
- </u-form-item>
- <u-form-item label="电话" prop="tel" borderBottom>
- <u-input v-model="form.tel" inputAlign="right" border="none" placeholder="请输入电话" />
- </u-form-item>
- <u-form-item label="省市区" prop="limitAmount" borderBottom @click="mapopen">
- <u-input v-model="form.addr" readonly inputAlign="right" border="none" placeholder="请输入省市区"
- suffixIcon="map-fill" suffixIconStyle="color: #fa3534" @click="mapopen" />
- </u-form-item>
- <u-form-item label="详细地址" prop="limitAmount" borderBottom>
- <u-input v-model="form.details" inputAlign="right" border="none" placeholder="请选择详细地址" />
- <!-- <u-icon name="map" @click="getMap()"></u-icon><u-textarea v-model="form.details" border="none"
- placeholder="请输入详细地址" autoHeight count /> -->
- <!-- <view class="text-area" @click="mapopen">
- <text class="title">打开地图选点</text>
- </view> -->
- </u-form-item>
- <u-form-item label="客户分类" borderBottom @click="customerTypeShow = true">
- <u-input border="corpsTypeName" inputAlign="right" disabled placeholder="请选择客户分类"
- v-model="form.corpsTypeName" disabledColor="#ffffff" />
- </u-form-item>
- <u-form-item label="业务员" borderBottom @click="filterAll(['salesmanName','salesmanId'])">
- <u-input border="none" inputAlign="right" disabled placeholder="请选择业务员"
- v-model="form.salesmanName" disabledColor="#ffffff" />
- </u-form-item>
- <!-- <u-form-item label="账期" prop="cname" borderBottom>
- <u-input v-model="form.accountPeriod" inputAlign="right" border="none"
- placeholder="请输入帐期" />
- </u-form-item> -->
- <u-form-item label="品牌" borderBottom @click="inShowBrand">
- <u-input border="none" inputAlign="right" disabled placeholder="请选择品牌" v-model="form.brandName"
- disabledColor="#ffffff" />
- </u-form-item>
- <u-form-item label="发货仓库" borderBottom
- @click="filterAll(['deliveryWarehouseName','deliveryWarehouseId'])">
- <u-input border="none" inputAlign="right" disabled placeholder="请选择发货仓库"
- v-model="form.deliveryWarehouseName" disabledColor="#ffffff" />
- </u-form-item>
- <u-form-item label="商城价格" borderBottom @click="filterAll(['priceSystem','priceSystem'])">
- <u-input border="none" inputAlign="right" disabled placeholder="请选择商城价格"
- v-model="form.priceSystem" disabledColor="#ffffff" />
- </u-form-item>
- <!-- <u-form-item label="是否使用额度:" prop="ifLimitAmount" borderBottom>
- <u-switch v-model="form.ifLimitAmount" activeValue="1" inactiveValue="0" ></u-switch>
- </u-form-item> -->
- <u-form-item label="信用额度" prop="limitAmount" borderBottom>
- <u-input v-model="form.limitAmount" readonly inputAlign="right" border="none"
- placeholder="请输入帐期" />
- </u-form-item>
- <u-form-item v-show="form.id" label="二维码" borderBottom>
- <view style="display: flex;justify-content: flex-end;width: 100%;">
- <view style="display: flex;">
- <u-button style="margin-right: 10rpx;" v-show="form.id&&form.filePath" type="success"
- color="#fd4b09" size="mini" text="查看" @click="showImg=true"></u-button>
- <u-button v-show="form.id&&form.filePath" size="mini" text="重新生成" type="success"
- @click="geNerateQRcode()"></u-button>
- <u-button v-show="form.id&&!form.filePath" size="mini" text="生成" type="success"
- @click="geNerateQRcode()"></u-button>
- </view>
- </view>
- </u-form-item>
- <!-- <u-form-item label="信用额度" prop="creditLimit" borderBottom>
- <u-input v-model="form.creditLimit" inputAlign="right" border="none"
- placeholder="请输入帐期" />
- </u-form-item> -->
- <!-- <u-form-item label="使用信用额度" prop="useCreditLimit" borderBottom >
- <u-input v-model="form.useCreditLimit" inputAlign="right"
- disabled disabledColor="#fff" border="none" placeholder="" />
- </u-form-item> -->
- <u-form-item label="备注" prop="cname" borderBottom>
- <u--textarea v-model="form.remarks" border="none" placeholder="请输入备注"></u--textarea>
- </u-form-item>
- <!-- <u-form-item label="送货地址" :borderBottom="false"
- @click="filterAll(['corpsAddrList','corpsAddrList'])">
- ({{form.corpsAddrList.length}})
- <u-input border="none" inputAlign="right" suffixIcon="plus-circle" disabled
- disabledColor="#ffffff" />
- </u-form-item> -->
- </view>
- </view>
- <u-popup :show="showImg" mode="center" @close="closeImg">
- <view style="width: 400px;height: 400px;">
- <u-image style="margin-top: 50rpx;" width="100%" height="600rpx" :src="form.filePath"
- mode="aspectFit"></u-image>
- </view>
- </u-popup>
- <u-popup :show="showBrand" mode="center" @close="closeBrand" @open="openBrand" :round="10">
- <view style="margin: 10px;">
- <uni-data-checkbox multiple v-model="checkboxBrand" :localdata="brandList"
- :map="{text:'cname',value:'id'}" @change='brandChage'></uni-data-checkbox>
- <u-button type="warning" @click="pickBrand" size='mini'>确 认</u-button>
- </view>
- </u-popup>
- <!-- <u-image v-show="form.filePath" width="100%" height="300rpx" :src="form.filePath" mode="aspectFit"
- @click='showImg=true'></u-image> -->
- <!-- <view v-show="form.id&&!form.filePath" style="width: 96%;;margin: 20rpx auto; display: flex;">
- <u-button @click="geNerateQRcode()" type="primary" shape="circle" text="生成二维码"></u-button>
- </view> -->
- <!-- <u-cell-group :border="false">
- <u-cell :border="false" center title="客户联系人" :arrow-direction="customerContact==false?'up':'down'"
- :value="customerContact==false?'展开':'收起'" :isLink="true" @click="customerContact = !customerContact">
- <view slot="title" class="u-slot-title" style="display: flex; align-items: center;">
- <text style="color: #244e96;width: 150rpx;">客户联系人</text>
- <view style="margin-left: 10rpx; background: #fd4b09;color: #fff;border-radius: 10rpx;padding: 5rpx 10px;"
- @click.stop="contactsAddfun">
- 新增
- </view>
- </view>
- </u-cell>
- </u-cell-group>
- <view style="width: calc(96%);margin: 0 auto;border-radius: 20rpx;"
- v-if="customerContact">
- <view style="padding: 10rpx 20rpx;margin: 20rpx 0;background-color: #fff;box-sizing: border-box;"
- v-for="(item,index) in form.corpsAttnList" :key="index">
- <view style="display: flex;align-items: center;justify-content: space-between;font-size: 32rpx;margin: 10rpx 0;">
- <view style="color: #fd4b09;">序号{{index + 1}}</view>
- <view style="margin-left: 10rpx; background: #fd4b09;color: #fff;border-radius: 10rpx;padding: 5rpx 10px;"
- @click="contactsDelfun('联系人',index,item.id)" >
- 删除
- </view>
- </view>
- <u-form-item label="联系人" prop="cname" borderBottom>
- <u-input v-model="item.cname" inputAlign="right" border="none" placeholder="请输入联系人" />
- </u-form-item>
- <u-form-item label="电话" prop="cname" borderBottom>
- <u-input v-model="item.tel" inputAlign="right" border="none" placeholder="请输入电话" />
- </u-form-item>
- <u-form-item label="备注" prop="cname" borderBottom>
- <u--textarea v-model="item.remarks" border="none" placeholder="请输入备注" ></u--textarea>
- </u-form-item>
- </view>
- </view>
-
- <u-cell-group :border="false">
- <u-cell :border="false" center title="地址信息" :arrow-direction="addressInformation==false?'up':'down'"
- :value="addressInformation==false?'展开':'收起'" :isLink="true" @click="addressInformation = !addressInformation">
- <view slot="title" class="u-slot-title" style="display: flex; align-items: center;">
- <text style="color: #244e96;width: 150rpx;">地址信息</text>
- <view style="margin-left: 10rpx; background: #fd4b09;color: #fff;border-radius: 10rpx;padding: 5rpx 10px;"
- @click.stop="corpsAddrfun">
- 新增
- </view>
- </view>
- </u-cell>
- </u-cell-group>
- <view style="width: calc(96%);margin: 0 auto;border-radius: 20rpx;"
- v-if="addressInformation">
- <view style="padding: 10rpx 20rpx;margin: 20rpx 0;background-color: #fff;box-sizing: border-box;"
- v-for="(item,index) in form.corpsAddrList" :key="index">
- <view style="display: flex;align-items: center;justify-content: space-between;font-size: 32rpx;margin: 10rpx 0;">
- <view style="color: #fd4b09;">序号{{index + 1}}</view>
- <view style="margin-left: 10rpx; background: #fd4b09;color: #fff;border-radius: 10rpx;padding: 5rpx 10px;"
- @click="contactsDelfun('地址',index,item.id)" >
- 删除
- </view>
- </view>
- <u-form-item label="联系人" prop="cname" borderBottom>
- <u-input v-model="item.contacts" inputAlign="right" border="none" placeholder="请输入联系人" />
- </u-form-item>
- <u-form-item label="电话" prop="cname" borderBottom>
- <u-input v-model="item.tel" inputAlign="right" border="none" placeholder="请输入联系人" />
- </u-form-item>
- <u-form-item label="地址" prop="cname" borderBottom
- @click="belongtoareafun(index)" >
- <u-input v-model="item.belongtoarea" inputAlign="right" border="none" placeholder="请输入地址" />
- </u-form-item>
- <u-form-item label="详细地址" prop="cname" borderBottom>
- <u--textarea v-model="item.detailedAddress" border="none" placeholder="请输入详细地址" ></u--textarea>
- </u-form-item>
- <u-form-item label="备注" prop="cname" borderBottom>
- <u--textarea v-model="item.remarks" border="none" placeholder="请输入备注" ></u--textarea>
- </u-form-item>
- </view>
- </view>
-
-
-
- <u-cell-group :border="false">
- <u-cell :border="false" center title="图片信息" :arrow-direction="enclosure==false?'up':'down'"
- :value="enclosure==false?'展开':'收起'" :isLink="true" @click="enclosure = !enclosure"></u-cell>
- </u-cell-group>
- <view style="width: calc(96%);margin: 0 auto;background-color: #fff;border-radius: 20rpx;" v-if="enclosure">
- <view style="padding: 10rpx 10rpx;">
- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
- :maxCount="10"></u-upload>
- </view>
- </view> -->
- </u--form>
- <view style="width: 100%;position: fixed;bottom: 0;background-color: #fff;">
- <view style="width: 96%;;margin: 20rpx auto; display: flex;">
- <u-button @click="corpsDescSubmitfun" type="success" color="#fd4b09" shape="circle"
- text="确认提交"></u-button>
- <!-- <u-button type="success" color="#fd4b09" shape="circle" text="通过"></u-button>
- <u-button type="success" color="#fd4b09" shape="circle" text="驳回"></u-button> -->
- </view>
- </view>
- <!-- 客户分类多级选择 -->
- <u-picker :show="customerTypeShow" ref="customerTypeUPicker" keyName="title" :columns="customerTypeColumns"
- @confirm="customerTypeConfirm" @change="customerTypeChange" @cancel="customerTypeShow = false">
- </u-picker>
- <!-- 单列的选择框 -->
- <u-picker :show="pickerShow" :columns="pickerColumns" :keyName="pickerKeyName" @cancel="pickerShow = false"
- @confirm="pickerConfirm"></u-picker>
- <!-- 地址信息多级选择 -->
- <u-picker :show="belongtoareaShow" ref="belongtoareaUPicker" keyName="name" :columns="regionSelectData"
- @confirm="belongtoareaConfirm" @change="belongtoareaChange" @cancel="belongtoareaShow = false">
- </u-picker>
- <!-- <u-popup :show="DZpopupShow" @close="DZpopupShow = false,mask = false,formTwo = {}" closeable :closeOnClickOverlay="false"
- zIndex="10070">
- <view style="width: 96%;margin: auto auto;margin-top: 20rpx;padding-bottom: 20rpx;">
- <text>添加地址</text>
- <u-divider style="margin-top: 0rpx;"></u-divider>
- <u--form labelPosition="left" :model="formTwo" labelWidth="150rpx">
- <u-form-item label="详细地址" borderBottom>
- <u-input v-model="formTwo.detailedAddress" border="none" placeholder="请输入">
- <template slot="suffix">
- <u-button @tap="getMap" type="success" size="mini" icon="map" color="#fd4b09"></u-button>
- </template>
- </u-input>
- </u-form-item>
- </u--form>
- <view style="display: flex;justify-content: space-between;padding-top: 20rpx;">
- <view style="width: 96%;margin: 0 auto;background-color: red;">
- <u-button text="保存" type="primary" @click="confirmSearch" color="#fd4b09"></u-button>
- </view>
- </view>
- </view>
- </u-popup> -->
- <u-picker :show="showWarehouse" ref="uPicker" :defaultIndex="defaultIndex" :loading="loading" :columns="columns"
- :keyName="keyName" @confirm="confirmWarehouse" @change="changeHandler"
- @cancel="showWarehouse = false"></u-picker>
- </view>
- </template>
- <script>
- import {
- customerTypeAllList,
- clientGetUserByRole,
- regionSelectList,
- corpsDescSubmit,
- corpsAttnUpdate,
- corpsfilesRemove,
- corpsDescAppSubmitV1,
- getQRcode,
- getBrand
- } from "@/api/views/customer/index.js"
- import {
- storageDescListAll
- } from '@/api/OutboundTask/index.js'
- import {
- corpsDescDetail,
- corpsDescAppDetailsV1
- } from '@/api/views/sale/index.js'
- import {
- queryBrand
- } from '@/api/views/stock/index.js'
- import http from '@/http/api.js'
- import {
- corpsDescList
- } from '@/api/views/sale/salesOrderList.js'
- import {
- clientId,
- clientSecret
- } from '@/common/setting'
- export default {
- data() {
- return {
- showImg: false,
- // 数据绑定的对象
- form: {
- corpsAttnList: [{}], //客户联系人
- corpsAddrList: [{}], //地址信息
- details: null,
- addr: null,
- dimension: null,
- longitude: null
- },
- // 客户分类的数据
- customerTypeAllData: [],
- // 客户分类弹窗的开启
- customerTypeShow: false,
- // 多列弹窗的左侧展示的数据
- customerTypeColumns: [],
- // 多列弹窗的右侧展示的数据
- customerTypeColumnData: [],
- // 业务员请求到的数据
- clientGetUserByData: [],
- // 发货仓库请求到的数据
- storageDescData: [],
- // 商品价格接口数据
- queryBrandData: [],
- // 地理位置接口数据
- regionSelectData: [],
- // 省市区地理位置弹窗
- belongtoareaShow: false,
- // 地址信息当前选择的下标
- corpsAddrIndex: 0,
- // 单列弹窗的开启和关闭
- pickerShow: false,
- // 单列弹窗的数据
- pickerColumns: [],
- // 弹窗展示的key值
- pickerKeyName: '',
- // 客户联系人的展开和收起
- customerContact: true,
- // 地址信息的展开和收起
- addressInformation: true,
- // 图片的展开收起
- enclosure: false,
- // 地址弹窗
- DZpopupShow: false,
- mask: false,
- // 图片集合
- fileList1: [],
- columns: [], // 省市区数据
- showWarehouse: false, // 省市区弹窗
- keyName: 'name',
- loading: false,
- defaultIndex: [],
- mapData: {},
- errData: {},
- showBrand: false,
- brandList: [],
- checkboxBrand: [],
- }
- },
- onLoad(data) {
- // 客户分类接口
- this.customerTypeAllListfun()
- // 业务员接口
- this.clientGetUserByRolefun()
- // 发货仓库接口
- this.storageDescListAllfun()
- // 商城价格接口
- this.queryBrandfun()
- // 地理位置接口
- this.regionSelectListfun()
- this.getBrandfun()
- if (data.id) {
- uni.setNavigationBarTitle({
- title: '客户详情'
- })
- // 客户详情
- this.corpsDescDetailfun(data.id)
- }
- // this.getLocation()
- },
- onShow() {
- uni.$once('commitCheck', (data) => {
- this.form.details = data.name
- this.form.addr = data.province + "," + data.city + "," + data.district
- this.form.dimension = data.location ? data.location.split(',')[0] : null
- this.form.longitude = data.location ? data.location.split(',')[1] : null
- });
- },
- beforeDestroy() {
- console.log('移除')
- uni.$off();
- },
- methods: {
- getBrandfun() {
- getBrand().then(res => {
- this.brandList = res.data
- })
- },
- inShowBrand() {
- this.showBrand = true
- },
- pickBrand() {
- this.form.brandId = this.checkboxBrand.join(',')
- this.closeBrand()
- },
- brandChage(row) {
- this.form.brandName = null
- let brandName = []
- row.detail.data.forEach(e => {
- brandName.push(e.cname)
- // this.form.brandName+=e.cname
- })
- this.form.brandName = brandName.join(',')
- },
- openBrand() {
- if (this.form.brandId) {
- this.checkboxBrand = this.form.brandId.split(',')
- } else {
- this.checkboxBrand = []
- }
- },
- closeBrand() {
- this.showBrand = false
- },
- mapopen() {
- uni.$u.route({
- url: '/pages/views/customer/map/index',
- params: {
- longitude: this.form.longitude,
- latitude:this.form.dimension
- }
- });
- },
- getLocation() {
- console.log('正在获取定位')
- uni.getLocation({
- // 默认为 wgs84 返回 gps 坐标,
- // gcj02 返回国测局坐标,可用于 uni.openLocation 的坐标
- type: 'gcj02',
- geocode: true,
- isHighAccuracy: true,
- success: (data) => {
- console.log(data)
- this.mapData = data
- },
- fail: (err) => {
- console.log(err)
- this.errData = err
- uni.showToast({
- title: err,
- icon: 'none',
- mask: true
- });
- // this.$api.msg('获取定位失败');
- }
- })
- },
- // getMap() {
- // uni.request({
- // url: 'https://hytapi.ibisaas.com/api/Map/address', // 你的接口域名
- // method: 'GET', // 请求方法,根据需要可能是 'GET' 或 'POST'
- // data: {
- // // 在这里放置需要传递给API的数据
- // key: 'e3w243rewdsfdewtrefcre',
- // location: this.mapData.longitude + ',' + this.mapData.latitude
- // },
- // success: (res) => {
- // console.log(res.data.data.formatted_address);
- // this.form.details = res.data.data.formatted_address
- // // 处理响应数据
- // },
- // fail: (err) => {
- // console.error(err);
- // // 处理请求失败
- // }
- // });
- // },
- closeImg() {
- this.showImg = false
- },
- geNerateQRcode() {
- let obj = {}
- obj = {
- corpId: this.form.id,
- corpName: this.form.cname,
- tenantId: this.form.tenantId
- }
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- getQRcode(obj).then(res => {
- uni.hideLoading();
- this.corpsDescDetailfun(this.form.id, 'open')
- })
- },
- // 省下拉
- selectAddress() {
- if (this.columns.length == 0) {
- regionSelectList().then(res => {
- this.columns = res.data
- this.showWarehouse = true
- })
- } else {
- this.showWarehouse = true
- }
- },
- confirmWarehouse(e) {
- this.form.addr = `${e.value[0].name},${e.value[1].name},${e.value[2].name}`
- this.showWarehouse = false
- },
- changeHandler(e) {
- console.log(e, 338);
- const {
- columnIndex,
- index,
- value,
- // 微信小程序无法将picker实例传出来,只能通过ref操作
- picker = this.$refs.uPicker
- } = e
- if (columnIndex !== 2) {
- this.loading = true
- regionSelectList({
- parentCode: value[columnIndex].code
- }).then(res => {
- if (columnIndex == 0) {
- picker.setColumnValues(columnIndex + 1, res.data[0])
- picker.setColumnValues(columnIndex + 2, res.data[1])
- } else {
- picker.setColumnValues(columnIndex + 1, res.data[0])
- }
- this.loading = false
- })
- }
- },
- newCategory() {
- uni.$u.route('/pages/views/product/customerType', {
- corpType: 'KH'
- });
- },
- // 客户联系人新增
- contactsAddfun() {
- this.form.corpsAttnList.push({})
- },
- // 客户联系人删除
- corpsAttnUpdatefun(index, id) {
- if (id) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- corpsAttnUpdate({
- id: id
- }).then(res => {
- this.form.corpsAttnList.splice(index, 1)
- uni.hideLoading();
- })
- } else {
- this.form.corpsAttnList.splice(index, 1)
- }
- uni.showToast({
- title: '删除成功',
- icon: 'none',
- mask: true
- });
- },
- // 联系人删除地址删除
- contactsDelfun(type, index, id) {
- uni.showModal({
- title: '提示',
- content: '是否确认删除',
- success: (rest) => {
- if (rest.confirm == true) {
- if (type == '联系人') {
- this.corpsAttnUpdatefun(index, id)
- } else {
- this.corpsAddrUpdatefun(index, id)
- }
- }
- },
- })
- },
- // 地址信息新增
- corpsAddrfun() {
- this.form.corpsAddrList.push({})
- },
- // 地址信息删除
- corpsAddrUpdatefun(index, id) {
- if (id) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- corpsAddrUpdate().then(res => {
- this.form.corpsAddrList.splice(index, 1)
- uni.hideLoading();
- })
- } else {
- this.form.corpsAddrList.splice(index, 1)
- }
- uni.showToast({
- title: '删除成功',
- icon: 'none',
- mask: true
- });
- },
- // 获取客户分类数据
- customerTypeAllListfun() {
- customerTypeAllList({
- corpType: 'KH'
- }).then(res => {
- this.customerTypeColumns = [res.data, res.data[0].children || []]
- for (let item of res.data) {
- if (item.children) {
- this.customerTypeColumnData.push(item.children)
- } else {
- this.customerTypeColumnData.push([])
- }
- }
- })
- },
- // 获取业务员数据
- clientGetUserByRolefun() {
- clientGetUserByRole().then(res => {
- this.clientGetUserByData = res
- })
- },
- // 获取发货仓库数据
- storageDescListAllfun() {
- storageDescListAll().then(res => {
- this.storageDescData = res.data
- })
- },
- // 获取商品价格
- queryBrandfun() {
- queryBrand({
- code: 'mall_price'
- }).then(res => {
- this.queryBrandData = res.data
- })
- },
- // 获取地理位置
- regionSelectListfun() {
- regionSelectList().then(res => {
- this.regionSelectData = res.data
- })
- },
- // 客户分类弹窗分数据
- customerTypeChange(e) {
- const {
- columnIndex,
- value,
- values, // values为当前变化列的数组内容
- index,
- // 微信小程序无法将picker实例传出来,只能通过ref操作
- picker = this.$refs.customerTypeUPicker
- } = e
- // 当第一列值发生变化时,变化第二列(后一列)对应的选项
- if (columnIndex === 0) {
- // picker为选择器this实例,变化第二列对应的选项
- picker.setColumnValues(1, this.customerTypeColumnData[index])
- }
- },
- // 客户分类确认按钮事件
- customerTypeConfirm(e) {
- if (e.value[1]) {
- this.form.corpsTypeId = e.value[1].id
- this.form.corpsTypeName = e.value[1].title
- } else {
- this.form.corpsTypeId = e.value[0].id
- this.form.corpsTypeName = e.value[0].title
- }
- this.customerTypeShow = false
- },
- // 省市区地理位置弹窗chenge
- belongtoareaChange(e) {
- const {
- columnIndex,
- index,
- value,
- // 微信小程序无法将picker实例传出来,只能通过ref操作
- picker = this.$refs.belongtoareaUPicker
- } = e
- if (columnIndex !== 2) {
- regionSelectList({
- parentCode: value[columnIndex].code
- }).then(res => {
- if (columnIndex == 0) {
- picker.setColumnValues(columnIndex + 1, res.data[0])
- picker.setColumnValues(columnIndex + 2, res.data[1])
- } else {
- picker.setColumnValues(columnIndex + 1, res.data[0])
- }
- })
- }
- },
- // 省市区地理位置弹窗确认事件
- belongtoareaConfirm(e) {
- this.form.corpsAddrList[this.corpsAddrIndex].belongtoarea =
- `${e.value[0].name},${e.value[1].name},${e.value[2].name}`
- this.belongtoareaShow = false
- },
- belongtoareafun(index) {
- this.corpsAddrIndex = index
- this.belongtoareaShow = true
- },
- // 详情
- corpsDescDetailfun(id, type) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- corpsDescAppDetailsV1({
- id: id
- }).then(res => {
- this.form = res.data
- this.fileList1 = res.data.corpsFilesList
- for (let item of this.clientGetUserByData) {
- if (item.id == this.form.salesmanId) {
- this.form.salesmanName = item.name
- }
- }
- for (let item of this.storageDescData) {
- if (item.id == this.form.deliveryWarehouseId) {
- this.form.deliveryWarehouseName = item.cname
- }
- }
- if (type == 'open') {
- this.showImg = true
- }
- uni.hideLoading();
- })
- },
- //提交保存
- corpsDescSubmitfun() {
- if (!this.form.cname) {
- return uni.showToast({
- title: '客户名称不能为空',
- icon: 'none',
- mask: true
- });
- }
- if (!this.form.attn) {
- return uni.showToast({
- title: '联系人不能为空',
- icon: 'none',
- mask: true
- });
- }
- if (!this.form.corpsTypeName) {
- return uni.showToast({
- title: '客户分类不能为空',
- icon: 'none',
- mask: true
- });
- }
- if (!this.form.salesmanId) {
- return uni.showToast({
- title: '业务员不能为空',
- icon: 'none',
- mask: true
- });
- }
- if (!this.form.deliveryWarehouseId) {
- return uni.showToast({
- title: '发货仓库不能为空',
- icon: 'none',
- mask: true
- });
- }
- if (!this.form.priceSystem) {
- return uni.showToast({
- title: '商品价格不能为空',
- icon: 'none',
- mask: true
- });
- }
- if (!this.form.addr) {
- return uni.showToast({
- title: '省市区不能为空',
- icon: 'none',
- mask: true
- });
- }
- if (!this.form.details) {
- return uni.showToast({
- title: '详情地址不能为空',
- icon: 'none',
- mask: true
- });
- }
- // for(let index in this.form.corpsAttnList) {
- // if (!this.form.corpsAttnList[index].cname) {
- // return uni.showToast({
- // title: `客户联系人序号${Number(index) + 1}联系人不能为空`,
- // icon: 'none',
- // mask: true
- // });
- // }
- // if (!this.form.corpsAttnList[index].tel) {
- // return uni.showToast({
- // title: `客户联系人序号${Number(index) + 1}电话不能为空`,
- // icon: 'none',
- // mask: true
- // });
- // }
- // }
- // for(let index in this.form.corpsAddrList) {
- // if (!this.form.corpsAddrList[index].contacts) {
- // return uni.showToast({
- // title: `地址信息序号${Number(index) + 1}联系人不能为空`,
- // icon: 'none',
- // mask: true
- // });
- // }
- // if (!this.form.corpsAddrList[index].tel) {
- // return uni.showToast({
- // title: `地址信息序号${Number(index) + 1}电话不能为空`,
- // icon: 'none',
- // mask: true
- // });
- // }
- // if (!this.form.corpsAddrList[index].belongtoarea) {
- // return uni.showToast({
- // title: `地址信息序号${Number(index) + 1}地址不能为空`,
- // icon: 'none',
- // mask: true
- // });
- // }
- // if (!this.form.corpsAddrList[index].detailedAddress) {
- // return uni.showToast({
- // title: `地址信息序号${Number(index) + 1}详细地址不能为空`,
- // icon: 'none',
- // mask: true
- // });
- // }
- // }
- uni.showModal({
- title: '提示',
- content: '是否确认保存',
- success: (rest) => {
- if (rest.confirm == true) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- if (!this.form.id) {
- this.form.checkStatus = '通过'
- }
- corpsDescAppSubmitV1({
- ...this.form,
- billType: 1,
- code: this.form.cname,
- corpType: "KH",
- corpsFilesList: this.fileList1
- }).then(res => {
- uni.hideLoading();
- this.corpsDescDetailfun(res.data.id)
- setTimeout(() => {
- uni.showToast({
- icon: "none",
- title: '保存成功请返回',
- mask: true
- })
- }, 200)
- })
- }
- }
- })
- },
- //集合筛选条件
- // 第一项是 绑定id ,第二项是 绑定的name
- filterAll(screen) {
- this.screen = screen
- switch (screen[1]) {
- case "salesmanId":
- this.pickerColumns = [this.clientGetUserByData]
- this.pickerShow = true,
- this.pickerKeyName = 'name'
- break;
- case "deliveryWarehouseId":
- this.pickerColumns = [this.storageDescData]
- this.pickerShow = true,
- this.pickerKeyName = 'cname'
- break;
- case "priceSystem":
- this.pickerColumns = [this.queryBrandData]
- this.pickerShow = true,
- this.pickerKeyName = 'dictValue'
- break;
- }
- },
- // 弹窗复制
- pickerConfirm(e) {
- switch (this.screen[1]) {
- case "salesmanId":
- this.form.salesmanId = e.value[0].id
- this.form.salesmanName = e.value[0].name
- break;
- case "deliveryWarehouseId":
- this.form.deliveryWarehouseId = e.value[0].id
- this.form.deliveryWarehouseName = e.value[0].cname
- break;
- case "priceSystem":
- this.form.priceSystem = e.value[0].dictValue
- break;
- }
- this.pickerShow = false
- },
- // 删除图片
- deletePic(event) {
- let this_ = this
- uni.showModal({
- title: '提示',
- content: '是否确认删除',
- success: function(rest) {
- if (rest.confirm == true) {
- if (this_[`fileList${event.name}`][event.index].id) {
- corpsfilesRemove({
- ids: this_[`fileList${event.name}`][event.index].id
- }).then(res => {
- this_[`fileList${event.name}`].splice(event.index, 1)
- })
- } else {
- this_[`fileList${event.name}`].splice(event.index, 1)
- }
- }
- }
- })
- },
- // 新增图片
- async afterRead(event) {
- // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- sort: this.fileList1.length,
- fileName: JSON.parse(result).data.originalName,
- url: JSON.parse(result).data.link
- }))
- fileListLen++
- }
- },
- uploadFilePromise(url) {
- return new Promise((resolve, reject) => {
- let a = uni.uploadFile({
- url: http.config.baseURL +
- '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
- filePath: url,
- name: 'file',
- formData: {
- user: 'test'
- },
- header: {
- // 客户端认证参数
- 'Authorization': 'Basic ' + Base64.encode(clientId + ':' +
- clientSecret),
- 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
- },
- success: (res) => {
- setTimeout(() => {
- resolve(res.data)
- }, 1000)
- }
- });
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .tl-show {
- overflow: hidden;
- position: fixed;
- height: 100%;
- width: 100%;
- }
- ::v-deep .u-cell__body {
- padding: 0rpx 25rpx;
- margin: 10rpx 0;
- }
- ::v-deep .u-cell__title-text {
- color: #244e96;
- }
- ::v-deep .u-form-item__body__left__content__label {
- color: #fd4b09;
- }
- .selectedAddress {
- border-bottom: 1rpx solid #fd4b09;
- color: #fd4b09;
- }
- </style>
|