upgrade.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-06-07 11:07:33
  6. * @Description: file content
  7. * @FilePath: \oms\pages\project\upgrade.vue
  8. -->
  9. <template>
  10. <view class="home">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">
  14. <view class="back" @click="goBack()">
  15. <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
  16. </view>
  17. <text>项目升级</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="main">
  22. <u-form :model="addForm" :rules="rules" ref="addForm" label-width="0">
  23. <!-- 项目级别 -->
  24. <u-form-item prop="nboType" borderBottom customStyle="padding:40rpx 0 30rpx">
  25. <view class="form-label flex_l">
  26. <view class="label-tag"></view>
  27. 项目级别
  28. </view>
  29. <u-radio-group v-model="addForm.nboType" placement="row" @change="changeLevel">
  30. <u-radio
  31. customStyle="margin-right:40rpx"
  32. :disabled="projectDetails.nboType === '10'"
  33. label="A"
  34. name="10"></u-radio>
  35. <u-radio
  36. customStyle="margin-right:40rpx"
  37. :disabled="projectDetails.nboType === '20'"
  38. label="B"
  39. name="20"></u-radio>
  40. <u-radio
  41. :disabled="['10', '20', '30'].includes(projectDetails.nboType)"
  42. customStyle="margin-right:40rpx"
  43. label="C"
  44. name="30"></u-radio>
  45. </u-radio-group>
  46. </u-form-item>
  47. <!-- C - B 必填项:项目类别、项目预算、渠道销售人员、渠道销售电话、微信、预计出货金额(不填)、添加产品、上传报价单 -->
  48. <view v-if="addForm.nboType !== '30'">
  49. <u-form-item prop="nboBudget" borderBottom customStyle="padding:40rpx 0 30rpx">
  50. <view class="form-label flex_l">
  51. <view class="label-tag"></view>
  52. 项目预算
  53. </view>
  54. <u-input
  55. placeholder="输入项目预算"
  56. v-model.number="addForm.nboBudget"
  57. border="none"
  58. type="number"
  59. suffixIconStyle="color:#CDCDCD"
  60. clearable
  61. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  62. </u-form-item>
  63. <!-- v-if="projectDetails.salesModel !== '10'" -->
  64. <view v-if="projectDetails.salesModel !== '10'">
  65. <u-form-item
  66. prop="dealerSalesName"
  67. borderBottom
  68. customStyle="padding:40rpx 0 30rpx"
  69. @click="$refs.distrConcat.open()">
  70. <view class="form-label flex_l">
  71. <view class="label-tag"></view>
  72. 渠道销售人员
  73. </view>
  74. <u-input
  75. :readonly="true"
  76. placeholder="请选择渠道销售人员"
  77. v-model="addForm.dealerSalesName"
  78. border="none"
  79. suffixIcon="arrow-down"
  80. suffixIconStyle="color:#CDCDCD"
  81. clearable
  82. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  83. </u-form-item>
  84. <u-form-item prop="dealerSalesContact" borderBottom customStyle="padding:40rpx 0 30rpx">
  85. <view class="form-label flex_l">
  86. <view class="label-tag"></view>
  87. 渠道销售电话/微信
  88. </view>
  89. <u-input
  90. placeholder="请选择渠道销售人员"
  91. v-model="addForm.dealerSalesContact"
  92. border="none"
  93. clearable
  94. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  95. </u-form-item>
  96. </view>
  97. <!-- 上传报价单文件 -->
  98. <u-form-item prop="quotationFile" borderBottom customStyle="padding:40rpx 0 30rpx">
  99. <view class="form-label flex_l">
  100. <view class="label-tag"></view>
  101. 报价单
  102. </view>
  103. <uni-file-picker
  104. file-mediatype="all"
  105. mode="grid"
  106. @select="chooseFile($event, 'baojia')"
  107. @delete="delQuotationFile"
  108. ref="upload"
  109. limit="1">
  110. <view class="upload-btn">
  111. <u-icon name="plus-circle-fill" color="blue" size="28"></u-icon>
  112. </view>
  113. </uni-file-picker>
  114. </u-form-item>
  115. <view>
  116. <view class="step-tit center">
  117. <text class="margin20">添加产品</text>
  118. <view class="add-btn" @click="$refs.product.open()">+</view>
  119. </view>
  120. <view class="product-wrap">
  121. <view class="product-item" v-for="(v, i) in productList" :key="v.id">
  122. <u-text
  123. type="primary"
  124. text="删除"
  125. customStyle="margin-left:20rpx"
  126. @click="removeProductItem(i)"></u-text>
  127. <view class="product-label flex_l">
  128. 产品编码:
  129. <view class="product-val">{{ v.prodCode }}</view>
  130. </view>
  131. <view class="product-label flex_l">
  132. 产品名称:
  133. <view class="product-val">{{ v.prodName }}</view>
  134. </view>
  135. <view class="product-label flex_l">
  136. 产品类别:
  137. <view class="product-val">{{ v.prodClass }}</view>
  138. </view>
  139. <view class="product-label flex_l">
  140. 产品单价:
  141. <view class="product-val">
  142. <u-input v-model.number="productList[i].guidPrice" clearable></u-input>
  143. </view>
  144. </view>
  145. <view class="product-label flex_l">
  146. 产品数量:
  147. <view class="product-val">
  148. <u-input v-model="productList[i].prodNum" clearable></u-input>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. <!-- B-A 必填项:采购方式、资金来源、计划 计划采购时间、客户联系人、客户决策部分、客户联系人姓名、客户联系人电话/微信、是否采纳我司技术参数(是/否)、竞争公司、客户倾向厂家 -->
  156. <view v-if="addForm.nboType == '10'">
  157. <u-form-item
  158. prop="purchasingWayVal"
  159. borderBottom
  160. customStyle="padding:40rpx 0 30rpx"
  161. @click="showChasingWay = true">
  162. <view class="form-label flex_l">
  163. <view class="label-tag"></view>
  164. 采购方式
  165. </view>
  166. <u-input
  167. :readonly="true"
  168. placeholder="请选择采购方式"
  169. v-model="addForm.purchasingWayVal"
  170. border="none"
  171. suffixIcon="arrow-down"
  172. suffixIconStyle="color:#CDCDCD"
  173. clearable
  174. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  175. </u-form-item>
  176. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  177. <view class="form-label flex_l">
  178. <view class="label-tag"></view>
  179. 资金来源
  180. </view>
  181. <u-input
  182. placeholder="输入资金来源"
  183. v-model="addForm.capitalSource"
  184. border="none"
  185. suffixIconStyle="color:#CDCDCD"
  186. clearable
  187. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  188. </u-form-item>
  189. <u-form-item
  190. prop="planPurchaseTime"
  191. borderBottom
  192. customStyle="padding:40rpx 0 30rpx"
  193. @click="showPurchasingDate = true">
  194. <view class="form-label flex_l">
  195. <view class="label-tag"></view>
  196. 计划采购时间
  197. </view>
  198. <u-input
  199. :readonly="true"
  200. placeholder="请选择 计划采购时间"
  201. v-model="addForm.planPurchaseTime"
  202. border="none"
  203. suffixIcon="arrow-down"
  204. suffixIconStyle="color:#CDCDCD"
  205. clearable
  206. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  207. </u-form-item>
  208. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" prop="makerName">
  209. <view class="form-label flex_l">
  210. <view class="label-tag"></view>
  211. 客户决策人
  212. </view>
  213. <u-input
  214. placeholder="输入客户联系人"
  215. v-model="addForm.makerName"
  216. border="none"
  217. clearable
  218. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  219. </u-form-item>
  220. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" prop="makerDept">
  221. <view class="form-label flex_l">
  222. <view class="label-tag"></view>
  223. 客户决策部门
  224. </view>
  225. <u-input
  226. placeholder="输入客户决策部门"
  227. v-model="addForm.makerDept"
  228. border="none"
  229. clearable
  230. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  231. </u-form-item>
  232. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" @click="selectContact()">
  233. <view class="form-label flex_l">
  234. <view class="label-tag"></view>
  235. 客户联系人
  236. </view>
  237. <u-input
  238. :readonly="true"
  239. placeholder="输入客户联系人"
  240. v-model="addForm.contactName"
  241. border="none"
  242. suffixIconStyle="color:#CDCDCD"
  243. clearable
  244. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  245. </u-form-item>
  246. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" prop="contactTelephone">
  247. <view class="form-label flex_l">
  248. <view class="label-tag"></view>
  249. 客户联系人电话/微信
  250. </view>
  251. <u-input
  252. placeholder="输入客户联系人电话/微信"
  253. v-model="addForm.contactTelephone"
  254. border="none"
  255. clearable
  256. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  257. </u-form-item>
  258. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" prop="competitor">
  259. <view class="form-label flex_l">
  260. <view class="label-tag"></view>
  261. 竞争公司
  262. </view>
  263. <u-input
  264. placeholder="输入竞争公司"
  265. v-model="addForm.competitor"
  266. border="none"
  267. clearable
  268. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  269. </u-form-item>
  270. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" prop="customerIntentionFactory">
  271. <view class="form-label flex_l">
  272. <view class="label-tag"></view>
  273. 客户倾向厂家
  274. </view>
  275. <u-input
  276. placeholder="输入客户倾向厂家"
  277. v-model="addForm.customerIntentionFactory"
  278. border="none"
  279. clearable
  280. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  281. </u-form-item>
  282. <u-form-item prop="isAdoptDashoo" borderBottom customStyle="padding:40rpx 0 30rpx">
  283. <view class="form-label flex_l">
  284. <view class="label-tag"></view>
  285. 是否采纳大数技术参数
  286. </view>
  287. <u-radio-group v-model="addForm.isAdoptDashoo" placement="row" @change="chooseRadio">
  288. <u-radio customStyle="margin-right:40rpx" label="是" name="10"></u-radio>
  289. <u-radio customStyle="margin-right:40rpx" label="否" name="20"></u-radio>
  290. </u-radio-group>
  291. </u-form-item>
  292. <!-- 上传大数参数文件 -->
  293. <u-form-item
  294. prop="dashooParamFile"
  295. borderBottom
  296. customStyle="padding:40rpx 0 30rpx"
  297. v-if="addForm.isAdoptDashoo == '10'">
  298. <view class="form-label flex_l">
  299. <view class="label-tag"></view>
  300. 文件
  301. </view>
  302. <uni-file-picker
  303. file-mediatype="all"
  304. mode="grid"
  305. @delete="deldashooParamFile"
  306. @select="chooseFile($event)"
  307. ref="upload"
  308. limit="1">
  309. <view class="upload-btn">
  310. <u-icon name="plus-circle-fill" color="blue" size="28"></u-icon>
  311. </view>
  312. </uni-file-picker>
  313. </u-form-item>
  314. </view>
  315. <view v-if="addForm.nboType === '30'">
  316. <u-form-item
  317. prop="projConversionReason"
  318. customStyle="padding:40rpx 0 30rpx"
  319. v-if="addForm.isAdoptDashoo != '30'">
  320. <view class="form-label flex_l">
  321. <view class="label-tag"></view>
  322. 转化原因
  323. </view>
  324. <u-textarea
  325. fontSize="26rpx"
  326. v-model="addForm.projConversionReason"
  327. placeholder="请输入转化原因"
  328. height="180"
  329. :count="true"
  330. maxlength="300"></u-textarea>
  331. </u-form-item>
  332. </view>
  333. <view v-else>
  334. <u-form-item prop="remark" customStyle="padding:40rpx 0 30rpx" v-if="addForm.isAdoptDashoo != '30'">
  335. <view class="form-label flex_l">
  336. <view class="label-tag"></view>
  337. 升级原因
  338. </view>
  339. <u-textarea
  340. fontSize="26rpx"
  341. v-model="addForm.remark"
  342. placeholder="请输入升级原因"
  343. height="180"
  344. :count="true"
  345. maxlength="300"></u-textarea>
  346. </u-form-item>
  347. </view>
  348. </u-form>
  349. <view class="save" @click="handleUpgrade">提交</view>
  350. </view>
  351. <!-- 计划采购时间 -->
  352. <u-datetime-picker
  353. v-if="showPurchasingDate"
  354. :show="showPurchasingDate"
  355. mode="date"
  356. v-model="addForm.planPurchaseTime"
  357. @cancel="showPurchasingDate = false"
  358. @confirm="pickPurchasingDate"></u-datetime-picker>
  359. <!-- 采购方式 -->
  360. <u-picker
  361. :show="showChasingWay"
  362. :columns="[purchasingWayOptions]"
  363. keyName="value"
  364. @cancel="showChasingWay = false"
  365. @confirm="pickModel"></u-picker>
  366. <!-- 经销商代理商联系人 -->
  367. <distr-contact ref="distrConcat" @close="closeConcat" :distrType="targetType"></distr-contact>
  368. <!-- 客户联系人 -->
  369. <customer-contact ref="contact" @close="closeContact($event)"></customer-contact>
  370. <!-- 选择产品 -->
  371. <select-product ref="product" :selectedRows="productList" @close="closeProduct($event)"></select-product>
  372. <u-notify ref="uNotify"></u-notify>
  373. <u-toast ref="uToast"></u-toast>
  374. <u-modal
  375. :asyncClose="true"
  376. :show="showModal"
  377. content="确认进行项目升级?"
  378. :showCancelButton="true"
  379. @cancel="this.showModal = false"
  380. @confirm="this.handleUpgradeApi()"></u-modal>
  381. </view>
  382. </template>
  383. <script>
  384. import {
  385. multipartUpload as upload,
  386. uploadTask as task, //上传任务对象,同requestTask js_sdk\xp-multipart\xp-multipart\xp-multipart.js
  387. } from '@/js_sdk/xp-multipart/xp-multipart/xp-multipart'
  388. import projectApi from '../../api/project'
  389. import to from 'await-to-js'
  390. import CustomerContact from '../../components/CustomerContact'
  391. import DistrContact from '@/components/DistrContact'
  392. import SelectProduct from 'components/SelectProduct'
  393. export default {
  394. name: 'omsIndex',
  395. components: { CustomerContact, DistrContact, SelectProduct },
  396. data() {
  397. return {
  398. flag: true,
  399. height: '',
  400. paddingTop: '',
  401. showSupportDate: false, //技术支持时间
  402. showBudgetDate: false, //项目预算时间
  403. showPurchasingDate: false, // 计划采购时间
  404. showChasingWay: false,
  405. purchasingWayOptions: [],
  406. addForm: {
  407. nboType: '', //项目及别
  408. nboBudget: 0, //项目预算
  409. dealerSalesName: '', //经销商销售人员
  410. dealerSalesId: '', //经销商销售人员
  411. capitalSource: '', //资金来源
  412. purchasingWay: '', //采购方式id
  413. purchasingWayVal: '', //采购方式
  414. planPurchaseTime: this.parseTime(new Date(), '{y}-{m}-{d}'), // 计划采购时间
  415. makerName: '', //客户决策人
  416. contactName: '', //客户联系人
  417. contactId: '', //客户联系人
  418. contactTelephone: '', //客户联系人电话
  419. competitor: '', //竞争公司
  420. customerIntentionFactory: '', //客户倾向厂家
  421. makerDept: '', //客户决策部门
  422. isAdoptDashoo: '', //是否采纳大数技术参数
  423. remark: '', //转化原因
  424. projConversionReason: '', //转化原因
  425. id: 0, //项目id
  426. dashooParamFile: '',
  427. dashooParamFilePaths: '',
  428. quotationFilePaths: '',
  429. quotationFile: '',
  430. },
  431. showModal: false,
  432. projectDetails: {},
  433. rules: {
  434. nboType: [{ required: true, trigger: ['blur', 'change'], message: '请选择项目类别' }],
  435. // C => B
  436. nboBudget: [
  437. { required: true, trigger: ['blur', 'change'], message: '请输入项目预算' },
  438. {
  439. validator: (rule, value, callback) => {
  440. return parseInt(value) <= 0
  441. },
  442. trigger: ['blur', 'change'],
  443. message: '项目预算应大于0',
  444. },
  445. ],
  446. dealerSalesId: [{ required: true, trigger: ['blur', 'change'], message: '请选择渠道销售' }],
  447. dealerSalesName: [{ required: true, trigger: ['blur', 'change'], message: '请选择项渠道销售人员' }],
  448. dealerSalesContact: [{ required: true, trigger: ['blur', 'change'], message: '请输入渠道销售电话/微信' }],
  449. estTransPrice: [{ required: true, trigger: ['blur', 'change'], message: '请选择预计出货金额' }],
  450. dashooParamFile: {
  451. type: 'object',
  452. required: true,
  453. message: '请上传文件',
  454. trigger: ['change'],
  455. },
  456. quotationFile: {
  457. type: 'object',
  458. required: true,
  459. message: '请上传报价单',
  460. trigger: ['change'],
  461. },
  462. products: [{ required: true, trigger: ['blur', 'change'], message: '请选择产品' }],
  463. // B => A
  464. purchasingWay: [{ required: true, trigger: ['blur', 'change'], message: '请选择采购方式' }],
  465. capitalSource: [{ required: true, trigger: ['blur', 'change'], message: '请输入资金来源' }],
  466. planPurchaseTime: [{ required: true, trigger: ['blur', 'change'], message: '请选择计划采购时间' }],
  467. contactId: [{ required: true, trigger: ['blur', 'change'], message: '请选择客户联系人' }],
  468. contactName: [{ required: true, trigger: ['blur', 'change'], message: '请选择客户联系人姓名' }],
  469. contactTelephone: [{ required: true, trigger: ['blur', 'change'], message: '请输入客户联系人电话/微信' }],
  470. makerId: [{ required: true, trigger: ['blur', 'change'], message: '请选择客户决策人' }],
  471. makerName: [{ required: true, trigger: ['blur', 'change'], message: '请选择客户决策人姓名' }],
  472. makerDept: [{ required: true, trigger: ['blur', 'change'], message: '请选择客户决策部门' }],
  473. customerIntentionFactory: [{ required: true, trigger: ['blur', 'change'], message: '请输入客户倾向厂家' }],
  474. competitor: [{ required: true, trigger: ['blur', 'change'], message: '请输入竞争公司' }],
  475. isAdoptDashoo: [{ required: true, trigger: ['blur', 'change'], message: '请选择是或否' }],
  476. projConversionReason: [{ required: true, trigger: ['blur', 'change'], message: '请输入转化原因' }],
  477. remark: [{ required: true, trigger: ['blur', 'change'], message: '请输入原因' }],
  478. },
  479. productList: [],
  480. }
  481. },
  482. created() {
  483. const navData = uni.getMenuButtonBoundingClientRect()
  484. this.height = navData.height + 'px'
  485. this.paddingTop = navData.top + 'px'
  486. },
  487. onLoad(option) {
  488. console.log(option.id) //打印出上个页面传递的参数。
  489. this.addForm.id = parseInt(option.id)
  490. },
  491. mounted() {
  492. this.getDetails()
  493. this.getOptions()
  494. },
  495. methods: {
  496. getOptions() {
  497. Promise.all([this.getDicts('proj_purchasing_way')])
  498. .then(([purchasing]) => {
  499. this.purchasingWayOptions = purchasing.data.values || []
  500. })
  501. .catch((err) => console.log(err))
  502. },
  503. async getDetails() {
  504. const [err, res] = await to(projectApi.getDetail({ id: this.addForm.id }))
  505. if (err) return
  506. if (res.code == 200) {
  507. this.projectDetails = res.data
  508. this.addForm = Object.assign(this.addForm, this.projectDetails)
  509. this.addForm.nboType = ''
  510. this.addForm.projConversionReason = ''
  511. this.addForm.remark = ''
  512. this.productList = res.data.products.map((item) => ({
  513. id: item.prodId,
  514. prodCode: item.prodCode,
  515. prodName: item.prodName,
  516. prodClass: item.prodClass,
  517. guidPrice: item.guidPrice,
  518. prodPrice: item.marketPrice,
  519. prodNum: 1,
  520. }))
  521. console.log(this.productList)
  522. }
  523. },
  524. closeProduct(product) {
  525. if (product.length > 0) {
  526. const combinedArray = [...this.productList, ...product]
  527. this.productList = Array.from(new Set(combinedArray.map((item) => item.id))).map((id) => {
  528. return combinedArray.find((item) => item.id === id)
  529. })
  530. console.log(this.productList)
  531. }
  532. },
  533. removeProductItem(idx) {
  534. this.productList.splice(idx, 1)
  535. },
  536. changeLevel(e) {
  537. if (e == '20') {
  538. this.addForm.dashooParamFile = ''
  539. this.addForm.dashooParamFilePaths = ''
  540. } else if (e == '30') {
  541. this.addForm.dashooParamFile = ''
  542. this.addForm.dashooParamFilePaths = ''
  543. this.addForm.quotationFile = ''
  544. this.addForm.quotationFilePaths = ''
  545. }
  546. },
  547. // 选择采购方式
  548. pickModel(e) {
  549. this.addForm.purchasingWay = e.value[0].key
  550. this.addForm.purchasingWayVal = e.value[0].value
  551. this.showChasingWay = false
  552. },
  553. // 经销商代理商联系人
  554. closeConcat(user) {
  555. this.addForm.dealerSalesId = user.id
  556. this.addForm.dealerSalesName = user.name
  557. if (user.phone !== '' && user.wechat !== '') {
  558. this.addForm.dealerSalesContact = user.phone + '/' + user.wechat
  559. }
  560. if (user.phone !== '') {
  561. this.addForm.dealerSalesContact = user.phone
  562. }
  563. if (user.wechat !== '') {
  564. this.addForm.dealerSalesContact = user.wechat
  565. }
  566. },
  567. selectContact() {
  568. if (!this.addForm.custId) {
  569. this.$refs.uNotify.show({
  570. top: this.height + this.paddingTop + 10,
  571. type: 'warning',
  572. message: '请先选择客户',
  573. duration: 1000 * 3,
  574. })
  575. return
  576. }
  577. this.$refs.contact.open(this.addForm.custId)
  578. },
  579. // 关闭选择客户联系人
  580. closeContact(user) {
  581. if (user) {
  582. this.addForm.contactId = user.id
  583. this.addForm.contactName = user.cuctName
  584. }
  585. },
  586. // 计划采购时间
  587. async pickPurchasingDate(e) {
  588. this.showPurchasingDate = false
  589. const timeFormat = uni.$u.timeFormat
  590. let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
  591. this.addForm.planPurchaseTime = timeValue
  592. },
  593. // 选择是否采用大数参数
  594. chooseRadio(e) {
  595. if (e == '20') {
  596. this.addForm.dashooParamFile = ''
  597. this.addForm.dashooParamFilePaths = ''
  598. }
  599. },
  600. // // 选择上传触发函数
  601. chooseFile(e, type = null) {
  602. if (type == 'baojia') {
  603. this.addForm.quotationFile = e.tempFiles[0].file
  604. this.addForm.quotationFilePaths = e.tempFilePaths[0]
  605. } else {
  606. this.addForm.dashooParamFile = e.tempFiles[0].file
  607. this.addForm.dashooParamFilePaths = e.tempFilePaths[0]
  608. }
  609. },
  610. // 删除报价单
  611. delQuotationFile() {
  612. this.addForm.quotationFile = ''
  613. this.addForm.quotationFilePaths = ''
  614. },
  615. // 删除大数参数文件
  616. deldashooParamFile() {
  617. this.addForm.dashooParamFile = ''
  618. this.addForm.dashooParamFilePaths = ''
  619. },
  620. // 上传函数
  621. async upgradeAorB(data) {
  622. const basePath = process.uniEnv.VUE_APP_MicroSrvProxy_API + process.uniEnv.VUE_APP_ParentPath
  623. upload({
  624. url: basePath, //后端接口
  625. fields: data,
  626. files: {
  627. quotationFile: this.addForm.quotationFilePaths,
  628. dashooParamFile: this.addForm.dashooParamFilePaths,
  629. },
  630. header: {
  631. Tenant: process.uniEnv.VUE_APP_TENANT,
  632. Authorization: 'Bearer ' + uni.getStorageSync('opms_token') || '',
  633. 'X-RPCX-SerializeType': '1',
  634. 'X-RPCX-ServicePath': 'BusinessHandler',
  635. 'X-RPCX-ServiceMethod': 'BusinessUpgradeAorB',
  636. SrvEnv: 'dev',
  637. },
  638. success: (res) => {
  639. if (res.data.code == 200) {
  640. this.$refs.uToast.show({
  641. type: 'success',
  642. message: '提交成功',
  643. complete: () => {
  644. this.goBack()
  645. },
  646. })
  647. } else {
  648. this.$refs.uToast.show({
  649. type: 'warning',
  650. message: res.data.msg,
  651. })
  652. }
  653. },
  654. fail: (err) => {
  655. this.$refs.uToast.show({
  656. type: 'error',
  657. message: '提交失败',
  658. })
  659. },
  660. complete: (ret) => {
  661. this.flag = true
  662. this.showModal = false
  663. },
  664. })
  665. },
  666. handleUpgrade() {
  667. this.$refs.addForm
  668. .validate()
  669. .then(async () => {
  670. this.showModal = true
  671. })
  672. .catch((err) => {
  673. this.$refs.uNotify.show({
  674. top: this.height + this.paddingTop + 10,
  675. type: 'warning',
  676. message: err[0].message,
  677. duration: 1000 * 3,
  678. })
  679. })
  680. },
  681. async handleUpgradeApi() {
  682. if (!this.flag) return
  683. let params = this.addForm
  684. params.nboBudget = Number(params.nboBudget)
  685. params.products = this.productList
  686. this.flag = false
  687. const [err, res] = await to(projectApi.upgrade(params))
  688. this.flag = true
  689. this.showModal = false
  690. if (err) return
  691. if (res && res.code == 200) {
  692. this.$refs.uToast.show({
  693. type: 'success',
  694. message: '提交成功',
  695. complete: () => {
  696. this.goBack()
  697. },
  698. })
  699. }
  700. },
  701. goBack() {
  702. uni.navigateBack({
  703. //关闭当前页面,返回上一页面或多级页面。
  704. delta: 1,
  705. })
  706. },
  707. },
  708. }
  709. </script>
  710. <style>
  711. page {
  712. background: #f2f3f5;
  713. }
  714. </style>
  715. <style lang="scss" scoped>
  716. .home {
  717. padding-top: 188rpx;
  718. .step-tit {
  719. margin-top: 40rpx;
  720. text-align: center;
  721. line-height: 60rpx;
  722. font-size: 26rpx;
  723. color: #000;
  724. }
  725. .product-wrap {
  726. width: 100%;
  727. margin-top: 30rpx;
  728. height: calc(100% - 150rpx);
  729. overflow: auto;
  730. padding: 0 10rpx;
  731. .product-item {
  732. margin: 30rpx 0;
  733. padding: 20rpx;
  734. border-radius: 10px;
  735. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  736. .product-label {
  737. padding: 20rpx 0 20rpx 20rpx;
  738. }
  739. }
  740. }
  741. .add-btn {
  742. color: #fff;
  743. width: 120rpx;
  744. height: 60rpx;
  745. padding: 0rpx 8rpx;
  746. font-size: 12rpx;
  747. background: #3c9cff;
  748. border-radius: 3px;
  749. text-align: center;
  750. line-height: 58rpx;
  751. font-size: 44rpx;
  752. }
  753. .nav {
  754. position: absolute;
  755. left: 0;
  756. top: 0;
  757. width: 100%;
  758. height: 284rpx;
  759. background: #3e7ef8;
  760. .title {
  761. position: relative;
  762. text-align: center;
  763. font-size: 32rpx;
  764. font-weight: bold;
  765. color: #ffffff;
  766. .back {
  767. position: absolute;
  768. top: 0;
  769. bottom: 0;
  770. margin: auto;
  771. left: 70rpx;
  772. display: flex;
  773. }
  774. }
  775. }
  776. .main {
  777. position: absolute;
  778. width: 100%;
  779. height: calc(100vh - 188rpx);
  780. background: #ffffff;
  781. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  782. border-radius: 31rpx 31rpx 0 0;
  783. padding: 0 32rpx;
  784. overflow: auto;
  785. padding-bottom: 64rpx;
  786. .form-label {
  787. font-size: 32rpx;
  788. font-weight: bold;
  789. color: #323232;
  790. padding-bottom: 18rpx;
  791. .label-tag {
  792. width: 15rpx;
  793. height: 15rpx;
  794. background: #ff4d4f;
  795. border-radius: 50%;
  796. margin-right: 10rpx;
  797. }
  798. }
  799. .save {
  800. width: 569rpx;
  801. height: 92rpx;
  802. background: #3e7ef8;
  803. border-radius: 31rpx;
  804. margin: 116rpx auto 0;
  805. font-size: 32rpx;
  806. color: #ffffff;
  807. text-align: center;
  808. line-height: 92rpx;
  809. }
  810. }
  811. }
  812. </style>