procurement.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <view class="proInit">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <view v-else>
  11. <tui-tabs :tabs="tabs" :currentTab="currentTab" @change="handlerTabs" class="tab"></tui-tabs>
  12. <view
  13. class="tabsContent"
  14. v-for="(item, index) in procurementList"
  15. :key="index"
  16. :style="{ marginTop: index === 0 ? '40px' : '' }"
  17. >
  18. <proCard @modelData="modelData" :proTabId='currentTab' :procuretInfo="item" @popupAdd="popupAdd" @popupChange="popupChange" />
  19. </view>
  20. </view>
  21. <!-- 弹窗提示 -->
  22. <tui-modal
  23. :show="modal"
  24. @click="handleClick"
  25. @cancel="hideMobel"
  26. :content="contentModalText"
  27. :button="modalButton"
  28. color="#333"
  29. :size="32"
  30. shape="circle"
  31. :maskClosable="false"
  32. ></tui-modal>
  33. <view class="add_btn" @click="procurementAdd">
  34. <image style="width: 100%;height: 100%;" src="@/static/procurement/add_pro.png"></image>
  35. </view>
  36. <tui-bottom-popup :zIndex="1002" :maskZIndex="1001" :show="popupShow" @close="handlerPopupClose">
  37. <view class="popup_content">
  38. <view class="pro_popup_title">参与需求</view>
  39. <view class="popup_form">
  40. <view class="popup_form_item">商品图片:</view>
  41. <view class="popup_img">
  42. <image style="width: 100%;height: 100%;" src="" mode="aspectFill"></image>
  43. </view>
  44. </view>
  45. <view class="popup_form">
  46. <view class="popup_form_item">商品名称:</view>
  47. <view class="popup_form_name">
  48. 韩国恩盛进口氢洁气小气泡清韩进口氢洁气小气泡清 口氢洁气小气泡清韩进口氢洁气小气泡
  49. </view>
  50. </view>
  51. <form>
  52. <view class="uni-form-item uni-column">
  53. <view class="title">
  54. <text style="font-size: 26rpx;color: #F85050;">*</text>
  55. 期望单价:
  56. </view>
  57. <view style="position: relative;">
  58. <view class="input_icon">¥</view>
  59. <input class="uni-input" focus placeholder="自动获得焦点" />
  60. </view>
  61. </view>
  62. <view class="uni-form-item uni-column">
  63. <view class="title">
  64. <text style="font-size: 26rpx;color: #F85050;">*</text>
  65. 采购数量:
  66. </view>
  67. <view style="position: relative;">
  68. <input class="uni-input" focus placeholder="自动获得焦点" />
  69. </view>
  70. </view>
  71. <view class="submit_btn">
  72. <button class="popup_btn cancel">取消</button>
  73. <button class="popup_btn submit">确定</button>
  74. </view>
  75. </form>
  76. </view>
  77. </tui-bottom-popup>
  78. <view :style="{marginTop: procurementList.length > 0 ? '0' : '88rpx'}">
  79. <!--加载loadding-->
  80. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  81. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text="nomoreText"></tui-nomore>
  82. <!--加载loadding-->
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import proCard from './components/procurement_card.vue'
  88. import jumpMixins from '@/mixins/jumpMixins.js'
  89. import { mapState } from 'vuex'
  90. export default {
  91. components: {
  92. proCard
  93. },
  94. mixins: [jumpMixins],
  95. data() {
  96. return {
  97. skeletonShow: true, // loading
  98. // tab 栏切换
  99. tabs: [
  100. {
  101. name: '全部'
  102. },
  103. {
  104. name: '我参与的'
  105. },
  106. {
  107. name: '我发起的'
  108. }
  109. ],
  110. currentTab: 0, // tab 当前所在栏
  111. modal: false, // 弹窗
  112. contentModalText: '确定退出参与该需求吗?', // 弹窗内容
  113. // 弹窗配置
  114. modalButton: [
  115. {
  116. text: '取消',
  117. type: 'gray',
  118. plain: true //是否空心
  119. },
  120. {
  121. text: '确认',
  122. customStyle: {
  123. color: '#fff',
  124. bgColor: 'linear-gradient(90deg, #F28F31 0%, #F3B574 100%)'
  125. },
  126. plain: false
  127. }
  128. ],
  129. // 组件传递集采需求
  130. proDataInfo: {},
  131. popupShow: false, // 底部上移栏
  132. loadding: true, // 下拉刷新
  133. pullUpOn: true, // 下拉刷新
  134. // 分页参数
  135. pageInfo: {
  136. pageNo: 1,
  137. pageSize: 10
  138. },
  139. // 我参与的数据请求
  140. participate: {
  141. userId: '',
  142. procurementType: 0,
  143. },
  144. // 所有数据
  145. procurementList: [],
  146. // 下拉刷新
  147. nomoreText: '已经被掏空了~',
  148. userInfo: {},
  149. isLastPage: false, // 是否是最后一页
  150. }
  151. },
  152. watch: {
  153. currentTab(val) {
  154. this.loadding = true
  155. this.pullUpOn = true
  156. if (val>0) {
  157. this.participate.procurementType = --val
  158. this.procurementTabChange()
  159. } else {
  160. this.isLastPage = false
  161. this.pageInfo.pageNo = 1
  162. this.procurementAllList()
  163. }
  164. }
  165. },
  166. computed: {
  167. // 是否登录
  168. ...mapState(['hasLogin'])
  169. },
  170. onShow() {
  171. // if (this.hasLogin) {
  172. this.userInfo = uni.getStorageSync('userInfo')
  173. this.pageInfo.userId = this.userInfo.userId
  174. this.participate.userId = this.userInfo.userId
  175. this.procurementAllList()
  176. // } else {
  177. // this.$api.redirectTo('/pages/login/login')
  178. // }
  179. },
  180. onReachBottom() {
  181. this.pageInfo.pageNo+=1
  182. this.procurementAllList()
  183. },
  184. methods: {
  185. // tab 切换
  186. handlerTabs($event) {
  187. this.currentTab = $event.index
  188. },
  189. // 弹窗确认或取消
  190. handleClick($event) {
  191. this.modal = false
  192. if ($event.index === 1) {
  193. }
  194. },
  195. hideMobel($event) {},
  196. // 组件传递商品详情
  197. modelData(proData) {
  198. this.modal = true
  199. this.proDataInfo = proData
  200. },
  201. // 关闭底部
  202. handlerPopupClose() {
  203. this.popupShow = false
  204. },
  205. // 我要参与
  206. popupAdd($event) {
  207. console.log($event)
  208. this.popupShow = true
  209. },
  210. // 修改
  211. popupChange($event) {
  212. uni.navigateTo({
  213. url: '/pages/goods/procurement_info'
  214. })
  215. },
  216. // 发布
  217. procurementAdd() {
  218. uni.navigateTo({
  219. url: '/pages/goods/procurementAdd'
  220. })
  221. },
  222. /**
  223. * 网络请求
  224. */
  225. // 全部集采
  226. async procurementAllList() {
  227. if (!this.isLastPage) {
  228. try {
  229. const {data} = await this.ProcurementService.procurementAllList(this.pageInfo)
  230. this.procurementList = [...this.procurementList, ...data.list]
  231. this.isLastPage = data.isLastPage
  232. this.loadding = !data.isLastPage
  233. this.pullUpOn = !data.isLastPage
  234. this.skeletonShow = false
  235. } catch (error) {
  236. console.log(error)
  237. }
  238. }
  239. },
  240. // 我参与的 | 我发起的
  241. async procurementTabChange() {
  242. try{
  243. const {data} = await this.ProcurementService.procurementTabChange(this.participate)
  244. this.procurementList = data
  245. this.loadding = false
  246. this.pullUpOn = false
  247. this.skeletonShow = false
  248. }catch(error){
  249. console.log(error)
  250. }
  251. },
  252. }
  253. }
  254. </script>
  255. <style lang="scss">
  256. page {
  257. background-color: #f7f7f7;
  258. }
  259. .proInit {
  260. background-color: #f7f7f7;
  261. }
  262. .proInit .tab {
  263. position: fixed;
  264. left: 0;
  265. top: 0;
  266. z-index: 9;
  267. }
  268. ::v-deep .tui-tabs-slider.data-v-9311a734 {
  269. background: #f3b574 !important;
  270. }
  271. ::v-deep .tui-tabs-title.tui-tabs-active {
  272. color: #f3b574 !important;
  273. }
  274. .tabsContent {
  275. background-color: #f7f7f7;
  276. padding: 16rpx 32rpx;
  277. // margin-bottom: 32rpx;
  278. }
  279. .add_btn {
  280. width: 100rpx;
  281. height: 100rpx;
  282. position: fixed;
  283. bottom: 129rpx;
  284. right: 34rpx;
  285. }
  286. .popup_content {
  287. padding: 0 64rpx;
  288. }
  289. .pro_popup_title {
  290. font-size: 32rpx;
  291. font-weight: bold;
  292. color: #333333;
  293. margin: 40rpx auto;
  294. text-align: center;
  295. }
  296. .popup_form {
  297. margin-bottom: 32rpx;
  298. }
  299. .popup_form .popup_form_item {
  300. color: #999999;
  301. font-size: 26rpx;
  302. margin-bottom: 16rpx;
  303. }
  304. .popup_form .popup_img {
  305. width: 136rpx;
  306. height: 136rpx;
  307. border: 1px dotted black;
  308. }
  309. .popup_form .popup_form_name {
  310. color: #333333;
  311. font-size: 26rpx;
  312. font-weight: 400;
  313. line-height: 44rpx;
  314. }
  315. .uni-form-item .title {
  316. color: #999999;
  317. font-size: 26rpx;
  318. margin-bottom: 16rpx;
  319. }
  320. .input_icon {
  321. position: absolute;
  322. left: 15rpx;
  323. top: 24rpx;
  324. color: #b2b2b2;
  325. font-size: 26rpx;
  326. }
  327. .uni-form-item .uni-input {
  328. height: 80rpx;
  329. border: 1px solid #b2b2b2;
  330. border-radius: 6rpx 6rpx 6rpx 6rpx;
  331. font-size: 26rpx;
  332. padding-left: 47rpx;
  333. margin-bottom: 32rpx;
  334. }
  335. .submit_btn {
  336. margin-top: 56rpx;
  337. height: 84rpx;
  338. display: flex;
  339. justify-content: space-between;
  340. align-items: center;
  341. margin-bottom: 50rpx;
  342. }
  343. .submit_btn .popup_btn {
  344. width: 280rpx;
  345. height: 100%;
  346. border-radius: 45rpx 45rpx 45rpx 45rpx;
  347. text-align: center;
  348. line-height: 84rpx;
  349. }
  350. ::v-deep .submit_btn .cancel {
  351. background-color: #fff4e6;
  352. color: #f3b574;
  353. font-size: 32rpx;
  354. }
  355. ::v-deep .submit_btn .submit {
  356. background-color: #f3b574;
  357. color: #ffffff;
  358. font-size: 32rpx;
  359. }
  360. </style>