upgrade.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-21 17:47:39
  6. * @Description: file content
  7. * @FilePath: \frontend_mobile\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. <u-form-item prop="nboType" borderBottom customStyle="padding:40rpx 0 30rpx">
  24. <view class="form-label flex_l">
  25. <view class="label-tag"></view>
  26. 项目级别
  27. </view>
  28. <u-radio-group v-model="addForm.nboType" placement="row">
  29. <u-radio
  30. customStyle="margin-right:40rpx"
  31. :disabled="projectDetails.nboType === '10'"
  32. label="A"
  33. name="10"></u-radio>
  34. <u-radio
  35. customStyle="margin-right:40rpx"
  36. :disabled="projectDetails.nboType === '20'"
  37. label="B"
  38. name="20"></u-radio>
  39. <u-radio
  40. :disabled="['10', '20', '30'].includes(projectDetails.nboType)"
  41. customStyle="margin-right:40rpx"
  42. label="C"
  43. name="30"></u-radio>
  44. <!-- <u-radio v-if="projectDetails.nboType === '10'" label="储备" name="50"></u-radio> -->
  45. </u-radio-group>
  46. </u-form-item>
  47. <view v-if="addForm.nboType !== '30'">
  48. <u-form-item prop="nboBudget" borderBottom customStyle="padding:40rpx 0 30rpx">
  49. <view class="form-label flex_l">
  50. <view class="label-tag"></view>
  51. 项目预算
  52. </view>
  53. <u-input
  54. placeholder="输入项目预算"
  55. v-model="addForm.nboBudget"
  56. border="none"
  57. type="number"
  58. suffixIconStyle="color:#CDCDCD"
  59. clearable
  60. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  61. </u-form-item>
  62. <u-form-item
  63. prop="distributorName"
  64. borderBottom
  65. customStyle="padding:40rpx 0 30rpx"
  66. @click="$refs.dealer.open()">
  67. <view class="form-label flex_l">
  68. <view class="label-tag"></view>
  69. 经销商/代理商
  70. </view>
  71. <u-input
  72. :readonly="true"
  73. placeholder="请选择经销商/代理商"
  74. v-model="addForm.distributorName"
  75. border="none"
  76. suffixIcon="arrow-down"
  77. suffixIconStyle="color:#CDCDCD"
  78. clearable
  79. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  80. </u-form-item>
  81. <u-form-item prop="parentReceiver" borderBottom customStyle="padding:40rpx 0 30rpx">
  82. <view class="form-label flex_l">
  83. 总部对接人
  84. </view>
  85. <u-input
  86. placeholder="输入总部对接人"
  87. v-model="addForm.parentReceiver"
  88. border="none"
  89. suffixIconStyle="color:#CDCDCD"
  90. clearable
  91. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  92. </u-form-item>
  93. </view>
  94. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  95. <view class="form-label flex_l">
  96. 技术支持人员
  97. </view>
  98. <u-input
  99. placeholder="输入技术支持人员"
  100. v-model="addForm.technicalSupportName"
  101. border="none"
  102. suffixIconStyle="color:#CDCDCD"
  103. clearable
  104. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  105. </u-form-item>
  106. <u-form-item prop="technicalSupportContent" borderBottom customStyle="padding:40rpx 0 30rpx">
  107. <view class="form-label flex_l">
  108. <view class="label-tag"></view>
  109. 技术支持内容
  110. </view>
  111. <u-input
  112. placeholder="输入技术支持内容"
  113. v-model="addForm.technicalSupportContent"
  114. border="none"
  115. suffixIconStyle="color:#CDCDCD"
  116. clearable
  117. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  118. </u-form-item>
  119. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" @click="showSupportDate = true">
  120. <view class="form-label flex_l">
  121. 技术支持时间
  122. </view>
  123. <u-input
  124. :readonly="true"
  125. placeholder="请选择技术支持时间"
  126. v-model="addForm.technicalSupportTime"
  127. border="none"
  128. suffixIcon="arrow-down"
  129. suffixIconStyle="color:#CDCDCD"
  130. clearable
  131. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  132. </u-form-item>
  133. <view v-if="addForm.nboType !== '30'">
  134. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" @click="showBudgetDate = true">
  135. <view class="form-label flex_l">
  136. 项目预算期限
  137. </view>
  138. <u-input
  139. :readonly="true"
  140. placeholder="请选择项目预算期限"
  141. v-model="addForm.nboBudgetTime"
  142. border="none"
  143. suffixIcon="arrow-down"
  144. suffixIconStyle="color:#CDCDCD"
  145. clearable
  146. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  147. </u-form-item>
  148. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  149. <view class="form-label flex_l">
  150. 资金来源
  151. </view>
  152. <u-input
  153. placeholder="输入资金来源"
  154. v-model="addForm.capitalSource"
  155. border="none"
  156. suffixIconStyle="color:#CDCDCD"
  157. clearable
  158. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  159. </u-form-item>
  160. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  161. <view class="form-label flex_l">
  162. 产品/方案满足情况
  163. </view>
  164. <u-input
  165. placeholder="输入产品/方案满足情况"
  166. v-model="addForm.productSatisfaction"
  167. border="none"
  168. suffixIconStyle="color:#CDCDCD"
  169. clearable
  170. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  171. </u-form-item>
  172. </view>
  173. <view v-if="addForm.nboType === '10'">
  174. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" @click="showChasingWay = true">
  175. <view class="form-label flex_l">
  176. 采购方式
  177. </view>
  178. <u-input
  179. :readonly="true"
  180. placeholder="请选择采购方式"
  181. v-model="addForm.purchasingWayVal"
  182. border="none"
  183. suffixIcon="arrow-down"
  184. suffixIconStyle="color:#CDCDCD"
  185. clearable
  186. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  187. </u-form-item>
  188. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" @click="showPurchasingDate = true">
  189. <view class="form-label flex_l">
  190. 采购时间
  191. </view>
  192. <u-input
  193. :readonly="true"
  194. placeholder="请选择采购时间"
  195. v-model="addForm.technicalSupportTime"
  196. border="none"
  197. suffixIcon="arrow-down"
  198. suffixIconStyle="color:#CDCDCD"
  199. clearable
  200. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  201. </u-form-item>
  202. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" @click="selectContact()">
  203. <view class="form-label flex_l">
  204. 决策人员
  205. </view>
  206. <u-input
  207. :readonly="true"
  208. placeholder="输入决策人员"
  209. v-model="addForm.makerName"
  210. border="none"
  211. suffixIconStyle="color:#CDCDCD"
  212. clearable
  213. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  214. </u-form-item>
  215. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  216. <view class="form-label flex_l">
  217. 决策部门
  218. </view>
  219. <u-input
  220. :readonly="true"
  221. placeholder="输入决策部门"
  222. v-model="addForm.makerDept"
  223. border="none"
  224. suffixIconStyle="color:#CDCDCD"
  225. clearable
  226. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  227. </u-form-item>
  228. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  229. <view class="form-label flex_l">
  230. 经销商与客户历史成交信息
  231. </view>
  232. <u-input
  233. placeholder="输入经销商与客户历史成交信息"
  234. v-model="addForm.historicalTransactionInfo"
  235. border="none"
  236. suffixIconStyle="color:#CDCDCD"
  237. clearable
  238. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  239. </u-form-item>
  240. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  241. <view class="form-label flex_l">
  242. 经销商销售人员
  243. </view>
  244. <u-input
  245. placeholder="输入经销商销售人员"
  246. v-model="addForm.dealerSalesName"
  247. border="none"
  248. suffixIconStyle="color:#CDCDCD"
  249. clearable
  250. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  251. </u-form-item>
  252. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  253. <view class="form-label flex_l">
  254. 维护部门及人员
  255. </view>
  256. <u-input
  257. placeholder="输入维护部门及人员"
  258. v-model="addForm.accendant"
  259. border="none"
  260. suffixIconStyle="color:#CDCDCD"
  261. clearable
  262. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  263. </u-form-item>
  264. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  265. <view class="form-label flex_l">
  266. 是否采纳大数技术参数
  267. </view>
  268. <u-radio-group v-model="addForm.isAdoptDashoo" placement="row">
  269. <u-radio customStyle="margin-right:40rpx" label="是" name="10"></u-radio>
  270. <u-radio customStyle="margin-right:40rpx" label="否" name="20"></u-radio>
  271. </u-radio-group>
  272. </u-form-item>
  273. </view>
  274. <u-form-item prop="remark" customStyle="padding:40rpx 0 30rpx">
  275. <view class="form-label flex_l">
  276. <view class="label-tag"></view>
  277. 备注原因
  278. </view>
  279. <u-textarea
  280. fontSize="26rpx"
  281. v-model="addForm.remark"
  282. placeholder="请输入备注原因"
  283. height="180"
  284. :count="true"
  285. maxlength="300"></u-textarea>
  286. </u-form-item>
  287. </u-form>
  288. <view class="save" @click="handleDowngrade">提交</view>
  289. </view>
  290. <!-- 技术支持时间 -->
  291. <u-datetime-picker
  292. v-if="showSupportDate"
  293. :show="showSupportDate"
  294. mode="datetime"
  295. v-model="addForm.technicalSupportTime"
  296. @cancel="showSupportDate = false"
  297. @confirm="pickSupportDate"></u-datetime-picker>
  298. <!-- 项目预算期限 -->
  299. <u-datetime-picker
  300. v-if="showBudgetDate"
  301. :show="showBudgetDate"
  302. mode="datetime"
  303. v-model="addForm.nboBudgetTime"
  304. @cancel="showBudgetDate = false"
  305. @confirm="pickBudgetDate"></u-datetime-picker>
  306. <!-- 采购时间 -->
  307. <u-datetime-picker
  308. v-if="showPurchasingDate"
  309. :show="showPurchasingDate"
  310. mode="datetime"
  311. v-model="addForm.purchasingTime"
  312. @cancel="showPurchasingDate = false"
  313. @confirm="pickPurchasingDate"></u-datetime-picker>
  314. <!-- 采购方式 -->
  315. <u-picker
  316. :show="showChasingWay"
  317. :columns="[purchasingWayOptions]"
  318. keyName="value"
  319. @cancel="showChasingWay = false"
  320. @confirm="pickModel"></u-picker>
  321. <!-- 选择经销商 -->
  322. <select-dealer ref="dealer" @close="closeDealer()"></select-dealer>
  323. <!-- 客户联系人 -->
  324. <customer-contact ref="contact" @close="closeContact()"></customer-contact>
  325. <u-notify ref="uNotify"></u-notify>
  326. <u-toast ref="uToast"></u-toast>
  327. <u-modal
  328. :show="showModal"
  329. content="确认进行项目升级?"
  330. :showCancelButton="true"
  331. @cancel="this.showModal = false"
  332. @confirm="this.handleDownApi()"></u-modal>
  333. </view>
  334. </template>
  335. <script>
  336. import projectApi from '../../api/project'
  337. import to from 'await-to-js'
  338. import SelectDealer from 'components/SelectDealer'
  339. import CustomerContact from '../../components/CustomerContact'
  340. export default {
  341. name: 'omsIndex',
  342. components: { SelectDealer, CustomerContact },
  343. data() {
  344. return {
  345. height: '',
  346. paddingTop: '',
  347. showSupportDate: false, //技术支持时间
  348. showBudgetDate: false, //项目预算时间
  349. showPurchasingDate: false, //采购时间
  350. showChasingWay: false,
  351. purchasingWayOptions: [],
  352. addForm: {
  353. nboType: '', //项目及别
  354. nboBudget: 0, //项目预算
  355. distributorName: '', //经销商
  356. distributorId: '', //经销商ID
  357. parentReceiver: '', //项目对接人
  358. technicalSupportName: '', //技术支持人员
  359. technicalSupportContent: null, //技术支持内容
  360. technicalSupportTime: '', //技术支持时间
  361. nboBudgetTime: this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}'), //项目预算时间
  362. capitalSource: '', //资金来源
  363. productSatisfaction: '', //产品方案满足情况
  364. purchasingWay: '', //采购方式id
  365. purchasingWayVal: '', //采购方式
  366. purchasingTime: this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}'), //采购时间
  367. makerId: '', //决策人
  368. makerName: '', //决策人
  369. makerDept: '', //决策部门
  370. historicalTransactionInfo: '', //输入经销商与客户历史成交信息
  371. dealerSalesName: '', //经销商销售人员
  372. accendant: '', //维护部门及人员
  373. isAdoptDashoo: '', //是否是大项目选择
  374. remark: '', //备注
  375. id: 0, //项目id
  376. },
  377. showModal: false,
  378. projectDetails: {},
  379. rules: {
  380. nboType: {
  381. type: 'string',
  382. required: true,
  383. message: '请选择项目级别',
  384. trigger: ['blur'],
  385. },
  386. technicalSupportContent: {
  387. type: 'string',
  388. required: true,
  389. message: '请输入技术支持内容',
  390. trigger: ['blur'],
  391. },
  392. nboBudget: {
  393. type: 'number',
  394. required: true,
  395. message: '请输入项目预算',
  396. trigger: ['blur'],
  397. },
  398. distributorName: {
  399. type: 'string',
  400. required: true,
  401. message: '请选择经销商',
  402. trigger: ['blur'],
  403. },
  404. remark: {
  405. type: 'string',
  406. required: true,
  407. message: '请输入备注内容',
  408. trigger: ['blur'],
  409. },
  410. },
  411. }
  412. },
  413. created() {
  414. const navData = uni.getMenuButtonBoundingClientRect()
  415. this.height = navData.height + 'px'
  416. this.paddingTop = navData.top + 'px'
  417. },
  418. onLoad(option) {
  419. console.log(option.id) //打印出上个页面传递的参数。
  420. this.addForm.id = parseInt(option.id)
  421. },
  422. onShow() {
  423. this.getDetails()
  424. this.getOptions()
  425. },
  426. methods: {
  427. getOptions() {
  428. Promise.all([this.getDicts('proj_purchasing_way')])
  429. .then(([purchasing]) => {
  430. this.purchasingWayOptions = purchasing.data.values || []
  431. })
  432. .catch((err) => console.log(err))
  433. },
  434. async getDetails() {
  435. const [err, res] = await to(projectApi.getDetail({ id: this.addForm.id }))
  436. if (err) return
  437. if (res.code == 200) {
  438. this.projectDetails = res.data
  439. this.addForm = Object.assign(this.addForm, this.projectDetails)
  440. this.addForm.nboType = ''
  441. this.addForm.technicalSupportName = ''
  442. this.addForm.technicalSupportContent = ''
  443. this.addForm.technicalSupportTime = this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')
  444. this.addForm.nboBudgetTime = this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')
  445. this.addForm.remark = ''
  446. }
  447. },
  448. // 选择采购方式
  449. pickModel(e) {
  450. this.addForm.purchasingWay = e.value[0].key
  451. this.addForm.purchasingWayVal = e.value[0].value
  452. this.showChasingWay = false
  453. },
  454. // 经销商
  455. closeDealer(dealer) {
  456. if (dealer) {
  457. console.log(dealer)
  458. this.addForm.distributorId = dealer.id
  459. this.addForm.distributorName = dealer.name
  460. }
  461. },
  462. selectContact() {
  463. if (!this.addForm.custId) {
  464. this.$refs.uNotify.show({
  465. top: this.height + this.paddingTop + 10,
  466. type: 'warning',
  467. message: '请先选择客户',
  468. duration: 1000 * 3,
  469. })
  470. return
  471. }
  472. this.$refs.contact.open(this.addForm.custId)
  473. },
  474. // 关闭选择客户联系人
  475. closeContact(user) {
  476. if (user) {
  477. console.log(user)
  478. this.addForm.makerId = user.id
  479. this.addForm.makerName = user.cuctName
  480. this.addForm.makerDept = user.dept
  481. // this.addForm.makerPost = user.postion
  482. // this.addForm.makerTelephone = user.telephone
  483. }
  484. },
  485. // 技术支持时间
  486. async pickSupportDate(e) {
  487. this.showSupportDate = false
  488. const timeFormat = uni.$u.timeFormat
  489. let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
  490. this.addForm.technicalSupportTime = timeValue
  491. console.log(timeValue)
  492. },
  493. // 项目预算时间
  494. async pickBudgetDate(e) {
  495. this.showBudgetDate = false
  496. const timeFormat = uni.$u.timeFormat
  497. let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
  498. this.addForm.nboBudgetTime = timeValue
  499. console.log(timeValue)
  500. },
  501. // 采购时间
  502. async pickPurchasingDate(e) {
  503. this.showPurchasingDate = false
  504. const timeFormat = uni.$u.timeFormat
  505. let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
  506. this.addForm.purchasingTime = timeValue
  507. console.log(timeValue)
  508. },
  509. handleDowngrade() {
  510. this.$refs.addForm
  511. .validate()
  512. .then(async () => {
  513. this.showModal = true
  514. })
  515. .catch((err) => {
  516. console.log(err)
  517. this.$refs.uNotify.show({
  518. top: this.height + this.paddingTop + 10,
  519. type: 'warning',
  520. message: err[0].message,
  521. duration: 1000 * 3,
  522. })
  523. })
  524. },
  525. async handleDownApi() {
  526. let params = this.addForm
  527. params.nboBudget = Number(params.nboBudget)
  528. const [err, res] = await to(projectApi.upgrade(params))
  529. this.showModal = false
  530. if (err) return
  531. if (res && res.code == 200) {
  532. this.$refs.uToast.show({
  533. type: 'success',
  534. message: '提交成功',
  535. complete: () => {
  536. this.goBack()
  537. },
  538. })
  539. }
  540. },
  541. closeUser(user) {
  542. if (user) {
  543. console.log(user)
  544. this.addForm.userId = user.id
  545. this.addForm.userName = user.label
  546. }
  547. },
  548. goBack() {
  549. uni.navigateBack({
  550. //关闭当前页面,返回上一页面或多级页面。
  551. delta: 1,
  552. })
  553. },
  554. },
  555. }
  556. </script>
  557. <style>
  558. page {
  559. background: #f2f3f5;
  560. }
  561. </style>
  562. <style lang="scss" scoped>
  563. .home {
  564. padding-top: 188rpx;
  565. .nav {
  566. position: absolute;
  567. left: 0;
  568. top: 0;
  569. width: 100%;
  570. height: 284rpx;
  571. background: #3e7ef8;
  572. .title {
  573. position: relative;
  574. text-align: center;
  575. font-size: 32rpx;
  576. font-weight: bold;
  577. color: #ffffff;
  578. .back {
  579. position: absolute;
  580. top: 0;
  581. bottom: 0;
  582. margin: auto;
  583. left: 70rpx;
  584. display: flex;
  585. }
  586. }
  587. }
  588. .main {
  589. position: absolute;
  590. width: 100%;
  591. height: calc(100vh - 188rpx);
  592. background: #ffffff;
  593. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  594. border-radius: 31rpx 31rpx 0 0;
  595. padding: 0 32rpx;
  596. overflow: auto;
  597. padding-bottom: 64rpx;
  598. .form-label {
  599. font-size: 32rpx;
  600. font-weight: bold;
  601. color: #323232;
  602. padding-bottom: 18rpx;
  603. .label-tag {
  604. width: 15rpx;
  605. height: 15rpx;
  606. background: #ff4d4f;
  607. border-radius: 50%;
  608. margin-right: 10rpx;
  609. }
  610. }
  611. .save {
  612. width: 569rpx;
  613. height: 92rpx;
  614. background: #3e7ef8;
  615. border-radius: 31rpx;
  616. margin: 116rpx auto 0;
  617. font-size: 32rpx;
  618. color: #ffffff;
  619. text-align: center;
  620. line-height: 92rpx;
  621. }
  622. }
  623. }
  624. </style>