timescard.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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="Detail(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="Detail(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="Detail(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="Detail(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": 7,
  113. "name": "已完成",
  114. }],
  115. ptype: 2,
  116. currentType: 0,
  117. currentTab: 0,
  118. pageIndex: 1,
  119. loadding: false,
  120. pullUpOn: true,
  121. scrollTop: 0,
  122. orderList: [],
  123. where: {
  124. status: 0,
  125. ptype:0,
  126. keyword: '',
  127. is_times:1,
  128. page: 1,
  129. limit: 10,
  130. },
  131. }
  132. },
  133. onLoad: function(e) {
  134. let _this = this
  135. if(e.currentTab){
  136. _this.currentTab = e.currentTab;
  137. }
  138. _this.currentType = _this.statusType[_this.currentTab].id;
  139. },
  140. onShow: function(e) {
  141. this.getorderlist(true);
  142. },
  143. methods: {
  144. statusTap: function(e) {
  145. this.currentTab = e.index
  146. this.currentType = this.statusType[this.currentTab].id;
  147. this.loadend = false;
  148. this.loading = false;
  149. this.where.page = 1;
  150. this.getorderlist(true);
  151. },
  152. getorderlist: function(isPage) {
  153. var _this = this
  154. console.log(_this.loadend);
  155. if (_this.loading) return;
  156. if (isPage === true) {
  157. _this.where.page = 1;
  158. _this.orderList = [];
  159. }else{
  160. if (_this.loadend) return;
  161. }
  162. _this.where.samkey = (new Date()).valueOf();
  163. _this.where.ptype = _this.ptype;
  164. _this.where.status = _this.currentType;
  165. _this.where.currentTab = _this.currentTab;
  166. //console.log(_this.where);
  167. _this.$request.post('order.technicalorder', _this.where).then(res => {
  168. if (res.errno == 0) {
  169. _this.orderList = _this.orderList.concat(res.data.data);
  170. _this.where.page = _this.where.page + 1
  171. _this.loadend = _this.orderList.length < _this.where.limit;
  172. }
  173. _this.loading = false;
  174. })
  175. },
  176. Detail: function(orderid) {
  177. var url = '/pagesA/my/publicOrder/timescardDetail?id=' + orderid;
  178. uni.navigateTo({
  179. url: url
  180. })
  181. },
  182. },
  183. /**
  184. * 页面相关事件处理函数--监听用户下拉动作
  185. */
  186. onPullDownRefresh: function() {
  187. this.where.page = 1;
  188. this.loadend = false;
  189. this.orderList = [];
  190. this.getorderlist();
  191. setTimeout(() => {
  192. uni.stopPullDownRefresh()
  193. }, 200);
  194. },
  195. /**
  196. * 页面上拉触底事件的处理函数
  197. */
  198. onReachBottom() {
  199. //只是测试效果,逻辑以实际数据为准
  200. this.loadding = true
  201. this.pullUpOn = true
  202. this.getorderlist();
  203. setTimeout(() => {
  204. this.loadding = false
  205. this.pullUpOn = false
  206. }, 1000)
  207. },
  208. onPageScroll(e) {
  209. this.scrollTop = e.scrollTop;
  210. }
  211. }
  212. </script>
  213. <style>
  214. .container {
  215. padding-bottom: env(safe-area-inset-bottom);
  216. }
  217. .tui-order-list {
  218. margin-top: 80rpx;
  219. }
  220. .tui-order-item {
  221. margin-top: 20rpx;
  222. border-radius: 10rpx;
  223. overflow: hidden;
  224. }
  225. .tui-goods-title {
  226. width: 100%;
  227. font-size: 28rpx;
  228. display: flex;
  229. align-items: center;
  230. justify-content: space-between;
  231. }
  232. .tui-order-status {
  233. color: #888;
  234. font-size: 26rpx;
  235. }
  236. .tui-goods-item {
  237. width: 100%;
  238. padding: 20rpx 30rpx;
  239. box-sizing: border-box;
  240. display: flex;
  241. justify-content: space-between;
  242. }
  243. .tui-goods-img {
  244. width: 180rpx;
  245. height: 180rpx;
  246. display: block;
  247. flex-shrink: 0;
  248. }
  249. .tui-goods-center {
  250. flex: 1;
  251. padding: 20rpx 8rpx;
  252. box-sizing: border-box;
  253. }
  254. .tui-goods-name {
  255. max-width: 310rpx;
  256. word-break: break-all;
  257. overflow: hidden;
  258. text-overflow: ellipsis;
  259. display: -webkit-box;
  260. -webkit-box-orient: vertical;
  261. -webkit-line-clamp: 2;
  262. font-size: 26rpx;
  263. line-height: 32rpx;
  264. }
  265. .tui-goods-attr {
  266. font-size: 22rpx;
  267. color: #888888;
  268. line-height: 32rpx;
  269. padding-top: 20rpx;
  270. word-break: break-all;
  271. overflow: hidden;
  272. text-overflow: ellipsis;
  273. display: -webkit-box;
  274. -webkit-box-orient: vertical;
  275. -webkit-line-clamp: 2;
  276. }
  277. .tui-price-right {
  278. text-align: right;
  279. font-size: 24rpx;
  280. color: #888888;
  281. line-height: 30rpx;
  282. padding-top: 20rpx;
  283. }
  284. .tui-color-red {
  285. color: #E41F19;
  286. padding-right: 30rpx;
  287. }
  288. .tui-goods-price {
  289. width: 100%;
  290. display: flex;
  291. align-items: flex-end;
  292. justify-content: flex-end;
  293. font-size: 24rpx;
  294. }
  295. .tui-size-24 {
  296. font-size: 24rpx;
  297. line-height: 24rpx;
  298. }
  299. .tui-price-large {
  300. font-size: 32rpx;
  301. line-height: 30rpx;
  302. font-weight: 500;
  303. }
  304. .tui-order-btn {
  305. width: 100%;
  306. display: flex;
  307. align-items: center;
  308. justify-content: flex-end;
  309. background: #fff;
  310. padding: 10rpx 30rpx 20rpx;
  311. box-sizing: border-box;
  312. }
  313. .tui-btn-ml {
  314. margin-left: 20rpx;
  315. }
  316. </style>