order.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view>
  3. <u-navbar :border-bottom="false" :is-back="true" title="我的委托"></u-navbar>
  4. <view class="wrap">
  5. <view class="u-tabs-box">
  6. <u-tabs-swiper ref="tabs" :current="current" :is-scroll="false" :list="list" activeColor="#2979ff"
  7. swiperWidth="750" @change="change"></u-tabs-swiper>
  8. </view>
  9. <swiper :current="swiperCurrent" class="swiper-box" @animationfinish="animationfinish" @transition="transition">
  10. <swiper-item v-for="(swiper,i) in orderList" :key="i" class="swiper-item">
  11. <scroll-view scroll-y style="height: 100%;width: 100%;">
  12. <view class="page-box">
  13. <view v-if="swiper.length === 0">
  14. <view class="centre">
  15. <image :src="empty" mode=""></image>
  16. <view class="explain">
  17. 您还没有相关的房源
  18. <view class="tips">可以去委托房源</view>
  19. </view>
  20. <view class="btn" @click="publishHouse">委托房源</view>
  21. </view>
  22. </view>
  23. <view v-for="(item, index) in swiper"
  24. v-else :key="index" class="order">
  25. <view class="top">
  26. <view class="left">
  27. <view class="store">{{ item.code }}</view>
  28. <u-icon :size="26" color="rgb(203,203,203)" name="arrow-right"></u-icon>
  29. </view>
  30. </view>
  31. <view class="item">
  32. <view class="left">
  33. <image :src="item.image" mode="aspectFill"></image>
  34. </view>
  35. <view class="content">
  36. <view class="title u-line-2">
  37. {{ item.villageName }}
  38. {{ item.type == '整租' ? item.houseNum + item.houseHall + item.toiletNum : item.roomType }}
  39. </view>
  40. <view class="price">¥{{ item.price }}</view>
  41. <view class="type">
  42. {{ item.type }} | {{ item.type == '整租' ? item.houseArea : item.roomArea }}㎡ |
  43. {{ item.decoration }}
  44. </view>
  45. </view>
  46. </view>
  47. <view class="bottom">
  48. <view v-if="item.state == 0" class="evaluate btn" @click.stop="clickImage(item.id)">修改</view>
  49. <view v-else class="evaluate btn" @click.stop="viewImage(item.id)">查看</view>
  50. </view>
  51. </view>
  52. </view>
  53. </scroll-view>
  54. </swiper-item>
  55. </swiper>
  56. </view>
  57. <view class="buttom">
  58. <view class="loginType">
  59. <view class="wechat item">
  60. <view class="icon">
  61. <u-icon color="#999" name="server-man" size="60" @click="server"></u-icon>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import config from "@/common/config.js" // 全局配置文件
  70. export default {
  71. data() {
  72. return {
  73. empty: '/static/empty/default.png',
  74. orderList: [[], [], [], []],
  75. list: [
  76. {
  77. name: '待审核'
  78. },
  79. {
  80. name: '待出租',
  81. // count: 1
  82. },
  83. {
  84. name: '已出租'
  85. },
  86. {
  87. name: '已下架',
  88. }
  89. ],
  90. current: 0,
  91. swiperCurrent: 0,
  92. tabsHeight: 0,
  93. dx: 0,
  94. pageNum: 1,
  95. pageSize: 100,
  96. };
  97. },
  98. onLoad() {
  99. this.getOrderList(0);
  100. this.getOrderList(1);
  101. this.getOrderList(2);
  102. this.getOrderList(3);
  103. },
  104. methods: {
  105. login() {
  106. this.$u.route('/pages/login/login')
  107. },
  108. // 页面数据
  109. getOrderList(idx) {
  110. this.findHouseList(idx)
  111. },
  112. // tab栏切换
  113. change(index) {
  114. this.swiperCurrent = index;
  115. this.orderList[index] = []
  116. this.getOrderList(index);
  117. },
  118. transition({detail: {dx}}) {
  119. this.$refs.tabs.setDx(dx);
  120. },
  121. animationfinish({detail: {current}}) {
  122. this.$refs.tabs.setFinishCurrent(current);
  123. this.swiperCurrent = current;
  124. this.current = current;
  125. },
  126. findHouseList(idx) {
  127. let url = "/api/houseApi/findHouseRoomList";
  128. let defaultData = {
  129. state: idx,
  130. publishId: uni.getStorageSync('lifeData').vuex_user.user.userId,
  131. villageCity: uni.getStorageSync('lifeData').vuex_city,
  132. pageNum: this.pageNum,
  133. pageSize: this.pageSize,
  134. orderByColumn: 'update_time,create_time',
  135. isAsc: 'desc'
  136. }
  137. this.$u.get(url, {...defaultData, ...this.searchData}).then(result => {
  138. const data = result.rows;
  139. this.houseList = data;
  140. for (let i = 0; i < this.houseList.length; i++) {
  141. // 先转成字符串再转成对象,避免数组对象引用导致数据混乱
  142. let item = this.houseList[i]
  143. if (!item.faceUrl.includes(config.staticUrl)) {
  144. item.image = config.staticUrl + item.faceUrl
  145. } else {
  146. item.image = item.faceUrl
  147. }
  148. if (item.type == 0) {
  149. item.type = '整租'
  150. } else if (item.type == 1) {
  151. item.type = '合租'
  152. }
  153. if (item.roomType == 1) {
  154. item.roomType = '主卧'
  155. } else if (item.roomType == 2) {
  156. item.roomType = '次卧'
  157. } else {
  158. item.roomType = '未知'
  159. }
  160. if (this.$u.test.isEmpty(item.houseNum)) {
  161. item.houseNum = ''
  162. }
  163. if (this.$u.test.isEmpty(item.houseHall)) {
  164. item.houseHall = ''
  165. }
  166. if (this.$u.test.isEmpty(item.toiletNum)) {
  167. item.toiletNum = ''
  168. }
  169. this.orderList[idx].push(item);
  170. }
  171. });
  172. },
  173. publishHouse() {
  174. this.$u.route('/pages/detail/preHouse');
  175. },
  176. server() {
  177. // window.open ('https://sourcebyte.cn')
  178. uni.makePhoneCall({
  179. phoneNumber: "18720989281",
  180. });
  181. },
  182. clickImage(houseId) {
  183. this.$u.route({
  184. url: '/pages/detail/preHouse',
  185. params: {
  186. houseId: houseId
  187. }
  188. })
  189. },
  190. viewImage(houseId) {
  191. this.$u.route({
  192. url: '/pages/detail/detail',
  193. params: {
  194. houseId: houseId
  195. }
  196. })
  197. }
  198. }
  199. };
  200. </script>
  201. <style>
  202. /* #ifndef H5 */
  203. page {
  204. height: 100%;
  205. background-color: #f2f2f2;
  206. }
  207. /* #endif */
  208. </style>
  209. <style lang="scss" scoped>
  210. .container {
  211. width: 100%;
  212. height: 100%;
  213. display: flex;
  214. justify-content: center;
  215. align-items: center;
  216. text-align: center;
  217. .empty {
  218. overflow: hidden;
  219. .tip {
  220. color: #909399;
  221. }
  222. .btn {
  223. color: #fff;
  224. background-color: #2979ff;
  225. width: 200 rpx;
  226. padding: 15 rpx 28 rpx;
  227. border-radius: 130 rpx;
  228. margin: 30 rpx 0 0 100 rpx;
  229. }
  230. }
  231. }
  232. .order {
  233. width: 710 rpx;
  234. background-color: #ffffff;
  235. margin: 20 rpx auto;
  236. border-radius: 20 rpx;
  237. box-sizing: border-box;
  238. padding: 20 rpx;
  239. font-size: 28 rpx;
  240. .top {
  241. display: flex;
  242. justify-content: space-between;
  243. .left {
  244. display: flex;
  245. align-items: center;
  246. .store {
  247. // margin: 0 10rpx;
  248. font-size: 32 rpx;
  249. }
  250. }
  251. .right {
  252. color: #2979ff;
  253. }
  254. }
  255. .item {
  256. display: flex;
  257. margin: 20 rpx 0 0 0;
  258. .left {
  259. margin-right: 30 rpx;
  260. image {
  261. width: 150 rpx;
  262. height: 150 rpx;
  263. border-radius: 10 rpx;
  264. }
  265. }
  266. .content {
  267. .title {
  268. font-weight: bold;
  269. font-size: 28 rpx;
  270. line-height: 50 rpx;
  271. }
  272. .price {
  273. margin: 10 rpx 0;
  274. font-size: 30 rpx;
  275. }
  276. .type {
  277. margin: 10 rpx 0;
  278. font-size: 24 rpx;
  279. color: $u-tips-color;
  280. }
  281. .desc {
  282. margin: 10 rpx 0;
  283. font-size: 24 rpx;
  284. color: $u-tips-color;
  285. }
  286. }
  287. }
  288. .bottom {
  289. display: flex;
  290. margin-top: 20 rpx;
  291. padding: 0 10 rpx;
  292. justify-content: flex-end;
  293. align-items: center;
  294. .btn {
  295. margin-left: 20 rpx;
  296. line-height: 52 rpx;
  297. width: 160 rpx;
  298. border-radius: 26 rpx;
  299. border: 2 rpx solid $u-border-color;
  300. font-size: 26 rpx;
  301. text-align: center;
  302. color: $u-type-info-dark;
  303. }
  304. .evaluate {
  305. // color: #2979ff;
  306. // border-color: #2979ff;
  307. color: $u-tips-color;
  308. border-color: $u-tips-color;
  309. }
  310. }
  311. }
  312. .centre {
  313. text-align: center;
  314. margin: 200 rpx auto;
  315. font-size: 32 rpx;
  316. image {
  317. width: 164 rpx;
  318. height: 164 rpx;
  319. border-radius: 50%;
  320. margin-bottom: 20 rpx;
  321. }
  322. .tips {
  323. font-size: 24 rpx;
  324. color: #999999;
  325. margin-top: 20 rpx;
  326. }
  327. .btn {
  328. margin: 80 rpx auto;
  329. width: 200 rpx;
  330. border-radius: 32 rpx;
  331. line-height: 64 rpx;
  332. color: #ffffff;
  333. font-size: 26 rpx;
  334. background-image: linear-gradient(to left, #2979ff, rgba(#2979ff, 0.6));
  335. }
  336. }
  337. .wrap {
  338. display: flex;
  339. flex-direction: column;
  340. height: calc(100vh - var(--window-top));
  341. width: 100%;
  342. }
  343. .swiper-box {
  344. flex: 1;
  345. }
  346. .swiper-item {
  347. height: 100%;
  348. }
  349. .buttom {
  350. .loginType {
  351. font-size: 14px;
  352. position: fixed;
  353. right: 30 rpx;
  354. bottom: 120 rpx;
  355. width: 60px;
  356. height: 60px;
  357. padding: 4px;
  358. cursor: pointer;
  359. background: #FFF;
  360. text-align: center;
  361. line-height: 60px;
  362. border-radius: 100%;
  363. -webkit-box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1), inset 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  364. box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1), inset 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  365. }
  366. }
  367. </style>