customerDetails.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. <template>
  2. <view :class="mask ? 'tl-show': ''">
  3. <u-cell-group :border="false">
  4. <u-cell :border="false" center title="基础信息"></u-cell>
  5. </u-cell-group>
  6. <u--form labelPosition="left" :model="form" ref="form" labelWidth="150rpx"
  7. style="margin-top: 10rpx;margin-bottom: 150rpx;">
  8. <view style="width: calc(96%);margin: 0 auto;background-color: #fff;border-radius: 20rpx;">
  9. <view style="padding: 0 10rpx;">
  10. <u-form-item label="客户名称" prop="cname" borderBottom>
  11. <u-input v-model="form.cname" inputAlign="right" border="none" placeholder="请输入客户名称" />
  12. </u-form-item>
  13. <u-form-item label="联系人" prop="attn" borderBottom>
  14. <u-input v-model="form.attn" inputAlign="right" border="none" placeholder="请输入联系人" />
  15. </u-form-item>
  16. <u-form-item label="电话" prop="tel" borderBottom>
  17. <u-input v-model="form.tel" inputAlign="right" border="none" placeholder="请输入电话" />
  18. </u-form-item>
  19. <u-form-item label="省市区" prop="limitAmount" borderBottom @click="selectAddress" >
  20. <u-input v-model="form.addr" readonly inputAlign="right" border="none"
  21. placeholder="请输入省市区" />
  22. </u-form-item>
  23. <u-form-item label="详细地址" prop="limitAmount" borderBottom>
  24. <u-input v-model="form.details" inputAlign="right" border="none"
  25. placeholder="请输入详细地址" />
  26. </u-form-item>
  27. <u-form-item label="客户分类" borderBottom
  28. @click="customerTypeShow = true">
  29. <u-input border="corpsTypeName" inputAlign="right" disabled placeholder="请选择客户分类"
  30. v-model="form.corpsTypeName" disabledColor="#ffffff" />
  31. </u-form-item>
  32. <u-form-item label="业务员" borderBottom
  33. @click="filterAll(['salesmanName','salesmanId'])">
  34. <u-input border="none" inputAlign="right" disabled placeholder="请选择业务员"
  35. v-model="form.salesmanName" disabledColor="#ffffff" />
  36. </u-form-item>
  37. <!-- <u-form-item label="账期" prop="cname" borderBottom>
  38. <u-input v-model="form.accountPeriod" inputAlign="right" border="none"
  39. placeholder="请输入帐期" />
  40. </u-form-item> -->
  41. <u-form-item label="发货仓库" borderBottom
  42. @click="filterAll(['deliveryWarehouseName','deliveryWarehouseId'])">
  43. <u-input border="none" inputAlign="right" disabled placeholder="请选择发货仓库"
  44. v-model="form.deliveryWarehouseName" disabledColor="#ffffff" />
  45. </u-form-item>
  46. <u-form-item label="商城价格" borderBottom
  47. @click="filterAll(['priceSystem','priceSystem'])">
  48. <u-input border="none" inputAlign="right" disabled placeholder="请选择商城价格"
  49. v-model="form.priceSystem" disabledColor="#ffffff" />
  50. </u-form-item>
  51. <!-- <u-form-item label="是否使用额度:" prop="ifLimitAmount" borderBottom>
  52. <u-switch v-model="form.ifLimitAmount" activeValue="1" inactiveValue="0" ></u-switch>
  53. </u-form-item> -->
  54. <u-form-item label="信用额度" prop="limitAmount" borderBottom>
  55. <u-input v-model="form.limitAmount" readonly inputAlign="right" border="none"
  56. placeholder="请输入帐期" />
  57. </u-form-item>
  58. <!-- <u-form-item label="信用额度" prop="creditLimit" borderBottom>
  59. <u-input v-model="form.creditLimit" inputAlign="right" border="none"
  60. placeholder="请输入帐期" />
  61. </u-form-item> -->
  62. <!-- <u-form-item label="使用信用额度" prop="useCreditLimit" borderBottom >
  63. <u-input v-model="form.useCreditLimit" inputAlign="right"
  64. disabled disabledColor="#fff" border="none" placeholder="" />
  65. </u-form-item> -->
  66. <u-form-item label="备注" prop="cname" borderBottom>
  67. <u--textarea v-model="form.remarks" border="none" placeholder="请输入备注" ></u--textarea>
  68. </u-form-item>
  69. <!-- <u-form-item label="送货地址" :borderBottom="false"
  70. @click="filterAll(['corpsAddrList','corpsAddrList'])">
  71. ({{form.corpsAddrList.length}})
  72. <u-input border="none" inputAlign="right" suffixIcon="plus-circle" disabled
  73. disabledColor="#ffffff" />
  74. </u-form-item> -->
  75. </view>
  76. </view>
  77. <!-- <u-cell-group :border="false">
  78. <u-cell :border="false" center title="客户联系人" :arrow-direction="customerContact==false?'up':'down'"
  79. :value="customerContact==false?'展开':'收起'" :isLink="true" @click="customerContact = !customerContact">
  80. <view slot="title" class="u-slot-title" style="display: flex; align-items: center;">
  81. <text style="color: #244e96;width: 150rpx;">客户联系人</text>
  82. <view style="margin-left: 10rpx; background: #fd4b09;color: #fff;border-radius: 10rpx;padding: 5rpx 10px;"
  83. @click.stop="contactsAddfun">
  84. 新增
  85. </view>
  86. </view>
  87. </u-cell>
  88. </u-cell-group>
  89. <view style="width: calc(96%);margin: 0 auto;border-radius: 20rpx;"
  90. v-if="customerContact">
  91. <view style="padding: 10rpx 20rpx;margin: 20rpx 0;background-color: #fff;box-sizing: border-box;"
  92. v-for="(item,index) in form.corpsAttnList" :key="index">
  93. <view style="display: flex;align-items: center;justify-content: space-between;font-size: 32rpx;margin: 10rpx 0;">
  94. <view style="color: #fd4b09;">序号{{index + 1}}</view>
  95. <view style="margin-left: 10rpx; background: #fd4b09;color: #fff;border-radius: 10rpx;padding: 5rpx 10px;"
  96. @click="contactsDelfun('联系人',index,item.id)" >
  97. 删除
  98. </view>
  99. </view>
  100. <u-form-item label="联系人" prop="cname" borderBottom>
  101. <u-input v-model="item.cname" inputAlign="right" border="none" placeholder="请输入联系人" />
  102. </u-form-item>
  103. <u-form-item label="电话" prop="cname" borderBottom>
  104. <u-input v-model="item.tel" inputAlign="right" border="none" placeholder="请输入电话" />
  105. </u-form-item>
  106. <u-form-item label="备注" prop="cname" borderBottom>
  107. <u--textarea v-model="item.remarks" border="none" placeholder="请输入备注" ></u--textarea>
  108. </u-form-item>
  109. </view>
  110. </view>
  111. <u-cell-group :border="false">
  112. <u-cell :border="false" center title="地址信息" :arrow-direction="addressInformation==false?'up':'down'"
  113. :value="addressInformation==false?'展开':'收起'" :isLink="true" @click="addressInformation = !addressInformation">
  114. <view slot="title" class="u-slot-title" style="display: flex; align-items: center;">
  115. <text style="color: #244e96;width: 150rpx;">地址信息</text>
  116. <view style="margin-left: 10rpx; background: #fd4b09;color: #fff;border-radius: 10rpx;padding: 5rpx 10px;"
  117. @click.stop="corpsAddrfun">
  118. 新增
  119. </view>
  120. </view>
  121. </u-cell>
  122. </u-cell-group>
  123. <view style="width: calc(96%);margin: 0 auto;border-radius: 20rpx;"
  124. v-if="addressInformation">
  125. <view style="padding: 10rpx 20rpx;margin: 20rpx 0;background-color: #fff;box-sizing: border-box;"
  126. v-for="(item,index) in form.corpsAddrList" :key="index">
  127. <view style="display: flex;align-items: center;justify-content: space-between;font-size: 32rpx;margin: 10rpx 0;">
  128. <view style="color: #fd4b09;">序号{{index + 1}}</view>
  129. <view style="margin-left: 10rpx; background: #fd4b09;color: #fff;border-radius: 10rpx;padding: 5rpx 10px;"
  130. @click="contactsDelfun('地址',index,item.id)" >
  131. 删除
  132. </view>
  133. </view>
  134. <u-form-item label="联系人" prop="cname" borderBottom>
  135. <u-input v-model="item.contacts" inputAlign="right" border="none" placeholder="请输入联系人" />
  136. </u-form-item>
  137. <u-form-item label="电话" prop="cname" borderBottom>
  138. <u-input v-model="item.tel" inputAlign="right" border="none" placeholder="请输入联系人" />
  139. </u-form-item>
  140. <u-form-item label="地址" prop="cname" borderBottom
  141. @click="belongtoareafun(index)" >
  142. <u-input v-model="item.belongtoarea" inputAlign="right" border="none" placeholder="请输入地址" />
  143. </u-form-item>
  144. <u-form-item label="详细地址" prop="cname" borderBottom>
  145. <u--textarea v-model="item.detailedAddress" border="none" placeholder="请输入详细地址" ></u--textarea>
  146. </u-form-item>
  147. <u-form-item label="备注" prop="cname" borderBottom>
  148. <u--textarea v-model="item.remarks" border="none" placeholder="请输入备注" ></u--textarea>
  149. </u-form-item>
  150. </view>
  151. </view>
  152. <u-cell-group :border="false">
  153. <u-cell :border="false" center title="图片信息" :arrow-direction="enclosure==false?'up':'down'"
  154. :value="enclosure==false?'展开':'收起'" :isLink="true" @click="enclosure = !enclosure"></u-cell>
  155. </u-cell-group>
  156. <view style="width: calc(96%);margin: 0 auto;background-color: #fff;border-radius: 20rpx;" v-if="enclosure">
  157. <view style="padding: 10rpx 10rpx;">
  158. <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
  159. :maxCount="10"></u-upload>
  160. </view>
  161. </view> -->
  162. </u--form>
  163. <view style="width: 100%;position: fixed;bottom: 0;background-color: #fff;">
  164. <view style="width: 96%;;margin: 20rpx auto; display: flex;">
  165. <u-button @click="corpsDescSubmitfun" type="success" color="#fd4b09" shape="circle" text="确认提交"></u-button>
  166. <!-- <u-button type="success" color="#fd4b09" shape="circle" text="通过"></u-button>
  167. <u-button type="success" color="#fd4b09" shape="circle" text="驳回"></u-button> -->
  168. </view>
  169. </view>
  170. <!-- 客户分类多级选择 -->
  171. <u-picker :show="customerTypeShow" ref="customerTypeUPicker" keyName="title"
  172. :columns="customerTypeColumns"
  173. @confirm="customerTypeConfirm" @change="customerTypeChange" @cancel="customerTypeShow = false">
  174. </u-picker>
  175. <!-- 单列的选择框 -->
  176. <u-picker :show="pickerShow" :columns="pickerColumns" :keyName="pickerKeyName"
  177. @cancel="pickerShow = false" @confirm="pickerConfirm"></u-picker>
  178. <!-- 地址信息多级选择 -->
  179. <u-picker :show="belongtoareaShow" ref="belongtoareaUPicker" keyName="name"
  180. :columns="regionSelectData"
  181. @confirm="belongtoareaConfirm" @change="belongtoareaChange" @cancel="belongtoareaShow = false">
  182. </u-picker>
  183. <!-- <u-popup :show="DZpopupShow" @close="DZpopupShow = false,mask = false,formTwo = {}" closeable :closeOnClickOverlay="false"
  184. zIndex="10070">
  185. <view style="width: 96%;margin: auto auto;margin-top: 20rpx;padding-bottom: 20rpx;">
  186. <text>添加地址</text>
  187. <u-divider style="margin-top: 0rpx;"></u-divider>
  188. <u--form labelPosition="left" :model="formTwo" labelWidth="150rpx">
  189. <u-form-item label="详细地址" borderBottom>
  190. <u-input v-model="formTwo.detailedAddress" border="none" placeholder="请输入">
  191. <template slot="suffix">
  192. <u-button @tap="getMap" type="success" size="mini" icon="map" color="#fd4b09"></u-button>
  193. </template>
  194. </u-input>
  195. </u-form-item>
  196. </u--form>
  197. <view style="display: flex;justify-content: space-between;padding-top: 20rpx;">
  198. <view style="width: 96%;margin: 0 auto;background-color: red;">
  199. <u-button text="保存" type="primary" @click="confirmSearch" color="#fd4b09"></u-button>
  200. </view>
  201. </view>
  202. </view>
  203. </u-popup> -->
  204. <u-picker :show="showWarehouse" ref="uPicker" :defaultIndex="defaultIndex" :loading="loading" :columns="columns" :keyName="keyName"
  205. @confirm="confirmWarehouse" @change="changeHandler" @cancel="showWarehouse = false"></u-picker>
  206. </view>
  207. </template>
  208. <script>
  209. import {
  210. customerTypeAllList,
  211. clientGetUserByRole,
  212. regionSelectList,
  213. corpsDescSubmit,
  214. corpsAttnUpdate,
  215. corpsfilesRemove,
  216. corpsDescAppSubmitV1
  217. } from "@/api/views/customer/index.js"
  218. import { storageDescListAll } from '@/api/OutboundTask/index.js'
  219. import {corpsDescDetail,corpsDescAppDetailsV1 } from '@/api/views/sale/index.js'
  220. import { queryBrand } from '@/api/views/stock/index.js'
  221. import http from '@/http/api.js'
  222. import {corpsDescList} from '@/api/views/sale/salesOrderList.js'
  223. import {
  224. clientId,
  225. clientSecret
  226. } from '@/common/setting'
  227. export default {
  228. data() {
  229. return {
  230. // 数据绑定的对象
  231. form: {
  232. corpsAttnList:[{}], //客户联系人
  233. corpsAddrList:[{}] //地址信息
  234. },
  235. // 客户分类的数据
  236. customerTypeAllData:[],
  237. // 客户分类弹窗的开启
  238. customerTypeShow:false,
  239. // 多列弹窗的左侧展示的数据
  240. customerTypeColumns:[],
  241. // 多列弹窗的右侧展示的数据
  242. customerTypeColumnData:[],
  243. // 业务员请求到的数据
  244. clientGetUserByData:[],
  245. // 发货仓库请求到的数据
  246. storageDescData:[],
  247. // 商品价格接口数据
  248. queryBrandData:[],
  249. // 地理位置接口数据
  250. regionSelectData:[],
  251. // 省市区地理位置弹窗
  252. belongtoareaShow:false,
  253. // 地址信息当前选择的下标
  254. corpsAddrIndex:0,
  255. // 单列弹窗的开启和关闭
  256. pickerShow:false,
  257. // 单列弹窗的数据
  258. pickerColumns:[],
  259. // 弹窗展示的key值
  260. pickerKeyName:'',
  261. // 客户联系人的展开和收起
  262. customerContact:true,
  263. // 地址信息的展开和收起
  264. addressInformation:true,
  265. // 图片的展开收起
  266. enclosure:false,
  267. // 地址弹窗
  268. DZpopupShow:false,
  269. mask:false,
  270. // 图片集合
  271. fileList1:[],
  272. columns: [], // 省市区数据
  273. showWarehouse:false, // 省市区弹窗
  274. keyName: 'name',
  275. loading: false,
  276. defaultIndex:[],
  277. }
  278. },
  279. onLoad(data) {
  280. // 客户分类接口
  281. this.customerTypeAllListfun()
  282. // 业务员接口
  283. this.clientGetUserByRolefun()
  284. // 发货仓库接口
  285. this.storageDescListAllfun()
  286. // 商城价格接口
  287. this.queryBrandfun()
  288. // 地理位置接口
  289. this.regionSelectListfun()
  290. if (data.id) {
  291. uni.setNavigationBarTitle({
  292. title: '客户详情'
  293. })
  294. // 客户详情
  295. this.corpsDescDetailfun(data.id)
  296. }
  297. },
  298. methods: {
  299. // 省下拉
  300. selectAddress() {
  301. if (this.columns.length == 0) {
  302. regionSelectList().then(res=>{
  303. this.columns = res.data
  304. this.showWarehouse = true
  305. })
  306. }else {
  307. this.showWarehouse = true
  308. }
  309. },
  310. confirmWarehouse(e) {
  311. this.form.addr = `${e.value[0].name},${e.value[1].name},${e.value[2].name}`
  312. this.showWarehouse = false
  313. },
  314. changeHandler(e) {
  315. console.log(e,338);
  316. const {
  317. columnIndex,
  318. index,
  319. value,
  320. // 微信小程序无法将picker实例传出来,只能通过ref操作
  321. picker = this.$refs.uPicker
  322. } = e
  323. if (columnIndex !== 2) {
  324. this.loading = true
  325. regionSelectList({
  326. parentCode: value[columnIndex].code
  327. }).then(res => {
  328. if (columnIndex == 0) {
  329. picker.setColumnValues(columnIndex + 1, res.data[0])
  330. picker.setColumnValues(columnIndex + 2, res.data[1])
  331. } else {
  332. picker.setColumnValues(columnIndex + 1, res.data[0])
  333. }
  334. this.loading = false
  335. })
  336. }
  337. },
  338. newCategory(){
  339. uni.$u.route('/pages/views/product/customerType',{
  340. corpType:'KH'
  341. });
  342. },
  343. // 客户联系人新增
  344. contactsAddfun(){
  345. this.form.corpsAttnList.push({})
  346. },
  347. // 客户联系人删除
  348. corpsAttnUpdatefun(index,id){
  349. if (id) {
  350. uni.showLoading({
  351. title: '加载中',
  352. mask: true
  353. });
  354. corpsAttnUpdate({id:id}).then(res=>{
  355. this.form.corpsAttnList.splice(index, 1)
  356. uni.hideLoading();
  357. })
  358. }else {
  359. this.form.corpsAttnList.splice(index, 1)
  360. }
  361. uni.showToast({
  362. title: '删除成功',
  363. icon: 'none',
  364. mask: true
  365. });
  366. },
  367. // 联系人删除地址删除
  368. contactsDelfun(type,index,id){
  369. uni.showModal({
  370. title: '提示',
  371. content: '是否确认删除',
  372. success: (rest)=> {
  373. if (rest.confirm == true) {
  374. if (type == '联系人') {
  375. this.corpsAttnUpdatefun(index,id)
  376. }else {
  377. this.corpsAddrUpdatefun(index,id)
  378. }
  379. }
  380. },
  381. })
  382. },
  383. // 地址信息新增
  384. corpsAddrfun(){
  385. this.form.corpsAddrList.push({})
  386. },
  387. // 地址信息删除
  388. corpsAddrUpdatefun(index,id){
  389. if (id) {
  390. uni.showLoading({
  391. title: '加载中',
  392. mask: true
  393. });
  394. corpsAddrUpdate().then(res=>{
  395. this.form.corpsAddrList.splice(index, 1)
  396. uni.hideLoading();
  397. })
  398. }else {
  399. this.form.corpsAddrList.splice(index, 1)
  400. }
  401. uni.showToast({
  402. title: '删除成功',
  403. icon: 'none',
  404. mask: true
  405. });
  406. },
  407. // 获取客户分类数据
  408. customerTypeAllListfun(){
  409. customerTypeAllList({corpType:'KH'}).then(res=>{
  410. this.customerTypeColumns = [res.data,res.data[0].children || []]
  411. for(let item of res.data) {
  412. if (item.children) {
  413. this.customerTypeColumnData.push(item.children)
  414. }else {
  415. this.customerTypeColumnData.push([])
  416. }
  417. }
  418. })
  419. },
  420. // 获取业务员数据
  421. clientGetUserByRolefun(){
  422. clientGetUserByRole().then(res=>{
  423. this.clientGetUserByData = res
  424. })
  425. },
  426. // 获取发货仓库数据
  427. storageDescListAllfun(){
  428. storageDescListAll().then(res=>{
  429. this.storageDescData = res.data
  430. })
  431. },
  432. // 获取商品价格
  433. queryBrandfun(){
  434. queryBrand({code: 'mall_price'}).then(res=>{
  435. this.queryBrandData = res.data
  436. })
  437. },
  438. // 获取地理位置
  439. regionSelectListfun(){
  440. regionSelectList().then(res=>{
  441. this.regionSelectData = res.data
  442. })
  443. },
  444. // 客户分类弹窗分数据
  445. customerTypeChange(e) {
  446. const {
  447. columnIndex,
  448. value,
  449. values, // values为当前变化列的数组内容
  450. index,
  451. // 微信小程序无法将picker实例传出来,只能通过ref操作
  452. picker = this.$refs.customerTypeUPicker
  453. } = e
  454. // 当第一列值发生变化时,变化第二列(后一列)对应的选项
  455. if (columnIndex === 0) {
  456. // picker为选择器this实例,变化第二列对应的选项
  457. picker.setColumnValues(1, this.customerTypeColumnData[index])
  458. }
  459. },
  460. // 客户分类确认按钮事件
  461. customerTypeConfirm(e) {
  462. if (e.value[1]) {
  463. this.form.corpsTypeId = e.value[1].id
  464. this.form.corpsTypeName = e.value[1].title
  465. }else {
  466. this.form.corpsTypeId = e.value[0].id
  467. this.form.corpsTypeName = e.value[0].title
  468. }
  469. this.customerTypeShow = false
  470. },
  471. // 省市区地理位置弹窗chenge
  472. belongtoareaChange(e) {
  473. const {
  474. columnIndex,
  475. index,
  476. value,
  477. // 微信小程序无法将picker实例传出来,只能通过ref操作
  478. picker = this.$refs.belongtoareaUPicker
  479. } = e
  480. if (columnIndex !== 2) {
  481. regionSelectList({
  482. parentCode: value[columnIndex].code
  483. }).then(res => {
  484. if (columnIndex == 0) {
  485. picker.setColumnValues(columnIndex + 1, res.data[0])
  486. picker.setColumnValues(columnIndex + 2, res.data[1])
  487. } else {
  488. picker.setColumnValues(columnIndex + 1, res.data[0])
  489. }
  490. })
  491. }
  492. },
  493. // 省市区地理位置弹窗确认事件
  494. belongtoareaConfirm(e){
  495. this.form.corpsAddrList[this.corpsAddrIndex].belongtoarea = `${e.value[0].name},${e.value[1].name},${e.value[2].name}`
  496. this.belongtoareaShow = false
  497. },
  498. belongtoareafun(index){
  499. this.corpsAddrIndex = index
  500. this.belongtoareaShow = true
  501. },
  502. // 详情
  503. corpsDescDetailfun(id) {
  504. uni.showLoading({
  505. title: '加载中',
  506. mask: true
  507. });
  508. corpsDescAppDetailsV1({
  509. id: id
  510. }).then(res => {
  511. this.form = res.data
  512. this.fileList1 = res.data.corpsFilesList
  513. for(let item of this.clientGetUserByData) {
  514. if (item.id == this.form.salesmanId) {
  515. this.form.salesmanName = item.name
  516. }
  517. }
  518. for(let item of this.storageDescData) {
  519. if (item.id == this.form.deliveryWarehouseId) {
  520. this.form.deliveryWarehouseName = item.cname
  521. }
  522. }
  523. uni.hideLoading();
  524. })
  525. },
  526. //提交保存
  527. corpsDescSubmitfun() {
  528. if (!this.form.cname) {
  529. return uni.showToast({
  530. title: '客户名称不能为空',
  531. icon: 'none',
  532. mask: true
  533. });
  534. }
  535. if (!this.form.attn) {
  536. return uni.showToast({
  537. title: '联系人不能为空',
  538. icon: 'none',
  539. mask: true
  540. });
  541. }
  542. if (!this.form.corpsTypeName) {
  543. return uni.showToast({
  544. title: '客户分类不能为空',
  545. icon: 'none',
  546. mask: true
  547. });
  548. }
  549. if (!this.form.salesmanId) {
  550. return uni.showToast({
  551. title: '业务员不能为空',
  552. icon: 'none',
  553. mask: true
  554. });
  555. }
  556. if (!this.form.deliveryWarehouseId) {
  557. return uni.showToast({
  558. title: '发货仓库不能为空',
  559. icon: 'none',
  560. mask: true
  561. });
  562. }
  563. if (!this.form.priceSystem) {
  564. return uni.showToast({
  565. title: '商品价格不能为空',
  566. icon: 'none',
  567. mask: true
  568. });
  569. }
  570. if (!this.form.addr) {
  571. return uni.showToast({
  572. title: '省市区不能为空',
  573. icon: 'none',
  574. mask: true
  575. });
  576. }
  577. if (!this.form.details) {
  578. return uni.showToast({
  579. title: '详情地址不能为空',
  580. icon: 'none',
  581. mask: true
  582. });
  583. }
  584. // for(let index in this.form.corpsAttnList) {
  585. // if (!this.form.corpsAttnList[index].cname) {
  586. // return uni.showToast({
  587. // title: `客户联系人序号${Number(index) + 1}联系人不能为空`,
  588. // icon: 'none',
  589. // mask: true
  590. // });
  591. // }
  592. // if (!this.form.corpsAttnList[index].tel) {
  593. // return uni.showToast({
  594. // title: `客户联系人序号${Number(index) + 1}电话不能为空`,
  595. // icon: 'none',
  596. // mask: true
  597. // });
  598. // }
  599. // }
  600. // for(let index in this.form.corpsAddrList) {
  601. // if (!this.form.corpsAddrList[index].contacts) {
  602. // return uni.showToast({
  603. // title: `地址信息序号${Number(index) + 1}联系人不能为空`,
  604. // icon: 'none',
  605. // mask: true
  606. // });
  607. // }
  608. // if (!this.form.corpsAddrList[index].tel) {
  609. // return uni.showToast({
  610. // title: `地址信息序号${Number(index) + 1}电话不能为空`,
  611. // icon: 'none',
  612. // mask: true
  613. // });
  614. // }
  615. // if (!this.form.corpsAddrList[index].belongtoarea) {
  616. // return uni.showToast({
  617. // title: `地址信息序号${Number(index) + 1}地址不能为空`,
  618. // icon: 'none',
  619. // mask: true
  620. // });
  621. // }
  622. // if (!this.form.corpsAddrList[index].detailedAddress) {
  623. // return uni.showToast({
  624. // title: `地址信息序号${Number(index) + 1}详细地址不能为空`,
  625. // icon: 'none',
  626. // mask: true
  627. // });
  628. // }
  629. // }
  630. uni.showModal({
  631. title: '提示',
  632. content: '是否确认保存',
  633. success: (rest)=> {
  634. if (rest.confirm == true) {
  635. uni.showLoading({
  636. title: '加载中',
  637. mask: true
  638. });
  639. if(!this.form.id) {
  640. this.form.checkStatus = '通过'
  641. }
  642. corpsDescAppSubmitV1({
  643. ...this.form,
  644. billType: 1,
  645. code: this.form.cname,
  646. corpType: "KH",
  647. corpsFilesList:this.fileList1
  648. }).then(res => {
  649. uni.hideLoading();
  650. this.corpsDescDetailfun(res.data.id)
  651. setTimeout(()=>{
  652. uni.showToast({
  653. icon: "none",
  654. title: '保存成功请返回',
  655. mask: true
  656. })
  657. },200)
  658. })
  659. }
  660. }
  661. })
  662. },
  663. //集合筛选条件
  664. // 第一项是 绑定id ,第二项是 绑定的name
  665. filterAll(screen) {
  666. this.screen = screen
  667. switch (screen[1]) {
  668. case "salesmanId":
  669. this.pickerColumns = [this.clientGetUserByData]
  670. this.pickerShow = true,
  671. this.pickerKeyName = 'name'
  672. break;
  673. case "deliveryWarehouseId":
  674. this.pickerColumns = [this.storageDescData]
  675. this.pickerShow = true,
  676. this.pickerKeyName = 'cname'
  677. break;
  678. case "priceSystem":
  679. this.pickerColumns = [this.queryBrandData]
  680. this.pickerShow = true,
  681. this.pickerKeyName = 'dictValue'
  682. break;
  683. }
  684. },
  685. // 弹窗复制
  686. pickerConfirm(e) {
  687. switch (this.screen[1]) {
  688. case "salesmanId":
  689. this.form.salesmanId = e.value[0].id
  690. this.form.salesmanName = e.value[0].name
  691. break;
  692. case "deliveryWarehouseId":
  693. this.form.deliveryWarehouseId = e.value[0].id
  694. this.form.deliveryWarehouseName = e.value[0].cname
  695. break;
  696. case "priceSystem":
  697. this.form.priceSystem = e.value[0].dictValue
  698. break;
  699. }
  700. this.pickerShow = false
  701. },
  702. // 删除图片
  703. deletePic(event) {
  704. let this_ = this
  705. uni.showModal({
  706. title: '提示',
  707. content: '是否确认删除',
  708. success: function(rest) {
  709. if (rest.confirm == true) {
  710. if (this_[`fileList${event.name}`][event.index].id) {
  711. corpsfilesRemove({
  712. ids: this_[`fileList${event.name}`][event.index].id
  713. }).then(res => {
  714. this_[`fileList${event.name}`].splice(event.index, 1)
  715. })
  716. } else {
  717. this_[`fileList${event.name}`].splice(event.index, 1)
  718. }
  719. }
  720. }
  721. })
  722. },
  723. // 新增图片
  724. async afterRead(event) {
  725. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  726. let lists = [].concat(event.file)
  727. let fileListLen = this[`fileList${event.name}`].length
  728. lists.map((item) => {
  729. this[`fileList${event.name}`].push({
  730. ...item,
  731. })
  732. })
  733. for (let i = 0; i < lists.length; i++) {
  734. const result = await this.uploadFilePromise(lists[i].url)
  735. let item = this[`fileList${event.name}`][fileListLen]
  736. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  737. sort: this.fileList1.length,
  738. fileName: JSON.parse(result).data.originalName,
  739. url: JSON.parse(result).data.link
  740. }))
  741. fileListLen++
  742. }
  743. },
  744. uploadFilePromise(url) {
  745. return new Promise((resolve, reject) => {
  746. let a = uni.uploadFile({
  747. url: http.config.baseURL +
  748. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  749. filePath: url,
  750. name: 'file',
  751. formData: {
  752. user: 'test'
  753. },
  754. header: {
  755. // 客户端认证参数
  756. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  757. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  758. },
  759. success: (res) => {
  760. setTimeout(() => {
  761. resolve(res.data)
  762. }, 1000)
  763. }
  764. });
  765. })
  766. },
  767. }
  768. }
  769. </script>
  770. <style lang="scss" scoped>
  771. .tl-show {
  772. overflow: hidden;
  773. position: fixed;
  774. height: 100%;
  775. width: 100%;
  776. }
  777. ::v-deep .u-cell__body {
  778. padding: 0rpx 25rpx;
  779. margin: 10rpx 0;
  780. }
  781. ::v-deep .u-cell__title-text {
  782. color: #244e96;
  783. }
  784. ::v-deep .u-form-item__body__left__content__label {
  785. color: #fd4b09;
  786. }
  787. .selectedAddress {
  788. border-bottom: 1rpx solid #fd4b09;
  789. color: #fd4b09;
  790. }
  791. </style>