order.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view class="container">
  3. <!--选项卡逻辑自己实现即可,此处未做处理-->
  4. <view :class="{'tui-order-list':scrollTop>=0}">
  5. <view class="tui-order-item" v-for="(item,orderIndex) in orderList" :key="orderIndex">
  6. <tui-list-cell :hover="false" :lineLeft="false">
  7. <view class="tui-goods-title">
  8. <view>订单号:{{item.order_num_alias}}</view>
  9. <view class="tui-order-status">{{item.statusStr}}</view>
  10. </view>
  11. </tui-list-cell>
  12. <block v-if="item.cat_id">
  13. <tui-list-cell padding="0" @click="orderDetail(item.id)">
  14. <view class="tui-goods-item">
  15. <image :src="item.cateMap.image || '/static/images/default_img.png'" class="tui-goods-img"
  16. mode="widthFix"></image>
  17. <view class="tui-goods-center">
  18. <view class="tui-goods-name">{{item.pay_subject}}</view>
  19. <view v-if="item.remark" class="tui-goods-attr">{{item.remark}}</view>
  20. <view v-if="item.realdistance" class="distance">
  21. <image src="/static/images/location_fill.png"
  22. style="margin-right: 10rpx;vertical-align: middle;width:30rpx; height: 30rpx;">
  23. </image>距离:{{item.realdistance}}km
  24. </view>
  25. </view>
  26. <view class="tui-price-right">
  27. <view>x1</view>
  28. </view>
  29. </view>
  30. </tui-list-cell>
  31. </block>
  32. <block v-else-if="item.is_errands==1">
  33. <tui-list-cell padding="0" @click="orderDetail(item.id)">
  34. <view class="tui-goods-item">
  35. <image :src="item.image || '/static/images/default_img.png'" class="tui-goods-img"
  36. mode="widthFix"></image>
  37. <view class="tui-goods-center">
  38. <view class="tui-goods-name">{{item.pay_subject}}</view>
  39. <view v-if="item.remark" class="tui-goods-attr">{{item.remark}}</view>
  40. <view v-if="item.takerealdistance" class="distance">
  41. <image src="/static/images/location_fill.png"
  42. style="margin-right: 10rpx;vertical-align: middle;width:30rpx; height: 30rpx;">
  43. </image>取件:{{item.takerealdistance}}km
  44. </view>
  45. <view v-if="item.realdistance" class="distance">
  46. <image src="/static/images/location_fill.png"
  47. style="margin-right: 10rpx;vertical-align: middle;width:30rpx; height: 30rpx;">
  48. </image>送货:{{item.realdistance}}km
  49. </view>
  50. </view>
  51. <view class="tui-price-right">
  52. <view>x1</view>
  53. </view>
  54. </view>
  55. </tui-list-cell>
  56. </block>
  57. <block v-else>
  58. <block v-for="(goodsitem,index) in item.goodsMap" :key="index">
  59. <tui-list-cell padding="0" @click="orderDetail(item.id)">
  60. <view class="tui-goods-item">
  61. <image :src="goodsitem.image" mode="widthFix" class="tui-goods-img"></image>
  62. <view class="tui-goods-center">
  63. <view class="tui-goods-name">{{goodsitem.name}}</view>
  64. <view v-if="goodsitem.label" class="tui-goods-attr">{{goodsitem.label}}</view>
  65. <view v-if="index==0 && item.realdistance" class="distance">
  66. <image src="/static/images/location_fill.png"
  67. style="margin-right: 10rpx;vertical-align: middle;width:30rpx; height: 30rpx;">
  68. </image>距离:{{item.realdistance}}km
  69. </view>
  70. </view>
  71. <view class="tui-price-right">
  72. <view>¥{{goodsitem.price}}</view>
  73. <view>x{{goodsitem.quantity}}</view>
  74. </view>
  75. </view>
  76. </tui-list-cell>
  77. </block>
  78. </block>
  79. <tui-list-cell :hover="false" unlined>
  80. <view class="tui-goods-price">
  81. <view>
  82. <!--共4件商品--> 合计:
  83. </view>
  84. <view class="tui-size-24">¥</view>
  85. <view class="tui-price-large">{{item.total}}</view>
  86. <view class="tui-size-24"></view>
  87. </view>
  88. </tui-list-cell>
  89. <view class="tui-order-btn">
  90. <view class="tui-btn-ml">
  91. <tui-button @click="orderDetail(item.id)" width="152rpx" height="56rpx" :size="26"
  92. shape="circle">抢单</tui-button>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <!--加载loadding-->
  98. <tui-loadmore v-if="loadding" :index="3" type="red"></tui-loadmore>
  99. <tui-nomore v-if="!pullUpOn" backgroundColor="#fafafa"></tui-nomore>
  100. <!--加载loadding-->
  101. <tui-tabbar :mo="identity" :current="current">
  102. </tui-tabbar>
  103. </view>
  104. </template>
  105. <script>
  106. export default {
  107. data() {
  108. return {
  109. ptype: 2,
  110. pageIndex: 1,
  111. identity: "technical",
  112. loadding: false,
  113. pullUpOn: true,
  114. scrollTop: 0,
  115. orderList: [],
  116. where: {
  117. status: 0,
  118. ptype: 0,
  119. keyword: '',
  120. page: 1,
  121. limit: 10,
  122. latitude: "",
  123. longitude: ""
  124. },
  125. }
  126. },
  127. onLoad: function(e) {
  128. if (e.identity) {
  129. this.identity = e.identity;
  130. }
  131. },
  132. onShow: function(e) {
  133. var _this = this
  134. wx.authorize({
  135. scope: 'scope.userFuzzyLocation',
  136. success: res => {
  137. wx.getFuzzyLocation({
  138. type: 'wgs84',
  139. success (res) {
  140. //console.log(res);
  141. _this.where.longitude = res.longitude;
  142. _this.where.latitude = res.latitude;
  143. _this.getorderlist(true);
  144. }
  145. });
  146. },
  147. fail: res => {
  148. //console.log('失败:', res);
  149. }
  150. });
  151. },
  152. methods: {
  153. getorderlist: function(isPage) {
  154. var _this = this
  155. if (_this.loadend) return;
  156. if (_this.loading) return;
  157. if (isPage === true) {
  158. _this.where.page = 1;
  159. _this.orderList = [];
  160. } else {
  161. if (_this.loadend) return;
  162. }
  163. _this.where.samkey = (new Date()).valueOf();
  164. _this.where.ptype = _this.ptype;
  165. _this.where.identity = _this.identity;
  166. _this.$request.post('order.publicorder', _this.where).then(res => {
  167. if (res.errno == 0) {
  168. _this.orderList = _this.orderList.concat(res.data.data);
  169. _this.loadend = _this.orderList.length < _this.where.limit;
  170. _this.loading = false;
  171. _this.where.page = _this.where.page + 1
  172. }
  173. })
  174. },
  175. orderDetail: function(orderid) {
  176. var url = '/pagesA/my/publicOrder/yuyueDetail?id=' + orderid + '&identity=' + this.identity;
  177. uni.navigateTo({
  178. url: url
  179. })
  180. },
  181. },
  182. /**
  183. * 页面相关事件处理函数--监听用户下拉动作
  184. */
  185. onPullDownRefresh: function() {
  186. this.where.page = 1;
  187. this.loadend = false;
  188. this.orderList = [];
  189. this.getorderlist();
  190. setTimeout(() => {
  191. uni.stopPullDownRefresh()
  192. }, 200);
  193. },
  194. /**
  195. * 页面上拉触底事件的处理函数
  196. */
  197. onReachBottom() {
  198. //只是测试效果,逻辑以实际数据为准
  199. this.loadding = true
  200. this.pullUpOn = true
  201. this.getorderlist();
  202. setTimeout(() => {
  203. this.loadding = false
  204. this.pullUpOn = false
  205. }, 1000)
  206. },
  207. onPageScroll(e) {
  208. this.scrollTop = e.scrollTop;
  209. }
  210. }
  211. </script>
  212. <style>
  213. .container {
  214. padding-bottom: env(safe-area-inset-bottom);
  215. }
  216. .tui-order-list {
  217. margin-top: 0rpx;
  218. }
  219. .tui-order-item {
  220. margin-top: 20rpx;
  221. border-radius: 10rpx;
  222. overflow: hidden;
  223. }
  224. .tui-goods-title {
  225. width: 100%;
  226. font-size: 28rpx;
  227. display: flex;
  228. align-items: center;
  229. justify-content: space-between;
  230. }
  231. .tui-order-status {
  232. color: #888;
  233. font-size: 26rpx;
  234. }
  235. .tui-goods-item {
  236. width: 100%;
  237. padding: 20rpx 30rpx;
  238. box-sizing: border-box;
  239. display: flex;
  240. justify-content: space-between;
  241. }
  242. .tui-goods-img {
  243. width: 180rpx;
  244. height: 180rpx;
  245. display: block;
  246. flex-shrink: 0;
  247. }
  248. .tui-goods-center {
  249. flex: 1;
  250. padding: 20rpx 8rpx;
  251. box-sizing: border-box;
  252. }
  253. .tui-goods-name {
  254. max-width: 310rpx;
  255. word-break: break-all;
  256. overflow: hidden;
  257. text-overflow: ellipsis;
  258. display: -webkit-box;
  259. -webkit-box-orient: vertical;
  260. -webkit-line-clamp: 2;
  261. font-size: 26rpx;
  262. line-height: 32rpx;
  263. }
  264. .distance {
  265. font-size: 26rpx;
  266. color: #333333;
  267. line-height: 32rpx;
  268. padding-top: 20rpx;
  269. word-break: break-all;
  270. overflow: hidden;
  271. text-overflow: ellipsis;
  272. display: -webkit-box;
  273. -webkit-box-orient: vertical;
  274. -webkit-line-clamp: 2;
  275. }
  276. .tui-goods-attr {
  277. font-size: 22rpx;
  278. color: #888888;
  279. line-height: 32rpx;
  280. padding-top: 20rpx;
  281. word-break: break-all;
  282. overflow: hidden;
  283. text-overflow: ellipsis;
  284. display: -webkit-box;
  285. -webkit-box-orient: vertical;
  286. -webkit-line-clamp: 2;
  287. }
  288. .tui-price-right {
  289. text-align: right;
  290. font-size: 24rpx;
  291. color: #888888;
  292. line-height: 30rpx;
  293. padding-top: 20rpx;
  294. }
  295. .tui-color-red {
  296. color: #E41F19;
  297. padding-right: 30rpx;
  298. }
  299. .tui-goods-price {
  300. width: 100%;
  301. display: flex;
  302. align-items: flex-end;
  303. justify-content: flex-end;
  304. font-size: 24rpx;
  305. }
  306. .tui-size-24 {
  307. font-size: 24rpx;
  308. line-height: 24rpx;
  309. }
  310. .tui-price-large {
  311. font-size: 32rpx;
  312. line-height: 30rpx;
  313. font-weight: 500;
  314. }
  315. .tui-order-btn {
  316. width: 100%;
  317. display: flex;
  318. align-items: center;
  319. justify-content: flex-end;
  320. background: #fff;
  321. padding: 10rpx 30rpx 20rpx;
  322. box-sizing: border-box;
  323. }
  324. .tui-btn-ml {
  325. margin-left: 20rpx;
  326. }
  327. </style>