mescrollUni-item.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <!--
  3. swiper中的transfrom会使fixed失效,此时用height固定高度;
  4. swiper中无法触发mescroll-mixins.js的onPageScroll和onReachBottom方法,只能用mescroll-uni,不能用mescroll-body
  5. -->
  6. <!-- ref动态生成: 字节跳动小程序编辑器不支持一个页面存在相同的ref (如不考虑字节跳动小程序可固定值为 ref="mescrollRef") -->
  7. <!-- top的高度等于悬浮菜单tabs的高度 -->
  8. <mescroll-uni :ref="'mescrollRef' + i" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
  9. :up="upOption" @up="upCallback" @emptyclick="emptyClick">
  10. <view>
  11. <view class="service-order " v-for="(item,index) in list" >
  12. <!-- 门店列表 -->
  13. <view class="store-wrap" >
  14. <view :class="{ 'grayscale': item.forstStatus === '1' }">
  15. <view @click="orderDetail(item)" class="">
  16. <view class="store-list">
  17. <view class="store-content">
  18. <view class="content">
  19. <view class="desc flex-row justify-start ">
  20. <!-- <view class="time">
  21. 11111111111
  22. </view> -->
  23. <view v-if="item.serviceAttrDesc === '及时' " class="service-type">
  24. 到店
  25. </view>
  26. <view v-else class="service-mode">
  27. 预约
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="order-state-name">
  33. <text class="h-text1">{{ item.forstStatus === '1' ? '已冻结' : item.orderStatusDesc }}</text>
  34. </view>
  35. </view>
  36. <view class="order-state">
  37. <view class="order-num">
  38. <view class="h-order-num">
  39. <image src="/static/index/u217.png" mode=""></image>订单编号:{{ item.orderNo }}
  40. </view>
  41. <view class="h-order-text">
  42. <text> {{item.serviceType }} </text>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="flex-col detail11 ">
  47. <view class="d-item-row ">
  48. <view class="item-icon">
  49. <image src="/static/order/ud1.png" mode=""></image>
  50. </view>
  51. <view class="item-text">
  52. 服务对象:<text class="item-v">{{ item.serviceObjectName }}</text>
  53. </view>
  54. </view>
  55. <view class="d-item-row ">
  56. <view class="item-icon">
  57. <image src="/static/order/ud2.png" mode=""></image>
  58. </view>
  59. <view class="item-text">
  60. 服务门店:<text class="item-v">{{ item.storeName }}</text>
  61. </view>
  62. </view>
  63. <view class="d-item-row ">
  64. <view class="item-icon">
  65. <image src="/static/order/ud14.png" mode=""></image>
  66. </view>
  67. <view class="item-text">
  68. 下单时间:<text class="item-v">{{ item.createTime }}</text>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="detail flex-row justify-between" v-if="item.orderStatusDesc !== '未排号' " >
  73. <view class="flexLR">
  74. <view>
  75. <view class="d-item-row ">
  76. <view class="item-icon">
  77. <image src="/static/order/ud3.png" mode=""></image>
  78. </view>
  79. <view class="item-text">
  80. 服务日期:<text class="item-v">{{item.serviceDate.substring(0,10) || ''}}</text>
  81. </view>
  82. </view>
  83. <view class="d-item-row ">
  84. <view class="item-icon">
  85. <image src="/static/order/ud3.png" mode=""></image>
  86. </view>
  87. <view class="item-text">
  88. 服务时段:<text>{{item.serviceStartTime || ''}}</text>
  89. </view>
  90. </view>
  91. <view class="d-item-row ">
  92. <view class="item-icon">
  93. <image src="/static/order/ud3.png" mode=""></image>
  94. </view>
  95. <view class="item-text">
  96. 服务技师:<text class="item-v">{{item.servicePersonName || '签到成功自动分配'}}</text>
  97. </view>
  98. </view>
  99. </view>
  100. <view class=" planNumber flex-col justify-center">
  101. <text> {{ item.planNumber || '未排号' }}</text>
  102. </view>
  103. </view>
  104. </view>
  105. <view class="price" v-if="item.orderStatusDesc !== '未排号' " >
  106. 订单总金额:<text class="fontColor" v-if="item.totalAmount"> ¥{{ item.totalAmount }}</text>
  107. <text class="fontColor" v-else>¥0</text>
  108. </view>
  109. </view>
  110. <view class="nav-bar">
  111. <view class="btn" @click="scanCodeOrder(item)">
  112. <u-icon name="scan" size="18" />
  113. <text>扫码</text>
  114. </view>
  115. <view class="btn" @click="gotoPayOrder(item)" v-if="item.orderStatus == 1">
  116. <text>去付款</text>
  117. </view>
  118. <view class="btn" v-else-if="item.orderStatus == 2">
  119. <text>已取消</text>
  120. </view>
  121. <!-- <view @click="orderSign(item)" v-else-if="item.orderStatus == 4" class="btn">-->
  122. <!-- 立即排队-->
  123. <!-- &lt;!&ndash; <text class="text1">点击开始排号</text> &ndash;&gt;-->
  124. <!-- </view>-->
  125. <view @click="getOrderSign(item)" class="btn" v-else-if="item.orderStatus == 5">
  126. <text>点击查看排号</text>
  127. </view>
  128. <view class="btn" v-else-if="item.orderStatus == 6">
  129. <text>服务中</text>
  130. </view>
  131. <view class="btn" v-else-if="item.orderStatus == 7">
  132. <text>排号过期</text>
  133. </view>
  134. <view @click="gotoEvaluate(item)" class="btn" v-else-if="item.orderStatus == 8">
  135. <text>待评价</text>
  136. </view>
  137. <view @click="gotoPayOrder(item)" class="btn" v-else-if="item.orderStatus == 9">
  138. <text>去支付预约费用</text>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </mescroll-uni>
  146. </template>
  147. <script>
  148. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  149. import MescrollMoreItemMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js"
  150. export default {
  151. mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
  152. components: {},
  153. data() {
  154. return {
  155. downOption: {
  156. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  157. },
  158. upOption: {
  159. auto: false, // 不自动加载
  160. // page: {
  161. // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  162. // size: 10 // 每页数据的数量
  163. // },
  164. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  165. empty: {
  166. icon: '/static/imageIcon/empty.png',
  167. tip: '暂无内容', // 提示
  168. // btnText: '去看看'
  169. },
  170. textNoMore: '没有更多了'
  171. },
  172. list: [],
  173. }
  174. },
  175. props: {
  176. i: Number, // 每个tab页的专属下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
  177. index: { // 当前tab的下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
  178. type: Number,
  179. default () {
  180. return 0
  181. }
  182. },
  183. dataTime: {
  184. type: String,
  185. default () {
  186. return ''
  187. }
  188. },
  189. tabs: { // 为了请求数据,演示用,可根据自己的项目判断是否要传
  190. type: Array,
  191. default () {
  192. return []
  193. }
  194. },
  195. height: [Number, String], // mescroll的高度
  196. },
  197. watch: {
  198. },
  199. created() {},
  200. methods: {
  201. scanCodeOrder(item){
  202. let that = this
  203. uni.scanCode({
  204. scanType: ['qrCode'],
  205. success: function (res) {
  206. uni.navigateTo({
  207. url:'/orderPages/serviceItems/index?serviceStationId='+ res.result + '&orderId='+item.orderId
  208. })
  209. }
  210. })
  211. },
  212. /*下拉刷新的回调 */
  213. downCallback() {
  214. // 这里加载你想下拉刷新的数据, 比如刷新轮播数据
  215. // loadSwiper();
  216. // 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
  217. this.mescroll.resetUpScroll()
  218. },
  219. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  220. upCallback(page) {
  221. let status = this.index
  222. if (this.index === 3){
  223. status = 4
  224. }
  225. //联网加载数据
  226. let httpData = {
  227. pageNum: page.num,
  228. pageSize: 10,
  229. orderType:'SERVICE',
  230. status:status
  231. }
  232. this.$api.getOrderList(httpData).then((res) => {
  233. //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  234. this.mescroll.endSuccess(res.data.rows.length, res.data.rows.length === 10);
  235. //设置列表数据
  236. if (page.num === 1) this.list = []; //如果是第一页需手动制空列表
  237. this.list = this.list.concat(res.data.rows); //追加新数据
  238. console.log(this.list)
  239. }).catch((err) => {
  240. //联网失败, 结束加载
  241. this.mescroll.endErr();
  242. })
  243. },
  244. //点击空布局按钮的回调
  245. emptyClick() {
  246. uni.showToast({
  247. title: '点击了按钮,具体逻辑自行实现'
  248. })
  249. },
  250. // 搜索
  251. doSearch() {
  252. this.list = []; // 先清空列表,显示加载进度
  253. this.mescroll.resetUpScroll();
  254. },
  255. orderDetail(item) {
  256. uni.navigateTo({
  257. url:'/orderPages/orderDetail/index?id='+ item.orderId
  258. })
  259. }
  260. }
  261. }
  262. </script>
  263. <style>
  264. @import '/common/css/common.css';
  265. @import './index.rpx.css';
  266. </style>