upgrade.vue 27 KB

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