index.vue 9.6 KB

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