order.vue 8.3 KB

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