customerDetails.vue 23 KB

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