index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <view>
  3. <view class="search-tab">
  4. <view v-if="status == 0" data-status="0" @click="selectStatus" class="search-tab-list cur">
  5. <text>待分配</text>
  6. </view>
  7. <view v-if="status != 0" data-status="0" @click="selectStatus" class="search-tab-list">
  8. <text>待分配</text>
  9. </view>
  10. <view v-if="status == 1" data-status="1" @click="selectStatus" class="search-tab-list cur">
  11. <text>进行中</text>
  12. </view>
  13. <view v-if="status != 1" data-status="1" @click="selectStatus" class="search-tab-list">
  14. <text>进行中</text>
  15. </view>
  16. <view v-if="status == 2" data-status="2" @click="selectStatus" class="search-tab-list cur">
  17. <text>已完成</text>
  18. </view>
  19. <view v-if="status != 2" data-status="2" @click="selectStatus" class="search-tab-list">
  20. <text>已完成</text>
  21. </view>
  22. <view v-if="status == 3" data-status="2" @click="selectStatus" class="search-tab-list cur">
  23. <text>已作废</text>
  24. </view>
  25. <view v-if="status != 3" data-status="2" @click="selectStatus" class="search-tab-list">
  26. <text>已作废</text>
  27. </view>
  28. </view>
  29. <view class="container" style="padding-top: 110rpx;">
  30. <view class="order-info" v-for="(item,index) in list" :key="index">
  31. <view class="order-content" @click="goDetail(item.id)">
  32. <view class="info-left">
  33. <image src="../../images/address.png" />
  34. </view>
  35. <view class="info-right">
  36. <view class="time">下单日期:{{item.createTime}} </view>
  37. <view class="time">服务日期:{{item.start}} </view>
  38. <view class="time">联系人:{{item.contact}} </view>
  39. <view class="time">联系电话:{{item.phone}} </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-if="list.length == 0" class="zanwushuju">暂无数据</view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. var app = getApp();
  49. import cpicker from "../../components/cpicker/cpicker.vue";
  50. import wpicker from "../../components/w-picker/w-picker.vue";
  51. import cmodal from "../../components/cmodel/cmodel.vue";
  52. export default {
  53. components: {
  54. cpicker,
  55. wpicker,
  56. cmodal
  57. },
  58. data() {
  59. return {
  60. list: [],
  61. page: 1,
  62. size: 10,
  63. flag: 0,
  64. status: 0,
  65. cancelReason: '',
  66. cancelShow: false,
  67. curOrderId: 0,
  68. end: '',
  69. finishShow: false,
  70. endShow: false,
  71. amount: '',
  72. preMoney: '',
  73. }
  74. },
  75. onLoad() {
  76. },
  77. onShow() {
  78. var that = this;
  79. app.ajaxReadyCallback = res => { //各个接口统一回调方法
  80. var apiname = res.data.apiname;
  81. console.log(res);
  82. if(apiname == 'order'){
  83. if(that.page == 1){
  84. that.list = [];
  85. }
  86. that.list = that.list.concat(res.data.data);
  87. if (res.data.data.length < that.size) {
  88. that.flag = 1;
  89. } else {
  90. that.page++;
  91. }
  92. }else if(apiname == 'user'){
  93. uni.setStorageSync('orgId',res.data.data.orgs.orgId);
  94. uni.setStorageSync('orgName',res.data.data.orgs.orgName);
  95. app.globalData.userinfo.orgId = res.data.data.orgs.orgId;
  96. app.globalData.userinfo.orgName = res.data.data.orgs.orgName;
  97. this.flag = 0;
  98. this.page = 1;
  99. this.getOrder();
  100. }else if(apiname == 'cancel'){
  101. this.flag = 0;
  102. this.getOrder();
  103. }else if(apiname == 'finish'){
  104. this.flag = 0;
  105. this.getOrder();
  106. }else if(apiname == 'send'){
  107. this.flag = 0;
  108. this.getOrder();
  109. }
  110. }
  111. this.getOrder();
  112. },
  113. onPullDownRefresh() {
  114. this.flag = 0;
  115. this.page = 1;
  116. this.getOrder();
  117. },
  118. onReachBottom() { //上拉加载
  119. this.getOrder();
  120. },
  121. methods: {
  122. addOrder(){
  123. uni.navigateTo({
  124. url: '/pages/order/add'
  125. });
  126. },
  127. sendOrder(id){
  128. uni.navigateTo({
  129. url: '/pages/order/send?orderId='+id
  130. });
  131. },
  132. goDetail(id){
  133. // uni.navigateTo({
  134. // url: '/pages/order/detail?id='+id
  135. // });
  136. window.location.href = app.globalData.host+'/ph/#/pages/order/detail?id='+id;
  137. },
  138. selectStatus(e){
  139. this.status = e.currentTarget.dataset.status;
  140. this.flag = 0;
  141. this.page = 1;
  142. this.getOrder();
  143. },
  144. getUserInfo(){
  145. app.ajax({
  146. url: app.globalData.serverUrl + 'user/info',
  147. type: 'POST',
  148. apiname: 'user',
  149. });
  150. },
  151. getOrder(){
  152. if(this.flag == 1){
  153. return;
  154. }
  155. app.ajax({
  156. url: app.globalData.serverUrl + 'PhOrders/orderList',
  157. type: 'POST',
  158. apiname: 'order',
  159. data: {
  160. page: this.page,
  161. size: this.size,
  162. status: this.status
  163. }
  164. });
  165. },
  166. cancelBtn(orderId){
  167. this.curOrderId = orderId;
  168. this.cancelShow = true;
  169. console.log(orderId,this.cancelShow);
  170. },
  171. cancelConfirm(){
  172. app.ajax({
  173. url: app.globalData.serverUrl + 'Order/cancel',
  174. type: 'POST',
  175. apiname: 'cancel',
  176. data: {
  177. cancelReason: this.cancelReason,
  178. id: this.curOrderId
  179. }
  180. });
  181. },
  182. finishBtn(obj){
  183. this.curOrderId = obj.id;
  184. this.finishShow = true;
  185. this.endShow = false;
  186. this.end = '';
  187. this.preMoney = obj.preMoney;
  188. console.log(obj.id,this.cancelShow);
  189. },
  190. finishConfirm(){
  191. if(!this.end){
  192. uni.showToast({
  193. title: '未选择服务结束日期',
  194. icon: 'none',
  195. duration: 2000
  196. })
  197. return;
  198. }
  199. app.ajax({
  200. url: app.globalData.serverUrl + 'Order/finish',
  201. type: 'POST',
  202. apiname: 'finish',
  203. data: {
  204. id: this.curOrderId,
  205. end: this.end,
  206. amount: this.amount,
  207. }
  208. });
  209. },
  210. cancelFinishConfirm(){
  211. this.end = '';
  212. },
  213. selectEnd(){
  214. this.endShow = true;
  215. },
  216. onConfirm(e,type){
  217. this.end = e.result;
  218. },
  219. getUrlCode (name) {
  220. return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20')) || null
  221. },
  222. }
  223. }
  224. </script>
  225. <style lang="scss" scoped>
  226. .select-date{
  227. width: 100%;
  228. height: 90rpx;
  229. line-height: 90rpx;
  230. overflow: hidden;
  231. font-size: 30rpx;
  232. text-align: center;
  233. }
  234. .addOrderBtn{
  235. position: fixed;
  236. width: 110rpx;
  237. height: 90rpx;
  238. padding-top: 20rpx;
  239. border-radius: 50%;
  240. text-align: center;
  241. background-color: var(--themeColor);
  242. color: #FFFFFF;
  243. font-size: 28rpx;
  244. right: 40rpx;
  245. bottom: 100rpx;
  246. z-index: 100;
  247. }
  248. .search-tab{
  249. position: absolute;
  250. z-index: 11;
  251. left: 0;
  252. top: 0;
  253. width: 100%;
  254. height: 90rpx;
  255. line-height: 90rpx;
  256. color: #FF706F;
  257. font-size: 32rpx;
  258. font-weight: bold;
  259. background-color: #ffffff;
  260. text-align: center;
  261. overflow: hidden;
  262. }
  263. .search-box{
  264. position: absolute;
  265. z-index: 9;
  266. left: 0;
  267. top: 90rpx;
  268. bottom: 0;
  269. right: 0;
  270. overflow: auto;
  271. }
  272. .search-tab .search-tab-list{
  273. position: relative;
  274. display: inline-block;
  275. width: 33.3%;
  276. background-color: #ffffff;
  277. float: left;
  278. color: #333333;
  279. font-size: 28rpx;
  280. font-weight: 400;
  281. }
  282. .search-tab .search-tab-list.cur{
  283. color: var(--themeColor);
  284. font-size: 32rpx;
  285. font-weight: bold;
  286. }
  287. .search-tab .search-tab-list.cur::after{
  288. content: '';
  289. width: 44rpx;
  290. height: 6rpx;
  291. background-color: var(--themeColor);
  292. position: absolute;
  293. z-index: 5;
  294. bottom: 0;
  295. left: 50%;
  296. margin-left: -22rpx;
  297. }
  298. .order-info {
  299. width: 690rpx;
  300. background: #FFFFFF;
  301. border-radius: 10rpx;
  302. margin: 0 auto;
  303. margin-bottom: 20rpx;
  304. overflow: hidden;
  305. }
  306. .order-content{
  307. width: 710rpx;
  308. height: 197rpx;
  309. border-bottom: 1rpx solid #f1f1f1;
  310. }
  311. .info-left{
  312. width: 150rpx;
  313. height: 197rpx;
  314. line-height: 225rpx;
  315. float: left;
  316. display: inline-block;
  317. text-align: center;
  318. }
  319. .info-left image{
  320. width: 70rpx;
  321. height: 70rpx;
  322. }
  323. .info-right {
  324. width: 550rpx;
  325. height: 157rpx;
  326. display: inline-block;
  327. float: left;
  328. padding-top: 40rpx;
  329. }
  330. .info-right .time{
  331. width: 550rpx;
  332. height: 40rpx;
  333. line-height: 1rpx;
  334. // margin-top: 50rpx;
  335. font-size: 26rpx;
  336. font-family: PingFang SC;
  337. font-weight: 500;
  338. color: #333333;
  339. }
  340. .info-right .address{
  341. width: 550rpx;
  342. height: 100rpx;
  343. font-size: 26rpx;
  344. font-family: PingFang SC;
  345. font-weight: 500;
  346. color: #333333;
  347. margin-top: 10rpx;
  348. overflow: hidden;
  349. }
  350. .bottom{
  351. width: 710rpx;
  352. height: 130rpx;
  353. }
  354. .bottom .bottom-left{
  355. width: 300rpx;
  356. height: 130rpx;
  357. line-height: 130rpx;
  358. display: inline-block;
  359. float: left;
  360. text-align: left;
  361. padding-left: 20rpx;
  362. }
  363. // .bottom-left image{
  364. // width: 36rpx;
  365. // height: 36rpx;
  366. // }
  367. // .bottom-left text{
  368. // margin-left: 10rpx;
  369. // font-size: 34rpx;
  370. // font-family: PingFang SC;
  371. // font-weight: bold;
  372. // color: #FF3F40;
  373. // vertical-align: bottom;
  374. // }
  375. .bottom-right{
  376. width: 360rpx;
  377. height: 130rpx;
  378. line-height: 130rpx;
  379. display: inline-block;
  380. float: left;
  381. text-align: right;
  382. }
  383. .bottom-btn-cancel{
  384. display: inline-block;
  385. width: 158rpx;
  386. height: 60rpx;
  387. line-height: 60rpx;
  388. font-size: 30rpx;
  389. border: 1px solid #B3B3B3;
  390. border-radius: 30rpx;
  391. text-align: center;
  392. color: #999999;
  393. }
  394. .bottom-btn-go{
  395. display: inline-block;
  396. width: 130rpx;
  397. height: 60rpx;
  398. line-height: 60rpx;
  399. background: #FF7576;
  400. border: 1px solid #FF7576;
  401. border-radius: 30px;
  402. font-size: 30rpx;
  403. font-family: PingFang SC;
  404. font-weight: 400;
  405. color: #FFFFFF;
  406. text-align: center;
  407. margin-left: 20rpx;
  408. }
  409. .bottom-btn-add{
  410. display: inline-block;
  411. width: 158rpx;
  412. height: 60rpx;
  413. line-height: 60rpx;
  414. background: #FF7576;
  415. border-radius: 30px;
  416. font-size: 30rpx;
  417. font-family: PingFang SC;
  418. font-weight: 400;
  419. color: #FFFFFF;
  420. text-align: center;
  421. margin-left: 20rpx;
  422. }
  423. .zanwushuju{
  424. width: 750rpx;
  425. text-align: center;
  426. padding-top: 20rpx;
  427. color: #666666;
  428. font-size: 32rpx;
  429. }
  430. .zanwushuju image{
  431. width: 374rpx;
  432. height: 288rpx;
  433. margin: 0 auto;
  434. }
  435. </style>