procurement_info.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <template>
  2. <view style="background-color: #fff;position: relative;">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <view class="procure_info" v-else>
  11. <view class="info_card">
  12. <view class="card_title">采购商品</view>
  13. <view class="card_line"></view>
  14. <view class="card_store">
  15. <image class="img" :src="isImageUrl(procurement.productImage) ? imageUrl : procurement.productImage" mode="aspectFill"></image>
  16. <view class="store_title">{{ procurement.productName }}</view>
  17. </view>
  18. <view class="back-filter" v-if="procurementStatus('isDelFlag', procurement.delFlag)"></view>
  19. </view>
  20. <view class="info_Initiator">
  21. <view class="card_title">发起者需求</view>
  22. <view class="card_line"></view>
  23. <view class="Initiator_contant">
  24. <view class="Initiator_name">
  25. <view class="Initiator_icon">发起者</view>
  26. <view class="user">{{ procurement.userName | subText(10) }}</view>
  27. </view>
  28. <view class="Initiator_price">
  29. <view class="unit_price">
  30. <view class="title">期望单价:</view>
  31. <view class="price">¥{{ procurement.price }}</view>
  32. </view>
  33. <view class="unit_sum">
  34. <view class="title">采购数量:</view>
  35. <view class="price">{{ procurement.number }}</view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="status">
  40. <image
  41. style="width: 100%;height: 100%;"
  42. src="@/static/procurement/success.png"
  43. mode="aspectFill"
  44. v-if="procurementStatus('isAchieve', procurement.isAchieve)"
  45. ></image>
  46. <image
  47. style="width: 100%;height: 100%;"
  48. src="@/static/procurement/delete.png"
  49. mode="aspectFill"
  50. v-if="procurementStatus('isDelFlag', procurement.delFlag)"
  51. ></image>
  52. </view>
  53. <view class="back-filter" v-if="procurementStatus('isDelFlag', procurement.delFlag)"></view>
  54. </view>
  55. <view class="info_Participant">
  56. <view class="card_title">参与者需求({{ procurementList.length }})</view>
  57. <view class="card_line"></view>
  58. <view v-if="procurementList.length !== 0">
  59. <view
  60. class="Initiator_contant"
  61. v-for="(item, index) in procurementList"
  62. :key="item"
  63. :style="{ margin: index !== 0 ? '24rpx 8rpx 16rpx 8rpx' : '40rpx 8rpx 16rpx 8rpx' }"
  64. >
  65. <view class="Initiator_name">
  66. <view class="Initiator_icon">参与者</view>
  67. <view class="user">{{ item.userName | subText(12) }}</view>
  68. </view>
  69. <view class="Initiator_price">
  70. <view class="unit_price">
  71. <view class="title">期望单价:</view>
  72. <view class="price">¥{{ item.price }}</view>
  73. </view>
  74. <view class="unit_sum">
  75. <view class="title">采购数量:</view>
  76. <view class="price">{{ item.number }}</view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="empty" v-else>暂无参与者~</view>
  82. <view class="back-filter" v-if="procurementStatus('isDelFlag', procurement.delFlag)"></view>
  83. </view>
  84. </view>
  85. <view
  86. v-if="
  87. !procurementStatus('isDelFlag', procurement.delFlag) &&
  88. !procurementStatus('isAchieve', procurement.isAchieve)
  89. "
  90. >
  91. <view
  92. class="info_btn"
  93. v-if="
  94. !procurementStatus('isInvolved', procurement.isInvolved) &&
  95. !procurementStatus('isAdd', procurement.isInvolved)
  96. "
  97. >
  98. <proBtn color="#FFFFFF" background="#F3B574" width="640rpx" @click="popupAdd">我要参与</proBtn>
  99. </view>
  100. <view class="info_btn" v-else>
  101. <proBtn @click="procurementDelete" v-if="procurementStatus('isInvolved', procurement.isInvolved)">
  102. 删除
  103. </proBtn>
  104. <proBtn @click="modelData" v-else>退出</proBtn>
  105. <proBtn
  106. color="#FFFFFF"
  107. background="#F3B574"
  108. @click="procurementChange(procurementStatus('isInvolved', procurement.isInvolved))"
  109. >
  110. 修改
  111. </proBtn>
  112. </view>
  113. </view>
  114. <tui-bottom-popup :zIndex="1002" :maskZIndex="1001" :show="popupShow" @close="handlerPopupClose">
  115. <view class="popup_content">
  116. <view class="pro_popup_title">参与需求</view>
  117. <view class="popup_form">
  118. <view class="popup_form_item">商品图片:</view>
  119. <view class="popup_img">
  120. <image style="width: 100%;height: 100%;" :src="isImageUrl(joinData.productImage) ? imageUrl : joinData.productImage" mode="aspectFill"></image>
  121. </view>
  122. </view>
  123. <view class="popup_form">
  124. <view class="popup_form_item">商品名称:</view>
  125. <view class="popup_form_name">{{ joinData.productName }}</view>
  126. </view>
  127. <form>
  128. <view class="uni-form-item uni-column">
  129. <view class="title">
  130. <text style="font-size: 26rpx;color: #F85050;">*</text>
  131. 期望单价:
  132. </view>
  133. <view style="position: relative;">
  134. <view class="input_icon">¥</view>
  135. <input class="uni-input" type="number" focus v-model="joinData.price" />
  136. </view>
  137. </view>
  138. <view class="uni-form-item uni-column">
  139. <view class="title">
  140. <text style="font-size: 26rpx;color: #F85050;">*</text>
  141. 采购数量:
  142. </view>
  143. <view style="position: relative;">
  144. <input class="uni-input" type="number" focus v-model="joinData.number" />
  145. </view>
  146. </view>
  147. <view class="submit_btn">
  148. <button class="popup_btn cancel" @click="handlerPopupClose">取消</button>
  149. <button class="popup_btn submit" @click="procurementParticipate">确定</button>
  150. </view>
  151. </form>
  152. </view>
  153. </tui-bottom-popup>
  154. <!-- 弹窗提示 -->
  155. <tui-modal
  156. :show="modal"
  157. @click="handleClick"
  158. @cancel="hideMobel"
  159. :content="contentModalText"
  160. :button="modalButton"
  161. color="#333"
  162. :size="32"
  163. shape="circle"
  164. :maskClosable="false"
  165. ></tui-modal>
  166. </view>
  167. </template>
  168. <script>
  169. import proBtn from './components/procurement-btn.vue'
  170. import procurementMixins from './mixins/procurementMixins.js'
  171. export default {
  172. mixins: [procurementMixins],
  173. components: {
  174. proBtn
  175. },
  176. data() {
  177. return {
  178. procurementList: [], // 参与者数量
  179. procurement: {}, // 发起者需求
  180. skeletonShow: true, // loading
  181. modal: false,
  182. contentModalText: '',
  183. // 弹窗配置
  184. modalButton: [
  185. {
  186. text: '取消',
  187. type: 'gray',
  188. plain: true //是否空心
  189. },
  190. {
  191. text: '确认',
  192. customStyle: {
  193. color: '#fff',
  194. bgColor: 'linear-gradient(90deg, #F28F31 0%, #F3B574 100%)'
  195. },
  196. plain: false
  197. }
  198. ],
  199. joinData: {}, // 我要参与
  200. userInfo: {},
  201. popupShow: false, // 底部上移栏
  202. proTabId: '', // tab id
  203. detailId: '', // 详情id
  204. refleshdata: {},
  205. }
  206. },
  207. onLoad(options) {
  208. this.userInfo = uni.getStorageSync('userInfo')
  209. this.procurementDetail(options.id)
  210. this.detailId = options.id
  211. this.proTabId = options.proTabId
  212. uni.$on('refreshAddData', id => {
  213. if (id) {
  214. this.procurementDetail(id)
  215. }
  216. })
  217. },
  218. onPullDownRefresh() {
  219. this.skeletonShow = true
  220. this.procurementDetail(this.detailId)
  221. uni.stopPullDownRefresh()
  222. },
  223. methods: {
  224. // 删除
  225. procurementDelete() {
  226. this.contentModalText = '确定删除该需求吗?'
  227. this.modal = true
  228. this.joinData = $event
  229. },
  230. handleClick($event) {
  231. if ($event.index === 1) {
  232. if (this.procurement.isInvolved === 1) {
  233. // 退出参与
  234. this.procurementUpdate(1)
  235. } else {
  236. // 删除
  237. this.procurementUpdate(0)
  238. }
  239. }
  240. this.modal = false
  241. },
  242. hideMobel() {},
  243. // 关闭底部
  244. handlerPopupClose() {
  245. this.popupShow = false
  246. },
  247. // 我要参与
  248. popupAdd() {
  249. this.joinData = this.procurement
  250. this.popupShow = true
  251. },
  252. // 组件传递商品详情 退出
  253. modelData(proData) {
  254. this.contentModalText = '确定退出参与该需求吗?'
  255. this.modal = true
  256. this.proDataInfo = proData
  257. },
  258. procurementChange(status) {
  259. if (status) {
  260. uni.navigateTo({
  261. url: '/pages/goods/procurementAdd?id=' + this.procurement.id
  262. })
  263. } else {
  264. this.procurementEditData()
  265. }
  266. },
  267. // 详情
  268. async procurementDetail(id) {
  269. try {
  270. const { data } = await this.ProcurementService.procurementDetail({ id: id, userId: this.userInfo.userId })
  271. this.procurement = data.procurement
  272. this.procurementList = data.procurementList
  273. this.skeletonShow = false
  274. } catch (error) {
  275. console.log(error)
  276. }
  277. },
  278. // 删除 退出
  279. async procurementUpdate(type) {
  280. const form = {
  281. id: type === 0 ? this.detailId : this.procurement.sid,
  282. userId: this.userInfo.userId,
  283. procurementType: type
  284. }
  285. try {
  286. await this.ProcurementService.procurementUpdate(form)
  287. this.procurementDetail(this.detailId)
  288. uni.$emit('refreshAddData') // 刷新修改的数据
  289. uni.showToast({
  290. title: `${type === 0 ? '删除' : '退出'}成功`,
  291. icon: 'success'
  292. })
  293. } catch (error) {
  294. console.log(error)
  295. }
  296. },
  297. // 我要参与
  298. async procurementParticipate() {
  299. if (this.joinData.price === '') {
  300. return this.$util.msg('请输入期望单价', 2000)
  301. }
  302. if (this.joinData.number === '') {
  303. return this.$util.msg('请输入采购数量', 2000)
  304. }
  305. const form = {
  306. userId: this.userInfo.userId,
  307. productImage: this.joinData.productImage,
  308. productName: this.joinData.productName,
  309. price: this.joinData.price,
  310. number: this.joinData.number,
  311. status: 0,
  312. id: this.joinData.id,
  313. userName: this.userInfo.name
  314. }
  315. if (this.joinData.isInvolved === 1) {
  316. form.id = this.joinData.id
  317. form.status = 1 // 0参与 1 修改
  318. }
  319. try {
  320. await this.ProcurementService.procurementParticipate(form)
  321. this.procurementDetail(this.detailId)
  322. this.popupShow = false
  323. uni.$emit('refreshAddData') // 刷新修改的数据
  324. uni.showToast({
  325. title: `${this.procurement.isInvolved === 0 ? '参与' : '修改'}成功`,
  326. icon: 'success'
  327. })
  328. } catch (error) {
  329. console.log(error)
  330. }
  331. },
  332. // 参与集采详情
  333. async procurementEditData() {
  334. const form = {
  335. id: `${this.procurement.sid}`,
  336. userId: this.userInfo.userId,
  337. procurementType: 0
  338. }
  339. try {
  340. const {data} = await this.ProcurementService.procurementEditData(form)
  341. this.joinData = data
  342. this.popupShow = true
  343. } catch (error) {
  344. console.log(error)
  345. }
  346. }
  347. }
  348. }
  349. </script>
  350. <style lang="scss" scoped>
  351. .img {
  352. width: 136rpx;
  353. height: 136rpx;
  354. margin-right: 24rpx;
  355. }
  356. .procure_info {
  357. background-color: #f7f7f7;
  358. padding: 24rpx;
  359. }
  360. .procure_info .info_card {
  361. height: 340rpx;
  362. padding: 24rpx;
  363. background-color: #fff;
  364. border-radius: 16rpx 16rpx 16rpx 16rpx;
  365. box-sizing: border-box;
  366. position: relative;
  367. }
  368. .card_title {
  369. color: #333333;
  370. font-size: 32rpx;
  371. font-weight: bold;
  372. }
  373. .card_line {
  374. border: 1rpx solid #e1e1e1;
  375. margin-top: 24rpx;
  376. }
  377. .info_card .card_store {
  378. margin: 40rpx 8px;
  379. padding: 12rpx;
  380. background-color: #f7f7f7;
  381. display: flex;
  382. align-items: center;
  383. border-radius: 8rpx 8rpx 8rpx 8rpx;
  384. }
  385. .info_card .store_title {
  386. width: 442rpx;
  387. font-size: 26rpx;
  388. color: #333333;
  389. line-height: 48rpx;
  390. overflow: hidden;
  391. text-overflow: ellipsis;
  392. display: -webkit-box; // 弹性盒模型
  393. -webkit-box-orient: vertical; // 上下垂直
  394. -webkit-line-clamp: 2; // 行数
  395. }
  396. .procure_info .info_Initiator {
  397. background-color: #fff;
  398. border-radius: 16rpx 16rpx 16rpx 16rpx;
  399. padding: 24rpx;
  400. margin: 24rpx 0;
  401. box-sizing: border-box;
  402. position: relative;
  403. }
  404. .Initiator_contant {
  405. height: 220rpx;
  406. background-color: #f7f7f7;
  407. margin: 40rpx 8rpx 16rpx 8rpx;
  408. border-radius: 8rpx 8rpx 8rpx 8rpx;
  409. padding: 40rpx 24rpx;
  410. box-sizing: border-box;
  411. }
  412. .Initiator_contant .Initiator_name {
  413. display: flex;
  414. align-items: center;
  415. }
  416. .Initiator_contant .Initiator_icon {
  417. width: 96rpx;
  418. height: 40rpx;
  419. line-height: 40rpx;
  420. font-size: 24rpx;
  421. text-align: center;
  422. color: #fff;
  423. background-color: #f3b574;
  424. border-radius: 8rpx;
  425. margin-right: 24rpx;
  426. }
  427. .Initiator_name .user {
  428. color: #333333;
  429. font-size: 32rpx;
  430. font-weight: bold;
  431. }
  432. .Initiator_contant .Initiator_price {
  433. margin-top: 48rpx;
  434. display: flex;
  435. align-items: center;
  436. justify-content: space-between;
  437. }
  438. .Initiator_price .unit_price,
  439. .Initiator_price .unit_sum {
  440. display: flex;
  441. align-items: center;
  442. white-space: nowrap;
  443. }
  444. .title {
  445. color: #999999;
  446. font-size: 26rpx;
  447. font-weight: 400;
  448. }
  449. .price {
  450. color: #333333;
  451. font-size: 26rpx;
  452. }
  453. .info_Participant {
  454. background-color: #fff;
  455. padding: 24rpx;
  456. border-radius: 16rpx;
  457. margin-bottom: 256rpx;
  458. position: relative;
  459. }
  460. .empty {
  461. height: 250rpx;
  462. display: flex;
  463. justify-content: center;
  464. align-items: center;
  465. font-size: 26rpx;
  466. color: #b2b2b2;
  467. }
  468. .info_btn {
  469. position: fixed;
  470. bottom: 0%;
  471. left: 0;
  472. padding: 16rpx 56rpx 84rpx 56rpx;
  473. justify-content: space-between;
  474. display: flex;
  475. align-items: center;
  476. background-color: #fff;
  477. width: 100%;
  478. box-sizing: border-box;
  479. }
  480. .status {
  481. position: absolute;
  482. width: 150rpx;
  483. height: 100rpx;
  484. right: 48rpx;
  485. top: 48rpx;
  486. }
  487. .back-filter {
  488. position: absolute;
  489. left: 0;
  490. top: 0;
  491. background-color: rgba(255, 255, 255, 0.7);
  492. height: 100%;
  493. width: 100%;
  494. }
  495. .popup_content {
  496. padding: 0 64rpx;
  497. }
  498. .pro_popup_title {
  499. font-size: 32rpx;
  500. font-weight: bold;
  501. color: #333333;
  502. margin: 40rpx auto;
  503. text-align: center;
  504. }
  505. .popup_form {
  506. margin-bottom: 32rpx;
  507. }
  508. .popup_form .popup_form_item {
  509. color: #999999;
  510. font-size: 26rpx;
  511. margin-bottom: 16rpx;
  512. }
  513. .popup_form .popup_img {
  514. width: 136rpx;
  515. height: 136rpx;
  516. }
  517. .popup_form .popup_form_name {
  518. color: #333333;
  519. font-size: 26rpx;
  520. font-weight: 400;
  521. line-height: 44rpx;
  522. }
  523. .uni-form-item .title {
  524. color: #999999;
  525. font-size: 26rpx;
  526. margin-bottom: 16rpx;
  527. }
  528. .input_icon {
  529. position: absolute;
  530. left: 15rpx;
  531. top: 24rpx;
  532. color: #b2b2b2;
  533. font-size: 26rpx;
  534. }
  535. .uni-form-item .uni-input {
  536. height: 80rpx;
  537. border: 1px solid #b2b2b2;
  538. border-radius: 6rpx 6rpx 6rpx 6rpx;
  539. font-size: 26rpx;
  540. padding-left: 47rpx;
  541. margin-bottom: 32rpx;
  542. }
  543. .submit_btn {
  544. margin-top: 56rpx;
  545. height: 84rpx;
  546. display: flex;
  547. justify-content: space-between;
  548. align-items: center;
  549. margin-bottom: 50rpx;
  550. }
  551. .submit_btn .popup_btn {
  552. width: 280rpx;
  553. height: 100%;
  554. border-radius: 45rpx 45rpx 45rpx 45rpx;
  555. text-align: center;
  556. line-height: 84rpx;
  557. }
  558. ::v-deep .submit_btn .cancel {
  559. background-color: #fff4e6;
  560. color: #f3b574;
  561. font-size: 32rpx;
  562. }
  563. ::v-deep .submit_btn .submit {
  564. background-color: #f3b574;
  565. color: #ffffff;
  566. font-size: 32rpx;
  567. }
  568. </style>