procurement_info.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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="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">¥{{ procurement.price }}</view>
  73. </view>
  74. <view class="unit_sum">
  75. <view class="title">采购数量:</view>
  76. <view class="price">{{ procurement.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="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. }
  205. },
  206. onLoad(options) {
  207. this.userInfo = uni.getStorageSync('userInfo')
  208. this.procurementDetail(options.id)
  209. this.detailId = options.id
  210. this.proTabId = options.proTabId
  211. uni.$on('refreshAddData', id => {
  212. if (id) {
  213. this.procurementDetail(id)
  214. }
  215. })
  216. },
  217. methods: {
  218. // 删除
  219. procurementDelete() {
  220. this.contentModalText = '确定删除该需求吗?'
  221. this.modal = true
  222. this.joinData = $event
  223. },
  224. handleClick($event) {
  225. if ($event.index === 1) {
  226. if (this.joinData.isInvolved === 1) {
  227. // 退出参与
  228. this.procurementUpdate(1)
  229. } else {
  230. // 删除
  231. this.procurementUpdate(0)
  232. }
  233. }
  234. this.modal = false
  235. },
  236. hideMobel() {},
  237. // 关闭底部
  238. handlerPopupClose() {
  239. this.popupShow = false
  240. },
  241. // 我要参与
  242. popupAdd() {
  243. this.joinData = this.procurement
  244. this.popupShow = true
  245. },
  246. // 组件传递商品详情 退出
  247. modelData(proData) {
  248. this.contentModalText = '确定退出参与该需求吗?'
  249. this.modal = true
  250. this.proDataInfo = proData
  251. },
  252. procurementChange(status) {
  253. if (status) {
  254. uni.navigateTo({
  255. url: '/pages/goods/procurementAdd?id=' + this.procurement.id
  256. })
  257. } else {
  258. this.procurementEditData()
  259. }
  260. },
  261. // 详情
  262. async procurementDetail(id) {
  263. try {
  264. const { data } = await this.ProcurementService.procurementDetail({ id: id })
  265. this.procurement = data.procurement
  266. this.procurementList = data.procurementList
  267. this.skeletonShow = false
  268. } catch (error) {
  269. console.log(error)
  270. }
  271. },
  272. // 删除 退出
  273. async procurementUpdate(type) {
  274. const form = {
  275. id: this.detailId,
  276. userId: this.userInfo.userId,
  277. procurementType: type
  278. }
  279. try {
  280. await this.ProcurementService.procurementUpdate(form)
  281. this.procurementDetail(this.detailId)
  282. uni.$emit('refreshAddData') // 刷新修改的数据
  283. uni.showToast({
  284. title: `${type === 0 ? '删除' : '退出'}成功`,
  285. icon: 'success'
  286. })
  287. } catch (error) {
  288. console.log(error)
  289. }
  290. },
  291. // 我要参与
  292. async procurementParticipate() {
  293. if (this.joinData.price === '') {
  294. return this.$util.msg('请输入期望单价', 2000)
  295. }
  296. if (this.joinData.number === '') {
  297. return this.$util.msg('请输入采购数量', 2000)
  298. }
  299. const form = {
  300. userId: this.userInfo.userId,
  301. productImage: this.joinData.productImage,
  302. productName: this.joinData.productName,
  303. price: this.joinData.price,
  304. number: this.joinData.number,
  305. status: 0,
  306. id: this.joinData.id
  307. }
  308. if (this.joinData.isInvolved === 1) {
  309. form.id = this.joinData.sid
  310. form.status = 1 // 0参与 1 修改
  311. }
  312. try {
  313. await this.ProcurementService.procurementParticipate(form)
  314. this.procurementDetail(this.detailId)
  315. uni.$emit('refreshAddData') // 刷新修改的数据
  316. uni.showToast({
  317. title: `${this.procurement.isInvolved === 0 ? '参与' : '修改'}成功`,
  318. icon: 'success'
  319. })
  320. } catch (error) {
  321. console.log(error)
  322. }
  323. },
  324. // 参与集采详情
  325. async procurementEditData() {
  326. const form = {
  327. id: `${this.procurement.sid}`,
  328. userId: this.userInfo.userId,
  329. procurementType: 0
  330. }
  331. try {
  332. const data = await this.ProcurementService.procurementEditData(form)
  333. this.joinData = data.data
  334. this.popupShow = true
  335. } catch (error) {
  336. console.log(error)
  337. }
  338. }
  339. }
  340. }
  341. </script>
  342. <style lang="scss" scoped>
  343. .img {
  344. width: 136rpx;
  345. height: 136rpx;
  346. border: 1px dotted black;
  347. margin-right: 24rpx;
  348. }
  349. .procure_info {
  350. background-color: #f7f7f7;
  351. padding: 24rpx;
  352. }
  353. .procure_info .info_card {
  354. height: 340rpx;
  355. padding: 24rpx;
  356. background-color: #fff;
  357. border-radius: 16rpx 16rpx 16rpx 16rpx;
  358. box-sizing: border-box;
  359. position: relative;
  360. }
  361. .card_title {
  362. color: #333333;
  363. font-size: 32rpx;
  364. font-weight: bold;
  365. }
  366. .card_line {
  367. border: 1rpx solid #e1e1e1;
  368. margin-top: 24rpx;
  369. }
  370. .info_card .card_store {
  371. margin: 40rpx 8px;
  372. padding: 12rpx;
  373. background-color: #f7f7f7;
  374. display: flex;
  375. align-items: center;
  376. border-radius: 8rpx 8rpx 8rpx 8rpx;
  377. }
  378. .info_card .store_title {
  379. width: 442rpx;
  380. font-size: 26rpx;
  381. color: #333333;
  382. line-height: 48rpx;
  383. overflow: hidden;
  384. text-overflow: ellipsis;
  385. display: -webkit-box; // 弹性盒模型
  386. -webkit-box-orient: vertical; // 上下垂直
  387. -webkit-line-clamp: 2; // 行数
  388. }
  389. .procure_info .info_Initiator {
  390. background-color: #fff;
  391. border-radius: 16rpx 16rpx 16rpx 16rpx;
  392. padding: 24rpx;
  393. margin: 24rpx 0;
  394. box-sizing: border-box;
  395. position: relative;
  396. }
  397. .Initiator_contant {
  398. height: 220rpx;
  399. background-color: #f7f7f7;
  400. margin: 40rpx 8rpx 16rpx 8rpx;
  401. border-radius: 8rpx 8rpx 8rpx 8rpx;
  402. padding: 40rpx 24rpx;
  403. box-sizing: border-box;
  404. }
  405. .Initiator_contant .Initiator_name {
  406. display: flex;
  407. align-items: center;
  408. }
  409. .Initiator_contant .Initiator_icon {
  410. width: 96rpx;
  411. height: 40rpx;
  412. line-height: 40rpx;
  413. font-size: 24rpx;
  414. text-align: center;
  415. color: #fff;
  416. background-color: #f3b574;
  417. border-radius: 8rpx;
  418. margin-right: 24rpx;
  419. }
  420. .Initiator_name .user {
  421. color: #333333;
  422. font-size: 32rpx;
  423. font-weight: bold;
  424. }
  425. .Initiator_contant .Initiator_price {
  426. margin-top: 48rpx;
  427. display: flex;
  428. align-items: center;
  429. justify-content: space-between;
  430. }
  431. .Initiator_price .unit_price,
  432. .Initiator_price .unit_sum {
  433. display: flex;
  434. align-items: center;
  435. white-space: nowrap;
  436. }
  437. .title {
  438. color: #999999;
  439. font-size: 26rpx;
  440. font-weight: 400;
  441. }
  442. .price {
  443. color: #333333;
  444. font-size: 26rpx;
  445. }
  446. .info_Participant {
  447. background-color: #fff;
  448. padding: 24rpx;
  449. border-radius: 16rpx;
  450. margin-bottom: 256rpx;
  451. position: relative;
  452. }
  453. .empty {
  454. height: 250rpx;
  455. display: flex;
  456. justify-content: center;
  457. align-items: center;
  458. font-size: 26rpx;
  459. color: #b2b2b2;
  460. }
  461. .info_btn {
  462. position: fixed;
  463. bottom: 0%;
  464. left: 0;
  465. padding: 16rpx 56rpx 84rpx 56rpx;
  466. justify-content: space-between;
  467. display: flex;
  468. align-items: center;
  469. background-color: #fff;
  470. width: 100%;
  471. box-sizing: border-box;
  472. }
  473. .status {
  474. position: absolute;
  475. width: 150rpx;
  476. height: 100rpx;
  477. right: 48rpx;
  478. top: 48rpx;
  479. }
  480. .back-filter {
  481. position: absolute;
  482. left: 0;
  483. top: 0;
  484. background-color: rgba(255, 255, 255, 0.7);
  485. height: 100%;
  486. width: 100%;
  487. }
  488. </style>