index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <My-shade />
  3. <view v-if="!['待接单', '已完成'].includes(content.where.status)" style="background-color: #fff;">
  4. <up-tabs lineColor="#3874F6" :scrollable="false" :list="[{
  5. name: '安装'
  6. }, {
  7. name: '维修'
  8. }, {
  9. name: '清洗'
  10. }]" @click="tabClick" />
  11. </view>
  12. <My_listbox ref="listBox" :empty="!list.length" @getlist="getList">
  13. <view style="height: 18rpx;" />
  14. <view class="item" v-for="item in list" :key="item.sa_serviceorderid" hover-class="navigator-hover">
  15. <navigator :url="'/pages/serviceSeeking/detail?id=' + item.sa_serviceorderid" hover-class="none">
  16. <view class="head">
  17. <view class="tag"
  18. :style="{ 'background': { '已完结': '#333', '拒绝受理': '#333' }[item.status] || '#3874F6' }">
  19. {{ item.status }}
  20. </view>
  21. <view class="time">
  22. {{ item.createdate }}
  23. </view>
  24. </view>
  25. <view class="address">
  26. {{ item.address }}
  27. </view>
  28. <view class="user">
  29. {{ item.serviceenterprisename + ' ' + item.servicephonenumber }}
  30. </view>
  31. </navigator>
  32. <view class="but-box" @click="stopPropagation">
  33. <view class="but-box-item" v-if="item.servicephonenumber">
  34. <My-button :customStyle="{
  35. 'background-color': '#FFFFFF',
  36. 'color': '#3874F6',
  37. height: '70rpx',
  38. }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="item.servicephonenumber" />
  39. </view>
  40. <navigator :url="'/pages/serviceSeeking/detail?id=' + item.sa_serviceorderid" class="but-box-item">
  41. <My-button :customStyle="{
  42. height: '70rpx',
  43. }" frontIcon="icon-jiedan" text="查询" />
  44. </navigator>
  45. </view>
  46. </view>
  47. </My_listbox>
  48. </template>
  49. <script setup>
  50. import { ref, reactive, getCurrentInstance } from 'vue';
  51. const { $Http } = getCurrentInstance().proxy;
  52. import { onLoad, onShow } from '@dcloudio/uni-app';
  53. const listBox = ref(null);
  54. const content = reactive({
  55. loading: false,
  56. isadmin: 0,
  57. "pageNumber": 1,
  58. "pageSize": 20,
  59. "where": {
  60. "servicetype": '安装',
  61. }
  62. });
  63. const list = ref([])
  64. function tabClick(e) {
  65. content.where.servicetype = e.value || e.name;
  66. getList(true);
  67. }
  68. onLoad(() => {
  69. getList();
  70. });
  71. onShow(() => {
  72. if (content.pageNumber != 1) $Http.updateList(content, getList)
  73. })
  74. function getList(init = false) {
  75. if (content.loading) return;
  76. if (init) content.pageNumber = 1;
  77. content.loading = true;
  78. console.log("uni.getStorageSync('WuserRecord')", uni.getStorageSync('WuserRecord'))
  79. try {
  80. let sa_customersid = uni.getStorageSync('WuserRecord').sa_customersid;
  81. if (!sa_customersid || sa_customersid < 0) {
  82. content.where.sa_customersid = uni.getStorageSync('WuserRecord').sa_customersid;
  83. } else {
  84. content.where.customerphonenumber = uni.getStorageSync('phonenumber') || ''
  85. }
  86. } catch (error) {
  87. content.where.customerphonenumber = uni.getStorageSync('phonenumber') || ''
  88. }
  89. $Http.basic({
  90. "id": "20230206091703",
  91. content
  92. }).then(res => {
  93. console.log("获取列表", res)
  94. content.loading = false;
  95. listBox.value.refreshToComplete();
  96. listBox.value.setHeight();
  97. if (res.code == 1) {
  98. list.value = reactive(res.firstPage ? res.data : list.value.concat(res.data));
  99. content.pageTotal = res.pageTotal;
  100. content.pageNumber = res.pageNumber;
  101. } else {
  102. if (res.msg) uni.showToast({
  103. title: res.msg,
  104. icon: 'none'
  105. });
  106. }
  107. })
  108. }
  109. function stopPropagation(event) {
  110. event.stopPropagation();
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .item {
  115. width: 690rpx;
  116. background: #FFFFFF;
  117. box-shadow: 0rpx 4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
  118. margin: 0 auto 20rpx;
  119. padding: 20rpx 40rpx;
  120. box-sizing: border-box;
  121. .head {
  122. display: flex;
  123. align-items: center;
  124. justify-content: space-between;
  125. .tag {
  126. font-family: PingFang SC, PingFang SC;
  127. font-size: 24rpx;
  128. color: #FFFFFF;
  129. padding: 8rpx 20rpx;
  130. }
  131. .time {
  132. font-family: Microsoft YaHei, Microsoft YaHei;
  133. font-size: 24rpx;
  134. color: #999999;
  135. }
  136. }
  137. .address {
  138. line-height: 38rpx;
  139. font-family: Microsoft YaHei, Microsoft YaHei;
  140. font-size: 28rpx;
  141. color: #333333;
  142. margin-top: 20rpx;
  143. }
  144. .user {
  145. line-height: 32rpx;
  146. font-family: Microsoft YaHei, Microsoft YaHei;
  147. font-size: 24rpx;
  148. color: #999999;
  149. margin-top: 20rpx;
  150. }
  151. .but-box {
  152. display: flex;
  153. align-items: center;
  154. justify-content: space-around;
  155. margin-top: 20rpx;
  156. .but-box-item {
  157. width: 40%;
  158. }
  159. }
  160. }
  161. </style>