allorder.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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}}</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. methods: {
  121. goCall(phone) {
  122. uni.makePhoneCall({
  123. phoneNumber:phone+''
  124. })
  125. },
  126. wcdd(item) {
  127. this.wcid = item.id
  128. this.modal_show = true
  129. },
  130. confirmEdit(e) {
  131. // console.log(e,'确认')
  132. this.$u.api.completeYy({
  133. id: this.wcid
  134. }).then(({data})=> {
  135. this.$u.toast('订单完成');
  136. this.loadData('reload')
  137. })
  138. },
  139. cancelEdit(e) {
  140. // console.log(e,'失败')
  141. this.wcid = ''
  142. },
  143. //顶部tab点击
  144. tabClick(index) {
  145. this.tabCurrentIndex = index;
  146. this.loadData('tab')
  147. },
  148. // 获取数据
  149. loadData(type) {
  150. let that = this
  151. let index = that.tabCurrentIndex
  152. let item = that.navlist[index]
  153. if (type == 'reload') {
  154. item.loaded = false
  155. item.loadingType = 'more'
  156. item.page = 1
  157. item.list = []
  158. }
  159. if (type == 'tab' && item.loaded) {
  160. return
  161. }
  162. if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
  163. return
  164. }
  165. item.loadingType = 'loading'
  166. that.$u.api.getYgYyList({
  167. page: item.page, //分页页码,数字类型
  168. pageSize: item.pageSize,
  169. name: "", //搜索条件
  170. type: item.status
  171. }).then(({
  172. data
  173. }) => {
  174. item.list = item.list.concat(data)
  175. item.page++
  176. if(item.pageSize == data.length) {
  177. item.loadingType = 'loadmore'
  178. }else {
  179. item.loadingType = 'nomore'
  180. }
  181. item.loaded = true
  182. })
  183. },
  184. }
  185. }
  186. </script>
  187. <style lang="scss">
  188. .navbar {
  189. display: flex;
  190. height: 88rpx;
  191. padding: 0 5px;
  192. background: #fff;
  193. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  194. position: relative;
  195. z-index: 10;
  196. .nav-item {
  197. flex: 1;
  198. display: flex;
  199. justify-content: center;
  200. align-items: center;
  201. height: 100%;
  202. font-size: 15px;
  203. color: #999999;
  204. position: relative;
  205. &.current {
  206. color: #000;
  207. &:after {
  208. content: '';
  209. position: absolute;
  210. left: 50%;
  211. bottom: 0;
  212. transform: translateX(-50%);
  213. width: 44px;
  214. height: 0;
  215. border-bottom: 2px solid #4076d6;
  216. }
  217. }
  218. }
  219. }
  220. .dd-wrap {
  221. margin: auto;
  222. width: 713rpx;
  223. height: 314rpx;
  224. border-radius: 20rpx;
  225. background-color: #fff;
  226. padding-top: 35rpx;
  227. position: relative;
  228. margin-bottom: 27rpx;
  229. .dd-id-status {
  230. height: 40rpx;
  231. display: flex;
  232. align-items: center;
  233. width: 100%;
  234. font-size: 24rpx;
  235. padding: 0 23rpx 0 43rpx;
  236. .dd-stata {
  237. flex-shrink: 0;
  238. width: 123rpx;
  239. height: 39rpx;
  240. background: #FF5600;
  241. border-radius: 5rpx;
  242. text-align: center;
  243. line-height: 39rpx;
  244. font-weight: 400;
  245. color: #FFFFFF;
  246. }
  247. .dd-id {
  248. margin-left: 15rpx;
  249. flex-grow: 1;
  250. color: #1e395a;
  251. }
  252. .dd-status {
  253. flex-shrink: 0;
  254. font-weight: 400;
  255. color: #FCA930;
  256. }
  257. }
  258. .dd-info {
  259. font-size: 28rpx;
  260. font-weight: 500;
  261. color: #A0A0A0;
  262. padding-left: 42rpx;
  263. text {
  264. padding-left: 32rpx;
  265. font-size: 26rpx;
  266. font-weight: 500;
  267. color: #173456;
  268. }
  269. }
  270. .dd-btm {
  271. position: absolute;
  272. bottom: 0;
  273. height: 90rpx;
  274. width: 713rpx;
  275. background: linear-gradient(to right, #fbf5eb, #ffffff);
  276. border-radius: 0 0 20rpx 20rpx;
  277. display: flex;
  278. justify-content: space-between;
  279. align-items: center;
  280. padding: 0 20rpx 0 42rpx;
  281. .btm-price {
  282. font-size: 26rpx;
  283. color: #56687f;
  284. flex-grow: 1;
  285. text {
  286. color: #ff1e00;
  287. }
  288. }
  289. .btm-btn {
  290. width: 126rpx;
  291. height: 48rpx;
  292. line-height: 48rpx;
  293. background: #ebccae;
  294. border-radius: 10rpx;
  295. font-size: 24rpx;
  296. font-weight: 400;
  297. text-align: center;
  298. }
  299. .btm-btn-sm {
  300. background: #4D74CF;
  301. margin-left: 10rpx;
  302. color: #fff;
  303. }
  304. .btm-btn-lx {
  305. background-color: #fff;
  306. border: 1px solid #65676A;
  307. color: #56585C;
  308. }
  309. }
  310. .add-dd {
  311. position: absolute;
  312. bottom: 90rpx;
  313. right: 20rpx;
  314. width: 110rpx;
  315. height: 100rpx;
  316. font-size: 24rpx;
  317. font-weight: 500;
  318. color: #FF5600;
  319. text-align: center;
  320. image {
  321. display: block;
  322. margin: auto;
  323. width: 36rpx;
  324. height: 45rpx;
  325. }
  326. }
  327. }
  328. </style>