timescard.vue 8.5 KB

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