procurement_info.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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
  16. class="img"
  17. :src="isImageUrl(procurement.productImage) ? imageUrl : procurement.productImage"
  18. mode="aspectFill"
  19. ></image>
  20. <view class="store_title">{{ procurement.productName }}</view>
  21. </view>
  22. <view class="back-filter" v-if="procurementStatus('isDelFlag', procurement.delFlag)"></view>
  23. </view>
  24. <view class="info_Initiator">
  25. <view class="card_title">发起者需求</view>
  26. <view class="card_line"></view>
  27. <view class="Initiator_contant">
  28. <view class="Initiator_name">
  29. <view class="Initiator_icon">发起者</view>
  30. <view class="user">{{ procurement.userName | subText(10) }}</view>
  31. </view>
  32. <view class="Initiator_price">
  33. <view class="unit_price">
  34. <view class="title">期望单价:</view>
  35. <view class="price">¥{{ procurement.price }}</view>
  36. </view>
  37. <view class="unit_sum">
  38. <view class="title">采购数量:</view>
  39. <view class="price">{{ procurement.number }}</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="status">
  44. <image
  45. style="width: 100%;height: 100%;"
  46. src="@/static/procurement/success.png"
  47. mode="aspectFill"
  48. v-if="procurementStatus('isAchieve', procurement.isAchieve)"
  49. ></image>
  50. <image
  51. style="width: 100%;height: 100%;"
  52. src="@/static/procurement/delete.png"
  53. mode="aspectFill"
  54. v-if="procurementStatus('isDelFlag', procurement.delFlag)"
  55. ></image>
  56. </view>
  57. <view class="back-filter" v-if="procurementStatus('isDelFlag', procurement.delFlag)"></view>
  58. </view>
  59. <view class="info_Participant">
  60. <view class="card_title">参与者需求({{ procurementList.length }})</view>
  61. <view class="card_line"></view>
  62. <view v-if="procurementList.length !== 0">
  63. <view
  64. class="Initiator_contant"
  65. v-for="(item, index) in procurementList"
  66. :key="item"
  67. :style="{ margin: index !== 0 ? '24rpx 8rpx 16rpx 8rpx' : '40rpx 8rpx 16rpx 8rpx' }"
  68. >
  69. <view class="Initiator_name">
  70. <view class="Initiator_icon">参与者</view>
  71. <view class="user">{{ item.userName | subText(12) }}</view>
  72. </view>
  73. <view class="Initiator_price">
  74. <view class="unit_price">
  75. <view class="title">期望单价:</view>
  76. <view class="price">¥{{ item.price }}</view>
  77. </view>
  78. <view class="unit_sum">
  79. <view class="title">采购数量:</view>
  80. <view class="price">{{ item.number }}</view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="empty" v-else>暂无参与者~</view>
  86. <view class="back-filter" v-if="procurementStatus('isDelFlag', procurement.delFlag)"></view>
  87. </view>
  88. </view>
  89. <view
  90. v-if="
  91. !procurementStatus('isDelFlag', procurement.delFlag) &&
  92. !procurementStatus('isAchieve', procurement.isAchieve)
  93. "
  94. >
  95. <view
  96. class="info_btn"
  97. v-if="
  98. !procurementStatus('isInvolved', procurement.isInvolved) &&
  99. !procurementStatus('isAdd', procurement.isInvolved)
  100. "
  101. >
  102. <proBtn color="#FFFFFF" background="#F3B574" width="640rpx" @click="popupAdd">我要参与</proBtn>
  103. </view>
  104. <view class="info_btn" v-else>
  105. <proBtn @click="procurementDelete" v-if="procurementStatus('isInvolved', procurement.isInvolved)">
  106. 删除
  107. </proBtn>
  108. <proBtn @click="modelData" v-else>退出</proBtn>
  109. <proBtn
  110. color="#FFFFFF"
  111. background="#F3B574"
  112. @click="procurementChange(procurementStatus('isInvolved', procurement.isInvolved))"
  113. >
  114. 修改
  115. </proBtn>
  116. </view>
  117. </view>
  118. <pro-pupop
  119. :dataObj="joinData"
  120. :isShow="popupShow"
  121. @handlerPopupClose="handlerPopupClose"
  122. @procurementParticipate="procurementParticipate($event, proInfoCallback)"
  123. />
  124. <!-- 弹窗提示 -->
  125. <tui-modal
  126. :show="modal"
  127. @click="handleClick"
  128. @cancel="hideMobel"
  129. :content="contentModalText"
  130. :button="modalButton"
  131. color="#333"
  132. :size="32"
  133. shape="circle"
  134. :maskClosable="false"
  135. ></tui-modal>
  136. </view>
  137. </template>
  138. <script>
  139. import proBtn from './components/procurement-btn.vue'
  140. import procurementMixins from './mixins/procurementMixins.js'
  141. import proPupop from './components/procurement-popup.vue'
  142. export default {
  143. mixins: [procurementMixins],
  144. components: {
  145. proBtn,
  146. proPupop
  147. },
  148. data() {
  149. return {
  150. procurementList: [], // 参与者数量
  151. procurement: {}, // 发起者需求
  152. skeletonShow: true, // loading
  153. modal: false,
  154. contentModalText: '',
  155. // 弹窗配置
  156. modalButton: [
  157. {
  158. text: '取消',
  159. type: 'gray',
  160. plain: true //是否空心
  161. },
  162. {
  163. text: '确认',
  164. customStyle: {
  165. color: '#fff',
  166. bgColor: 'linear-gradient(90deg, #F28F31 0%, #F3B574 100%)'
  167. },
  168. plain: false
  169. }
  170. ],
  171. joinData: {}, // 我要参与
  172. userInfo: {},
  173. popupShow: false, // 底部上移栏
  174. proTabId: '', // tab id
  175. detailId: '', // 详情id
  176. refleshdata: {}
  177. }
  178. },
  179. onLoad(options) {
  180. this.userInfo = uni.getStorageSync('userInfo')
  181. this.procurementDetail(options.id)
  182. this.detailId = options.id
  183. this.proTabId = options.proTabId
  184. uni.$on('refreshAddData', id => {
  185. if (id) {
  186. this.procurementDetail(id)
  187. }
  188. })
  189. },
  190. onPullDownRefresh() {
  191. this.skeletonShow = true
  192. this.procurementDetail(this.detailId)
  193. uni.stopPullDownRefresh()
  194. },
  195. methods: {
  196. // 删除
  197. procurementDelete() {
  198. this.contentModalText = '确定删除该需求吗?'
  199. this.modal = true
  200. },
  201. handleClick($event) {
  202. if ($event.index === 1) {
  203. if (this.procurement.isInvolved === 1) {
  204. // 退出参与
  205. this.procurementUpdate(1, () => this.proInfoCallback())
  206. } else {
  207. // 删除
  208. this.procurementUpdate(0, () => this.proInfoCallback())
  209. }
  210. }
  211. this.modal = false
  212. },
  213. hideMobel() {},
  214. // 关闭底部
  215. handlerPopupClose($event) {
  216. this.popupShow = $event
  217. },
  218. // 我要参与
  219. popupAdd() {
  220. this.joinData = this.procurement
  221. this.popupShow = true
  222. },
  223. // 组件传递商品详情 退出
  224. modelData(proData) {
  225. this.contentModalText = '确定退出参与该需求吗?'
  226. this.modal = true
  227. this.proDataInfo = proData
  228. },
  229. procurementChange(status) {
  230. if (status) {
  231. uni.navigateTo({
  232. url: '/pages/goods/procurementAdd?id=' + this.procurement.id
  233. })
  234. } else {
  235. this.procurementEditData()
  236. }
  237. },
  238. proInfoCallback() {
  239. this.procurementDetail(this.detailId)
  240. uni.$emit('refreshAddData')
  241. },
  242. // 详情
  243. async procurementDetail(id) {
  244. try {
  245. const { data } = await this.ProcurementService.procurementDetail({
  246. id: id,
  247. userId: this.userInfo.userId
  248. })
  249. this.procurement = data.procurement
  250. this.procurementList = data.procurementList
  251. this.skeletonShow = false
  252. } catch (error) {
  253. console.log(error)
  254. }
  255. },
  256. }
  257. }
  258. </script>
  259. <style lang="scss" scoped>
  260. .img {
  261. width: 136rpx;
  262. height: 136rpx;
  263. margin-right: 24rpx;
  264. }
  265. .procure_info {
  266. background-color: #f7f7f7;
  267. padding: 24rpx;
  268. }
  269. .procure_info .info_card {
  270. height: 340rpx;
  271. padding: 24rpx;
  272. background-color: #fff;
  273. border-radius: 16rpx 16rpx 16rpx 16rpx;
  274. box-sizing: border-box;
  275. position: relative;
  276. }
  277. .card_title {
  278. color: #333333;
  279. font-size: 32rpx;
  280. font-weight: bold;
  281. }
  282. .card_line {
  283. border: 1rpx solid #e1e1e1;
  284. margin-top: 24rpx;
  285. }
  286. .info_card .card_store {
  287. margin: 40rpx 8px;
  288. padding: 12rpx;
  289. background-color: #f7f7f7;
  290. display: flex;
  291. align-items: center;
  292. border-radius: 8rpx 8rpx 8rpx 8rpx;
  293. }
  294. .info_card .store_title {
  295. width: 442rpx;
  296. font-size: 26rpx;
  297. color: #333333;
  298. line-height: 48rpx;
  299. overflow: hidden;
  300. text-overflow: ellipsis;
  301. display: -webkit-box; // 弹性盒模型
  302. -webkit-box-orient: vertical; // 上下垂直
  303. -webkit-line-clamp: 2; // 行数
  304. }
  305. .procure_info .info_Initiator {
  306. background-color: #fff;
  307. border-radius: 16rpx 16rpx 16rpx 16rpx;
  308. padding: 24rpx;
  309. margin: 24rpx 0;
  310. box-sizing: border-box;
  311. position: relative;
  312. }
  313. .Initiator_contant {
  314. height: 220rpx;
  315. background-color: #f7f7f7;
  316. margin: 40rpx 8rpx 16rpx 8rpx;
  317. border-radius: 8rpx 8rpx 8rpx 8rpx;
  318. padding: 40rpx 24rpx;
  319. box-sizing: border-box;
  320. }
  321. .Initiator_contant .Initiator_name {
  322. display: flex;
  323. align-items: center;
  324. }
  325. .Initiator_contant .Initiator_icon {
  326. width: 96rpx;
  327. height: 40rpx;
  328. line-height: 40rpx;
  329. font-size: 24rpx;
  330. text-align: center;
  331. color: #fff;
  332. background-color: #f3b574;
  333. border-radius: 8rpx;
  334. margin-right: 24rpx;
  335. }
  336. .Initiator_name .user {
  337. color: #333333;
  338. font-size: 32rpx;
  339. font-weight: bold;
  340. }
  341. .Initiator_contant .Initiator_price {
  342. margin-top: 48rpx;
  343. display: flex;
  344. align-items: center;
  345. justify-content: space-between;
  346. }
  347. .Initiator_price .unit_price,
  348. .Initiator_price .unit_sum {
  349. display: flex;
  350. align-items: center;
  351. white-space: nowrap;
  352. }
  353. .title {
  354. color: #999999;
  355. font-size: 26rpx;
  356. font-weight: 400;
  357. }
  358. .price {
  359. color: #333333;
  360. font-size: 26rpx;
  361. }
  362. .info_Participant {
  363. background-color: #fff;
  364. padding: 24rpx;
  365. border-radius: 16rpx;
  366. margin-bottom: 256rpx;
  367. position: relative;
  368. }
  369. .empty {
  370. height: 250rpx;
  371. display: flex;
  372. justify-content: center;
  373. align-items: center;
  374. font-size: 26rpx;
  375. color: #b2b2b2;
  376. }
  377. .info_btn {
  378. position: fixed;
  379. bottom: 0%;
  380. left: 0;
  381. padding: 16rpx 56rpx 84rpx 56rpx;
  382. justify-content: space-between;
  383. display: flex;
  384. align-items: center;
  385. background-color: #fff;
  386. width: 100%;
  387. box-sizing: border-box;
  388. }
  389. .status {
  390. position: absolute;
  391. width: 150rpx;
  392. height: 100rpx;
  393. right: 48rpx;
  394. top: 48rpx;
  395. }
  396. .back-filter {
  397. position: absolute;
  398. left: 0;
  399. top: 0;
  400. background-color: rgba(255, 255, 255, 0.7);
  401. height: 100%;
  402. width: 100%;
  403. }
  404. </style>