collect.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view class="content">
  3. <view class="tabs hflex acenter jbetween">
  4. <block v-for="(item,index) in tabs" :key="index">
  5. <view class="tabs_item" :class="active == item.id? 'active': ''" @click="changeTabs(item.id)">{{item.text}}</view>
  6. </block>
  7. </view>
  8. <view class="">
  9. <view v-if="active == 1">
  10. <block v-for="(item,index) in pageList" :key="index">
  11. <view class="order_box">
  12. <view class="order_top hflex acenter" @click.stop="toDetail(index)">
  13. <image src="https://ship.shipcc.cn/common/order_type1.png" v-if="item.info.tab == 1" class="order_img"></image>
  14. <image src="https://ship.shipcc.cn/common/order_type2.png" v-if="item.info.tab == 2" class="order_img"></image>
  15. <image src="https://ship.shipcc.cn/common/order_type3.png" v-if="item.info.tab == 3" class="order_img"></image>
  16. <image src="https://ship.shipcc.cn/common/order_type4.png" v-if="item.info.tab == 4" class="order_img"></image>
  17. <view class="order_title">{{item.info.merchant.company}}</view>
  18. </view>
  19. <view class="">
  20. <u-read-more closeText="展开更多" :shadowStyle="shadowStyle" ref="uReadMore" :toggle="true" openText="收起" showHeight="150" backgroundImage="none">
  21. <block v-for="(item2,inx) in item.info.items" :key="inx" @load="load">
  22. <view class="order_item" @click.stop="toDetail(index)">
  23. <view class="item_name">{{item2.name}}</view>
  24. <view class="hflex acenter " v-if="item.info.tab !== 4">
  25. <view class="text_style1 padR-20" >规格:{{item2.spec}}</view>
  26. <view class="text_style1">数量:{{item2.number}}</view>
  27. </view>
  28. <view class="hflex acenter " v-else>
  29. <view class="text_style1">规格/数量:{{item2.weight}}</view>
  30. </view>
  31. </view>
  32. </block>
  33. </u-read-more>
  34. </view>
  35. <view class="hflex acenter jbetween order_bottom" @click.stop="toDetail(index)">
  36. <view class="text_style1">发布时间</view>
  37. <view class="text_style1">{{item.info.create_time}}</view>
  38. </view>
  39. </view>
  40. </block>
  41. </view>
  42. <view v-if="active == 2" style="background-color: #fff;min-height: calc(100vh - 80rpx);">
  43. <block v-for="(item,index) in pageList" :key="index">
  44. <view class="item_box hflex acenter jbetween" @click="toDetail2(item.shipyard.id)">
  45. <view class="img_box">
  46. <image :src="item.shipyard.head_img" class="img"></image>
  47. </view>
  48. <view class="vflex jbetween img_right">
  49. <view class="hflex acenter jbetween" style="padding: ;">
  50. <view class="item_name">{{item.shipyard.name}}</view>
  51. <view class="item_type">{{item.shipyard.pos}}</view>
  52. </view>
  53. <view class="text_style1 text_hide" style="width: 500rpx;">{{item.shipyard.distance}} | {{item.shipyard.address}}</view>
  54. </view>
  55. </view>
  56. </block>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import $api from '@/static/js/api.js'
  63. var that = ''
  64. export default {
  65. data() {
  66. return {
  67. tabs: [
  68. {
  69. id: 1,
  70. text: '采购订单'
  71. },
  72. {
  73. id: 2,
  74. text: '船厂'
  75. },
  76. ],
  77. active: 1,
  78. pageList: [
  79. ],
  80. page: 1,
  81. limit: 15,
  82. total: 1,
  83. shadowStyle: {
  84. backgroundImage: "none",
  85. },
  86. }
  87. },
  88. onLoad() {
  89. that = this
  90. that.getList()
  91. },
  92. methods: {
  93. getList() {
  94. var type = ''
  95. if(that.active == 1) {
  96. type = 3
  97. } else {
  98. type = 5
  99. }
  100. $api.req({
  101. url: '/data/api.auth.Center/mycollection',
  102. method: 'POST',
  103. data: {
  104. page: that.page,
  105. type: type,
  106. longitude: uni.getStorageSync('userLocation') ? uni.getStorageSync('userLocation').split(',')[0] : 116.39966000531004,
  107. latitude: uni.getStorageSync('userLocation') ? uni.getStorageSync('userLocation').split(',')[1] : 39.87879577658584
  108. }
  109. }, function(res) {
  110. if(res.code == 1) {
  111. if(that.page == 1) {
  112. that.pageList = res.data.data
  113. } else {
  114. that.pageList = that.pageList.concat(res.data.data)
  115. }
  116. that.total = res.data.total
  117. that.limit = res.data.per_page
  118. }
  119. })
  120. },
  121. // 切换tabs
  122. changeTabs(id) {
  123. that.active = id
  124. that.page = 1
  125. that.pageList = []
  126. that.getList()
  127. },
  128. load() {
  129. this.$refs.uReadMore.init();
  130. },
  131. toDetail(index) {
  132. var tab = that.pageList[index].info.tab - 1
  133. $api.jump('/page_index/pages/purchase/orderDetail?id=' + that.pageList[index].info.id + '&tab=' + tab)
  134. },
  135. toDetail2(id) {
  136. $api.jump('/pages/tabbar/shipyard/detail?id=' + id)
  137. },
  138. onReachBottom() {
  139. if (Number(that.page) * Number(that.limit) >= Number(that.total)) {
  140. $api.info("没有更多了")
  141. } else {
  142. that.page++
  143. that.getList()
  144. }
  145. }
  146. },
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .content {
  151. background: #F4F4F4;
  152. .tabs {
  153. width: 100%;
  154. background-color: #fff;
  155. box-sizing: border-box;
  156. padding: 14rpx 30rpx;
  157. // margin: 14rpx 0 46rpx;
  158. .tabs_item {
  159. width: 45%;
  160. text-align: center;
  161. font-size: 32rpx;
  162. color: #222;
  163. font-weight: 400;
  164. }
  165. .active {
  166. font-weight: 500;
  167. position: relative;
  168. }
  169. .active::after {
  170. position: absolute;
  171. content: "";
  172. width: 48rpx;
  173. height: 8rpx;
  174. background-color: #506Dff;
  175. border-radius: 4rpx;
  176. bottom: -14rpx;
  177. left: 42%;
  178. }
  179. }
  180. .box {
  181. width: 100%;
  182. background-color: #fff;
  183. box-sizing: border-box;
  184. padding: 14rpx 30rpx;
  185. margin: 20rpx 0 0;
  186. }
  187. .order_box {
  188. width: 100%;
  189. margin: 20rpx 0 ;
  190. background: #FFFFFF;
  191. border-radius: 10px;
  192. box-sizing: border-box;
  193. padding: 28rpx 20rpx;
  194. .order_top {
  195. width: 100%;
  196. /* .order_type {
  197. width: 108rpx;
  198. height: 36rpx;
  199. text-align: center;
  200. line-height: 36rpx;
  201. font-size: 20rpx;
  202. color: #fff;
  203. margin-right: 5rpx;
  204. border-radius: 4rpx;
  205. }
  206. .type1 {
  207. background-color: #506dff;
  208. } */
  209. .order_img {
  210. width: 108rpx;
  211. height: 36rpx;
  212. margin-right: 5rpx;
  213. }
  214. .order_title {
  215. font-size: 32rpx;
  216. font-weight: 500;
  217. color: #222222;
  218. }
  219. }
  220. .order_item {
  221. width: 100%;
  222. padding: 20rpx 0;
  223. border-bottom: 1rpx solid #F4F4F4;
  224. }
  225. .item_name {
  226. font-size: 28rpx;
  227. font-weight: 400;
  228. color: #222222;
  229. padding: 20rpx 0;
  230. }
  231. .order_bottom {
  232. width: 100%;
  233. padding: 20rpx 0 0;
  234. .more {
  235. // width: 140rpx;
  236. // height: 48rpx;
  237. box-sizing: border-box;
  238. padding: 10rpx 20rpx;
  239. border-radius: 24rpx;
  240. border: 1px solid #979797;
  241. font-size: 20rpx;
  242. font-weight: 400;
  243. color: #888888;
  244. }
  245. }
  246. .padR-20 {
  247. padding-right: 20rpx;
  248. }
  249. }
  250. .text_style1 {
  251. font-size: 24rpx;
  252. font-weight: 400;
  253. color: #888888;
  254. }
  255. .item_box {
  256. width: 690rpx;
  257. margin: 0 auto;
  258. padding: 28rpx 0;
  259. border-bottom: 1rpx solid #F4F4F4;
  260. .img_box {
  261. width: 136rpx;
  262. height: 136rpx;
  263. .img {
  264. width: 136rpx;
  265. height: 136rpx;
  266. border-radius: 8rpx;
  267. }
  268. }
  269. .img_right {
  270. width: calc(100% - 136rpx);
  271. height: 136rpx;
  272. padding-left: 20rpx;
  273. .item_name {
  274. font-size: 30rpx;
  275. font-weight: 500;
  276. color: #333333;
  277. line-height: 42rpx;
  278. }
  279. .item_type {
  280. background: #506DFF;
  281. border-radius: 2px;
  282. box-sizing: border-box;
  283. padding: 8rpx 10rpx;
  284. font-size: 20rpx;
  285. font-weight: 400;
  286. color: #FFFFFF;
  287. }
  288. }
  289. }
  290. .item_box:nth-last-child(1) {
  291. border: none;
  292. }
  293. }
  294. </style>