upgrade.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  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 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. :asyncClose="true"
  372. :show="showModal"
  373. content="确认进行项目升级?"
  374. :showCancelButton="true"
  375. @cancel="this.showModal = false"
  376. @confirm="this.handleUpgradeApi()"></u-modal>
  377. </view>
  378. </template>
  379. <script>
  380. import {
  381. multipartUpload as upload,
  382. uploadTask as task, //上传任务对象,同requestTask js_sdk\xp-multipart\xp-multipart\xp-multipart.js
  383. // D:\work\oms\js_sdk\xp-multipart\xp-multipart\xp-multipart.js
  384. } from '@/js_sdk/xp-multipart/xp-multipart/xp-multipart'
  385. import projectApi from '../../api/project'
  386. import to from 'await-to-js'
  387. import SelectDealer from 'components/SelectDealer'
  388. import CustomerContact from '../../components/CustomerContact'
  389. export default {
  390. name: 'omsIndex',
  391. components: { SelectDealer, CustomerContact },
  392. data() {
  393. return {
  394. flag: true,
  395. height: '',
  396. paddingTop: '',
  397. showSupportDate: false, //技术支持时间
  398. showBudgetDate: false, //项目预算时间
  399. showPurchasingDate: false, //采购时间
  400. showChasingWay: false,
  401. purchasingWayOptions: [],
  402. addForm: {
  403. nboType: '', //项目及别
  404. nboBudget: 0, //项目预算
  405. distributorName: '', //经销商
  406. distributorId: '', //经销商ID
  407. parentReceiver: '', //项目对接人
  408. technicalSupportName: '', //技术支持人员
  409. technicalSupportContent: null, //技术支持内容
  410. technicalSupportTime: '', //技术支持时间
  411. nboBudgetTime: this.parseTime(new Date(), '{y}-{m}-{d}'), //项目预算时间
  412. capitalSource: '', //资金来源
  413. productSatisfaction: '', //产品方案满足情况
  414. purchasingWay: '', //采购方式id
  415. purchasingWayVal: '', //采购方式
  416. purchasingTime: this.parseTime(new Date(), '{y}-{m}-{d}'), //采购时间
  417. makerId: '', //决策人
  418. makerName: '', //决策人
  419. makerDept: '', //决策部门
  420. historicalTransactionInfo: '', //输入经销商与客户历史成交信息
  421. dealerSalesName: '', //经销商销售人员
  422. accendant: '', //维护部门及人员
  423. isAdoptDashoo: '', //是否采纳大数技术参数
  424. remark: '', //转化原因
  425. projConversionReason: '', //升级原因
  426. id: 0, //项目id
  427. dashooParamFile: '',
  428. dashooParamFilePaths: '',
  429. quotationFilePaths: '',
  430. quotationFile: '',
  431. },
  432. showModal: false,
  433. projectDetails: {},
  434. rules: {
  435. nboType: {
  436. type: 'string',
  437. required: true,
  438. message: '请选择项目级别',
  439. trigger: ['blur'],
  440. },
  441. technicalSupportName: {
  442. type: 'string',
  443. required: true,
  444. message: '请输入技术支持人员',
  445. trigger: ['blur'],
  446. },
  447. technicalSupportContent: {
  448. type: 'string',
  449. required: true,
  450. message: '请输入技术支持内容',
  451. trigger: ['blur'],
  452. },
  453. nboBudget: {
  454. type: 'number',
  455. required: true,
  456. message: '请输入项目预算',
  457. trigger: ['blur'],
  458. },
  459. purchasingWayVal: {
  460. type: 'string',
  461. required: true,
  462. message: '请输入采购方式',
  463. trigger: ['blur'],
  464. },
  465. technicalSupportTime: {
  466. type: 'string',
  467. required: true,
  468. message: '请输入采购时间',
  469. trigger: ['blur'],
  470. },
  471. isAdoptDashoo: {
  472. type: 'string',
  473. required: true,
  474. message: '请选择是否采纳大数技术参数',
  475. trigger: ['blur'],
  476. },
  477. dashooParamFile: {
  478. type: 'object',
  479. required: true,
  480. message: '请上传文件',
  481. trigger: ['change'],
  482. },
  483. quotationFile: {
  484. type: 'object',
  485. required: true,
  486. message: '请上传报价单',
  487. trigger: ['change'],
  488. },
  489. remark: {
  490. type: 'string',
  491. required: true,
  492. message: '请输入转化',
  493. trigger: ['blur'],
  494. },
  495. },
  496. }
  497. },
  498. created() {
  499. const navData = uni.getMenuButtonBoundingClientRect()
  500. this.height = navData.height + 'px'
  501. this.paddingTop = navData.top + 'px'
  502. },
  503. onLoad(option) {
  504. console.log(option.id) //打印出上个页面传递的参数。
  505. this.addForm.id = parseInt(option.id)
  506. },
  507. mounted() {
  508. this.getDetails()
  509. this.getOptions()
  510. },
  511. methods: {
  512. getOptions() {
  513. Promise.all([this.getDicts('proj_purchasing_way')])
  514. .then(([purchasing]) => {
  515. this.purchasingWayOptions = purchasing.data.values || []
  516. })
  517. .catch((err) => console.log(err))
  518. },
  519. async getDetails() {
  520. const [err, res] = await to(projectApi.getDetail({ id: this.addForm.id }))
  521. if (err) return
  522. if (res.code == 200) {
  523. this.projectDetails = res.data
  524. this.addForm = Object.assign(this.addForm, this.projectDetails)
  525. this.addForm.nboType = ''
  526. this.addForm.technicalSupportName = ''
  527. this.addForm.technicalSupportContent = ''
  528. this.addForm.technicalSupportTime = this.parseTime(new Date(), '{y}-{m}-{d}')
  529. this.addForm.nboBudgetTime = this.parseTime(new Date(), '{y}-{m}-{d}')
  530. this.addForm.projConversionReason = ''
  531. this.addForm.remark = ''
  532. }
  533. },
  534. changeLevel(e) {
  535. if (e == '20') {
  536. this.addForm.dashooParamFile = ''
  537. this.addForm.dashooParamFilePaths = ''
  538. } else if (e == '30') {
  539. this.addForm.dashooParamFile = ''
  540. this.addForm.dashooParamFilePaths = ''
  541. this.addForm.quotationFile = ''
  542. this.addForm.quotationFilePaths = ''
  543. }
  544. },
  545. // 选择采购方式
  546. pickModel(e) {
  547. this.addForm.purchasingWay = e.value[0].key
  548. this.addForm.purchasingWayVal = e.value[0].value
  549. this.showChasingWay = false
  550. },
  551. // 经销商
  552. closeDealer(dealer) {
  553. if (dealer) {
  554. this.addForm.distributorId = dealer.id
  555. this.addForm.distributorName = dealer.name
  556. }
  557. },
  558. selectContact() {
  559. if (!this.addForm.custId) {
  560. this.$refs.uNotify.show({
  561. top: this.height + this.paddingTop + 10,
  562. type: 'warning',
  563. message: '请先选择客户',
  564. duration: 1000 * 3,
  565. })
  566. return
  567. }
  568. this.$refs.contact.open(this.addForm.custId)
  569. },
  570. // 关闭选择客户联系人
  571. closeContact(user) {
  572. if (user) {
  573. this.addForm.makerId = user.id
  574. this.addForm.makerName = user.cuctName
  575. this.addForm.makerDept = user.dept
  576. // this.addForm.makerPost = user.postion
  577. // this.addForm.makerTelephone = user.telephone
  578. }
  579. },
  580. // 技术支持时间
  581. async pickSupportDate(e) {
  582. this.showSupportDate = false
  583. const timeFormat = uni.$u.timeFormat
  584. let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
  585. this.addForm.technicalSupportTime = timeValue
  586. },
  587. // 项目预算时间
  588. async pickBudgetDate(e) {
  589. this.showBudgetDate = false
  590. const timeFormat = uni.$u.timeFormat
  591. let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
  592. this.addForm.nboBudgetTime = timeValue
  593. },
  594. // 采购时间
  595. async pickPurchasingDate(e) {
  596. this.showPurchasingDate = false
  597. const timeFormat = uni.$u.timeFormat
  598. let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
  599. this.addForm.purchasingTime = timeValue
  600. },
  601. // 选择是否采用大数参数
  602. chooseRadio(e) {
  603. if (e == '20') {
  604. this.addForm.dashooParamFile = ''
  605. this.addForm.dashooParamFilePaths = ''
  606. }
  607. },
  608. // // 选择上传触发函数
  609. chooseFile(e, type = null) {
  610. if (type == 'baojia') {
  611. this.addForm.quotationFile = e.tempFiles[0].file
  612. this.addForm.quotationFilePaths = e.tempFilePaths[0]
  613. } else {
  614. this.addForm.dashooParamFile = e.tempFiles[0].file
  615. this.addForm.dashooParamFilePaths = e.tempFilePaths[0]
  616. }
  617. },
  618. // 删除报价单
  619. delQuotationFile() {
  620. this.addForm.quotationFile = ''
  621. this.addForm.quotationFilePaths = ''
  622. },
  623. // 删除大数参数文件
  624. deldashooParamFile() {
  625. this.addForm.dashooParamFile = ''
  626. this.addForm.dashooParamFilePaths = ''
  627. },
  628. // 上传函数
  629. async upgradeAorB(data) {
  630. const basePath = process.uniEnv.VUE_APP_MicroSrvProxy_API + process.uniEnv.VUE_APP_ParentPath
  631. upload({
  632. url: basePath, //后端接口
  633. fields: data,
  634. files: {
  635. quotationFile: this.addForm.quotationFilePaths,
  636. dashooParamFile: this.addForm.dashooParamFilePaths,
  637. },
  638. header: {
  639. Tenant: process.uniEnv.VUE_APP_TENANT,
  640. Authorization: 'Bearer ' + uni.getStorageSync('opms_token') || '',
  641. 'X-RPCX-SerializeType': '1',
  642. 'X-RPCX-ServicePath': 'BusinessHandler',
  643. 'X-RPCX-ServiceMethod': 'BusinessUpgradeAorB',
  644. SrvEnv: 'dev',
  645. },
  646. success: (res) => {
  647. if (res.data.code == 200) {
  648. this.$refs.uToast.show({
  649. type: 'success',
  650. message: '提交成功',
  651. complete: () => {
  652. this.goBack()
  653. },
  654. })
  655. } else {
  656. this.$refs.uToast.show({
  657. type: 'warning',
  658. message: res.data.msg,
  659. })
  660. }
  661. },
  662. fail: (err) => {
  663. this.$refs.uToast.show({
  664. type: 'error',
  665. message: '提交失败',
  666. })
  667. },
  668. complete: (ret) => {
  669. this.flag = true
  670. this.showModal = false
  671. },
  672. })
  673. },
  674. handleUpgrade() {
  675. this.$refs.addForm
  676. .validate()
  677. .then(async () => {
  678. this.showModal = true
  679. })
  680. .catch((err) => {
  681. this.$refs.uNotify.show({
  682. top: this.height + this.paddingTop + 10,
  683. type: 'warning',
  684. message: err[0].message,
  685. duration: 1000 * 3,
  686. })
  687. })
  688. },
  689. async handleUpgradeApi() {
  690. if (!this.flag) return
  691. let params = this.addForm
  692. params.nboBudget = Number(params.nboBudget)
  693. this.flag = false
  694. if (this.addForm.nboType === '10' || this.addForm.nboType === '20') {
  695. this.upgradeAorB(params)
  696. } else {
  697. const [err, res] = await to(projectApi.upgrade(params))
  698. this.flag = true
  699. this.showModal = false
  700. if (err) return
  701. if (res && res.code == 200) {
  702. this.$refs.uToast.show({
  703. type: 'success',
  704. message: '提交成功',
  705. complete: () => {
  706. this.goBack()
  707. },
  708. })
  709. }
  710. }
  711. },
  712. goBack() {
  713. uni.navigateBack({
  714. //关闭当前页面,返回上一页面或多级页面。
  715. delta: 1,
  716. })
  717. },
  718. },
  719. }
  720. </script>
  721. <style>
  722. page {
  723. background: #f2f3f5;
  724. }
  725. </style>
  726. <style lang="scss" scoped>
  727. .home {
  728. padding-top: 188rpx;
  729. .nav {
  730. position: absolute;
  731. left: 0;
  732. top: 0;
  733. width: 100%;
  734. height: 284rpx;
  735. background: #3e7ef8;
  736. .title {
  737. position: relative;
  738. text-align: center;
  739. font-size: 32rpx;
  740. font-weight: bold;
  741. color: #ffffff;
  742. .back {
  743. position: absolute;
  744. top: 0;
  745. bottom: 0;
  746. margin: auto;
  747. left: 70rpx;
  748. display: flex;
  749. }
  750. }
  751. }
  752. .main {
  753. position: absolute;
  754. width: 100%;
  755. height: calc(100vh - 188rpx);
  756. background: #ffffff;
  757. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  758. border-radius: 31rpx 31rpx 0 0;
  759. padding: 0 32rpx;
  760. overflow: auto;
  761. padding-bottom: 64rpx;
  762. .form-label {
  763. font-size: 32rpx;
  764. font-weight: bold;
  765. color: #323232;
  766. padding-bottom: 18rpx;
  767. .label-tag {
  768. width: 15rpx;
  769. height: 15rpx;
  770. background: #ff4d4f;
  771. border-radius: 50%;
  772. margin-right: 10rpx;
  773. }
  774. }
  775. .save {
  776. width: 569rpx;
  777. height: 92rpx;
  778. background: #3e7ef8;
  779. border-radius: 31rpx;
  780. margin: 116rpx auto 0;
  781. font-size: 32rpx;
  782. color: #ffffff;
  783. text-align: center;
  784. line-height: 92rpx;
  785. }
  786. }
  787. }
  788. </style>