mescrollUni-item.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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" :key="index">
  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="item.serviceAttribute == 1? 'service-type':'service-mode'">
  21. {{item.serviceAttrDesc}}
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="order-state-name">
  27. <text class="h-text1">{{ item.forstStatus === '1' ? '已冻结' : item.orderStatusDesc }}</text>
  28. </view>
  29. </view>
  30. <view class="order-state">
  31. <view class="order-num">
  32. <view class="h-order-num">
  33. <image src="/static/index/u217.png" mode=""></image>订单编号:{{ item.orderNo }}
  34. </view>
  35. <!-- <view class="h-order-text">-->
  36. <!-- <text> {{item.serviceType }} </text>-->
  37. <!-- </view>-->
  38. </view>
  39. </view>
  40. <view class="flex-row justify-between ">
  41. <view class="flex-col detail11 ">
  42. <view class="d-item-row ">
  43. <view class="item-icon">
  44. <image src="/static/order/ud1.png" mode=""></image>
  45. </view>
  46. <view class="item-text">
  47. 服务对象:<text class="item-v">{{ item.serviceObjectName }}</text>
  48. </view>
  49. </view>
  50. <view class="d-item-row " v-if="item.serviceAttribute == '1' && item.source != '2' ">
  51. <view class="item-icon">
  52. <image src="/static/order/ud2.png" mode=""></image>
  53. </view>
  54. <view class="item-text">
  55. 服务时段:<text class="item-v">{{ item.serviceStartTime}}</text>
  56. </view>
  57. </view>
  58. <view class="d-item-row ">
  59. <view class="item-icon">
  60. <image src="/static/order/ud2.png" mode=""></image>
  61. </view>
  62. <view class="item-text">
  63. 服务门店:<text class="item-v">{{ item.storeName }}</text>
  64. </view>
  65. </view>
  66. <view class="d-item-row ">
  67. <view class="item-icon">
  68. <image src="/static/order/ud14.png" mode=""></image>
  69. </view>
  70. <view class="item-text">
  71. 下单时间:<text class="item-v">{{ item.createTime }}</text>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="flex-col justify-center" v-if="item.serviceAttribute == 1">
  76. <view class="planNumber flex-row justify-center">
  77. <text>{{ item.planNumber || '未排号' }}</text>
  78. </view>
  79. <view class="planNumber1 flex-row justify-center">
  80. <text>C号段</text>
  81. </view>
  82. <view class="planNumber1 flex-row justify-center">
  83. <text>提前半小时签到哟</text>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="detail flex-row justify-between" v-if="item.serviceAttribute == '2' " >
  88. <view class="flexLR">
  89. <view>
  90. <view class="d-item-row ">
  91. <view class="item-icon">
  92. <image src="/static/order/ud3.png" mode=""></image>
  93. </view>
  94. <view class="item-text">
  95. 服务日期:<text class="item-v">{{item.serviceDate.substring(0,10) || ''}}</text>
  96. </view>
  97. </view>
  98. <view class="d-item-row ">
  99. <view class="item-icon">
  100. <image src="/static/order/ud3.png" mode=""></image>
  101. </view>
  102. <view class="item-text">
  103. 服务时段:<text>{{item.serviceStartTime || ''}}</text>
  104. </view>
  105. </view>
  106. <view class="d-item-row ">
  107. <view class="item-icon">
  108. <image src="/static/order/ud3.png" mode=""></image>
  109. </view>
  110. <view class="item-text">
  111. 服务技师:<text class="item-v">{{item.servicePersonName || '签到成功自动分配'}}</text>
  112. </view>
  113. </view>
  114. </view>
  115. <view class=" flex-col justify-center">
  116. <view class="planNumber flex-row justify-center">
  117. <text>{{ item.planNumber || '未排号' }}</text>
  118. </view>
  119. <view class="planNumber1 flex-row justify-center">
  120. <text>A号段</text>
  121. </view>
  122. <view class="planNumber1 flex-row justify-center">
  123. <text>提前半小时签到哟</text>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. <view class="price" v-if="item.serviceAttribute == 2">
  129. 预约金额:<text class="fontColor"> {{ item.subAmount || 0}}</text>
  130. </view>
  131. <view class="price" v-if="item.payAmount*1>0">
  132. 订单总金额:<text class="fontColor"> {{ item.payAmount || 0}}</text>
  133. <text :style="{'text-decoration':'line-through','margin-left':'15rpx', 'font-size':'20rpx'}">{{ item.totalAmount || 0}}</text>
  134. </view>
  135. <view class="price" v-else>
  136. 订单总金额:<text class="fontColor"> {{ item.totalAmount || 0}}</text>
  137. </view>
  138. </view>
  139. <view class="nav-bar">
  140. <!-- <view class="btn" v-if="!item.canPay && item.orderStatus == 6" @click="orderFinish(item)">-->
  141. <!-- <text>结束订单</text>-->
  142. <!-- </view>-->
  143. <view class="btn" v-if="item.canCancel" @click="cancelOrder(item)">
  144. <text>取消</text>
  145. </view>
  146. <view class="btn" v-if="item.canPay" @click="oneClickPay(item)">
  147. <text>一键付款</text>
  148. </view>
  149. <view @click="appointment(item)" class="btn" v-if="item.orderStatus == 9">
  150. <text>去支付预约费用</text>
  151. </view>
  152. <view class="btn" v-if="item.canSignIn" @click="orderSign(item)">
  153. <u-icon name="scan" size="18" />
  154. <text>扫码签到</text>
  155. </view>
  156. <!-- <view @click="orderSign(item)" v-else-if="item.orderStatus == 4" class="btn">-->
  157. <!-- 立即排队-->
  158. <!-- &lt;!&ndash; <text class="text1">点击开始排号</text> &ndash;&gt;-->
  159. <!-- </view>-->
  160. <!-- <view @click="getOrderSign(item)" class="btn" v-if="item.orderStatus == 11">-->
  161. <!-- <text>排号信息</text>-->
  162. <!-- </view>-->
  163. <!-- <view @click="getQueueingMsg(item)" class="btn" v-if="item.canSignIn && item.serviceAttribute == 1 ">-->
  164. <!-- <text>排队信息</text>-->
  165. <!-- </view>-->
  166. </view>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. </mescroll-uni>
  172. </template>
  173. <script>
  174. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  175. import MescrollMoreItemMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js"
  176. export default {
  177. mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
  178. components: {},
  179. data() {
  180. return {
  181. downOption: {
  182. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  183. },
  184. upOption: {
  185. auto: false, // 不自动加载
  186. // page: {
  187. // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  188. // size: 10 // 每页数据的数量
  189. // },
  190. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  191. empty: {
  192. icon: '/static/imageIcon/empty.png',
  193. tip: '暂无内容', // 提示
  194. // btnText: '去看看'
  195. },
  196. textNoMore: '没有更多了'
  197. },
  198. list: [],
  199. }
  200. },
  201. props: {
  202. i: Number, // 每个tab页的专属下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
  203. index: { // 当前tab的下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
  204. type: Number,
  205. default () {
  206. return 0
  207. }
  208. },
  209. dataTime: {
  210. type: String,
  211. default () {
  212. return ''
  213. }
  214. },
  215. tabs: { // 为了请求数据,演示用,可根据自己的项目判断是否要传
  216. type: Array,
  217. default () {
  218. return []
  219. }
  220. },
  221. height: [Number, String], // mescroll的高度
  222. },
  223. watch: {
  224. },
  225. created() {
  226. this.userInfo = uni.getStorageSync('userInfo')
  227. },
  228. methods: {
  229. orderFinish(item){
  230. this.$api.orderFinish(item.orderNo).then((res)=>{
  231. uni.$u.toast('操作成功')
  232. this.downCallback()
  233. })
  234. },
  235. getOrderSign(order){
  236. this.$emit('serialNumber',order)
  237. },
  238. getQueueingMsg(order){
  239. this.$emit('getQueueingMsg',order)
  240. },
  241. appointment(order){
  242. this.$emit('openPayAppointment',order,2)
  243. },
  244. oneClickPay(order){
  245. this.$emit('openPay',order,1)
  246. },
  247. orderSign(e){
  248. console.log('66666666666666')
  249. let that = this
  250. uni.scanCode({
  251. onlyFromCamera: true,
  252. hideAlbum: true,
  253. success: function (res) {
  254. console.log('扫码+++++++++++++',res)
  255. let result = JSON.parse(res.result)
  256. that.$api.orderSign({
  257. orderId:e.orderId,
  258. storeId:result.storeId,
  259. timestamp:result.timestamp
  260. }).then(res1=>{
  261. uni.showToast({
  262. icon: 'success',
  263. duration: 2000,
  264. title: '签到成功'
  265. });
  266. that.downCallback()
  267. })
  268. },
  269. fail:function (e) {
  270. uni.showToast({
  271. icon: 'fail',
  272. duration: 2000,
  273. title: '签到失败 '
  274. });
  275. }
  276. });
  277. },
  278. /*下拉刷新的回调 */
  279. downCallback() {
  280. // 这里加载你想下拉刷新的数据, 比如刷新轮播数据
  281. // loadSwiper();
  282. // 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
  283. this.mescroll.resetUpScroll()
  284. },
  285. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  286. upCallback(page) {
  287. let status = this.index
  288. if (this.index === 3){
  289. status = 4
  290. }
  291. //联网加载数据
  292. let httpData = {
  293. pageNum: page.num,
  294. pageSize: 10,
  295. orderType:'SERVICE',
  296. status:status
  297. }
  298. this.$api.getOrderList(httpData).then((res) => {
  299. //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  300. this.mescroll.endSuccess(res.data.rows.length, res.data.rows.length === 10);
  301. //设置列表数据
  302. if (page.num === 1) this.list = []; //如果是第一页需手动制空列表
  303. this.list = this.list.concat(res.data.rows); //追加新数据
  304. console.log(this.list)
  305. }).catch((err) => {
  306. //联网失败, 结束加载
  307. this.mescroll.endErr();
  308. })
  309. },
  310. //点击空布局按钮的回调
  311. emptyClick() {
  312. uni.showToast({
  313. title: '点击了按钮,具体逻辑自行实现'
  314. })
  315. },
  316. // 搜索
  317. doSearch() {
  318. this.list = []; // 先清空列表,显示加载进度
  319. this.mescroll.resetUpScroll();
  320. },
  321. cancelOrder(item){
  322. console.log('++++++++++++++++++++',item)
  323. uni.showModal({
  324. content: '请确认是否取消订单!',
  325. success: function (res) {
  326. if (res.confirm) {
  327. let that = this
  328. this.$api.cancelOrder({
  329. orderId:item.orderId
  330. }).then(res=>{
  331. that.downCallback()
  332. that.$api.getUserInfo().then( res=> {
  333. uni.setStorageSync('userInfo', res.data.data);
  334. });
  335. })
  336. } else if (res.cancel) {
  337. console.log('用户点击取消');
  338. }
  339. }.bind(this)
  340. })
  341. },
  342. orderDetail(item) {
  343. uni.navigateTo({
  344. url:'/orderPages/orderDetail/index?id='+ item.orderId
  345. })
  346. }
  347. }
  348. }
  349. </script>
  350. <style>
  351. @import '/common/css/common.css';
  352. @import './index.rpx.css';
  353. </style>