allorder.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in navlist" :key="index" class="nav-item"
  5. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.title }}</view>
  6. </view>
  7. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" disable-touch>
  8. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navlist" :key="tabIndex">
  9. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData" :style="{ height: height }">
  10. <!-- 空白页 -->
  11. <u-empty text="暂无数据" mode="list" v-if="tabItem.loaded && tabItem.list.length == 0"></u-empty>
  12. <!-- 订单列表 -->
  13. <view class="dd-wrap" v-for="yyitem in tabItem.list" @click="goPage('/pagesS/order/orderinfo?id=' + yyitem.id)">
  14. <view class="dd-id-status">
  15. <view class="dd-stata">
  16. {{yyitem.status == 1 ?'已完成': '待服务'}}
  17. </view>
  18. <view class="dd-id">
  19. {{yyitem.order_id}}
  20. </view>
  21. <view class="dd-status">
  22. 已预约
  23. </view>
  24. </view>
  25. <view class="dd-info" style="margin-top: 20rpx;">
  26. 客户名称<text>{{yyitem.customer | showname}}</text>
  27. </view>
  28. <view class="dd-info">
  29. 下单时间<text>{{$utils.formatDate(yyitem.createTime)}}</text>
  30. </view>
  31. <view class="dd-info">
  32. 预约时间<text class="chs" style="color:#FF5600;">{{$utils.formatDate(yyitem.time)}}</text>
  33. </view>
  34. <view class="dd-btm">
  35. <view class="btm-price">
  36. 订单金额: <text>¥{{yyitem.to_price}}</text>
  37. </view>
  38. <!-- <view class="btm-btn btm-btn-lx" @click.stop="goCall(yyitem.customer_mobile)">
  39. 联系客户
  40. </view> -->
  41. <view class="btm-btn btm-btn-sm" @click.stop="wcdd(yyitem)" v-if="yyitem.status == 0">
  42. 完成订单
  43. </view>
  44. </view>
  45. <!-- <view class="add-dd" @click.stop="goPage('/pagesS/order/addorder?id=' + yyitem.id)" v-if="yyitem.status == 0">
  46. <image src="../../static/img/add-dd.png" mode=""></image>
  47. <view class="">
  48. 添加项目
  49. </view>
  50. </view> -->
  51. </view>
  52. <u-loadmore :status="tabItem.loadingType" />
  53. </scroll-view>
  54. </swiper-item>
  55. </swiper>
  56. <u-modal :show-cancel-button="true" confirm-color="#3b73de" v-model="modal_show" :content="content"
  57. @confirm="confirmEdit" @cancel="cancelEdit"></u-modal>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. modal_show: false,
  65. content: '确认订单已完成?',
  66. height: '',
  67. tabCurrentIndex: 0,
  68. navlist: [{
  69. status: '',
  70. title: '全部',
  71. list: [],
  72. page: 1,
  73. pageSize: 10,
  74. loaded: false,
  75. loadingType: 'loadmore'
  76. },
  77. {
  78. status: 2,
  79. title: '待服务',
  80. list: [],
  81. page: 1,
  82. pageSize: 10,
  83. loaded: false,
  84. loadingType: 'loadmore'
  85. },
  86. {
  87. status: 3,
  88. title: '已完成',
  89. list: [],
  90. page: 1,
  91. pageSize: 10,
  92. loaded: false,
  93. loadingType: 'loadmore'
  94. }
  95. ],
  96. wcid: '',
  97. }
  98. },
  99. onLoad(opt) {
  100. },
  101. onShow() {
  102. this.loadData()
  103. },
  104. onReachBottom() {
  105. },
  106. onReady() {
  107. var _this = this;
  108. uni.getSystemInfo({
  109. success: resu => {
  110. const query = uni.createSelectorQuery();
  111. query.select('.swiper-box').boundingClientRect();
  112. query.exec(function(res) {
  113. _this.height = resu.windowHeight - res[0].top + 'px';
  114. console.log('打印页面的剩余高度', _this.height);
  115. });
  116. },
  117. fail: res => {}
  118. });
  119. },
  120. filters: {
  121. showname(val) {
  122. function maskString(inputString) {
  123. const length = inputString.length;
  124. const visiblePart = length > 4 ? inputString.slice(-4) : inputString;
  125. const maskedPart = "*".repeat(length - visiblePart.length);
  126. return maskedPart + visiblePart;
  127. }
  128. const originalString = val + '';
  129. const maskedString = maskString(originalString);
  130. return maskedString
  131. // console.log(maskedString); // 输出:******7890
  132. }
  133. },
  134. methods: {
  135. goCall(phone) {
  136. uni.makePhoneCall({
  137. phoneNumber:phone+''
  138. })
  139. },
  140. wcdd(item) {
  141. this.wcid = item.id
  142. this.modal_show = true
  143. },
  144. confirmEdit(e) {
  145. // console.log(e,'确认')
  146. this.$u.api.completeYy({
  147. id: this.wcid
  148. }).then(({data})=> {
  149. this.$u.toast('订单完成');
  150. this.loadData('reload')
  151. })
  152. },
  153. cancelEdit(e) {
  154. // console.log(e,'失败')
  155. this.wcid = ''
  156. },
  157. //顶部tab点击
  158. tabClick(index) {
  159. this.tabCurrentIndex = index;
  160. this.loadData('tab')
  161. },
  162. // 获取数据
  163. loadData(type) {
  164. let that = this
  165. let index = that.tabCurrentIndex
  166. let item = that.navlist[index]
  167. if (type == 'reload') {
  168. item.loaded = false
  169. item.loadingType = 'more'
  170. item.page = 1
  171. item.list = []
  172. }
  173. if (type == 'tab' && item.loaded) {
  174. return
  175. }
  176. if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
  177. return
  178. }
  179. item.loadingType = 'loading'
  180. that.$u.api.getYgYyList({
  181. page: item.page, //分页页码,数字类型
  182. pageSize: item.pageSize,
  183. name: "", //搜索条件
  184. type: item.status
  185. }).then(({
  186. data
  187. }) => {
  188. item.list = item.list.concat(data)
  189. item.page++
  190. if(item.pageSize == data.length) {
  191. item.loadingType = 'loadmore'
  192. }else {
  193. item.loadingType = 'nomore'
  194. }
  195. item.loaded = true
  196. })
  197. },
  198. }
  199. }
  200. </script>
  201. <style lang="scss">
  202. .navbar {
  203. display: flex;
  204. height: 88rpx;
  205. padding: 0 5px;
  206. background: #fff;
  207. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  208. position: relative;
  209. z-index: 10;
  210. .nav-item {
  211. flex: 1;
  212. display: flex;
  213. justify-content: center;
  214. align-items: center;
  215. height: 100%;
  216. font-size: 15px;
  217. color: #999999;
  218. position: relative;
  219. &.current {
  220. color: #000;
  221. &:after {
  222. content: '';
  223. position: absolute;
  224. left: 50%;
  225. bottom: 0;
  226. transform: translateX(-50%);
  227. width: 44px;
  228. height: 0;
  229. border-bottom: 2px solid #4076d6;
  230. }
  231. }
  232. }
  233. }
  234. .dd-wrap {
  235. margin: auto;
  236. width: 713rpx;
  237. height: 314rpx;
  238. border-radius: 20rpx;
  239. background-color: #fff;
  240. padding-top: 35rpx;
  241. position: relative;
  242. margin-bottom: 27rpx;
  243. .dd-id-status {
  244. height: 40rpx;
  245. display: flex;
  246. align-items: center;
  247. width: 100%;
  248. font-size: 24rpx;
  249. padding: 0 23rpx 0 43rpx;
  250. .dd-stata {
  251. flex-shrink: 0;
  252. width: 123rpx;
  253. height: 39rpx;
  254. background: #FF5600;
  255. border-radius: 5rpx;
  256. text-align: center;
  257. line-height: 39rpx;
  258. font-weight: 400;
  259. color: #FFFFFF;
  260. }
  261. .dd-id {
  262. margin-left: 15rpx;
  263. flex-grow: 1;
  264. color: #1e395a;
  265. }
  266. .dd-status {
  267. flex-shrink: 0;
  268. font-weight: 400;
  269. color: #FCA930;
  270. }
  271. }
  272. .dd-info {
  273. font-size: 28rpx;
  274. font-weight: 500;
  275. color: #A0A0A0;
  276. padding-left: 42rpx;
  277. text {
  278. padding-left: 32rpx;
  279. font-size: 26rpx;
  280. font-weight: 500;
  281. color: #173456;
  282. }
  283. }
  284. .dd-btm {
  285. position: absolute;
  286. bottom: 0;
  287. height: 90rpx;
  288. width: 713rpx;
  289. background: linear-gradient(to right, #fbf5eb, #ffffff);
  290. border-radius: 0 0 20rpx 20rpx;
  291. display: flex;
  292. justify-content: space-between;
  293. align-items: center;
  294. padding: 0 20rpx 0 42rpx;
  295. .btm-price {
  296. font-size: 26rpx;
  297. color: #56687f;
  298. flex-grow: 1;
  299. text {
  300. color: #ff1e00;
  301. }
  302. }
  303. .btm-btn {
  304. width: 126rpx;
  305. height: 48rpx;
  306. line-height: 48rpx;
  307. background: #ebccae;
  308. border-radius: 10rpx;
  309. font-size: 24rpx;
  310. font-weight: 400;
  311. text-align: center;
  312. }
  313. .btm-btn-sm {
  314. background: #4D74CF;
  315. margin-left: 10rpx;
  316. color: #fff;
  317. }
  318. .btm-btn-lx {
  319. background-color: #fff;
  320. border: 1px solid #65676A;
  321. color: #56585C;
  322. }
  323. }
  324. .add-dd {
  325. position: absolute;
  326. bottom: 90rpx;
  327. right: 20rpx;
  328. width: 110rpx;
  329. height: 100rpx;
  330. font-size: 24rpx;
  331. font-weight: 500;
  332. color: #FF5600;
  333. text-align: center;
  334. image {
  335. display: block;
  336. margin: auto;
  337. width: 36rpx;
  338. height: 45rpx;
  339. }
  340. }
  341. }
  342. </style>