tenancyOrderDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <zj-page-layout :hasFooter="true">
  3. <view class="container">
  4. <view class="head" :style="{'background': filterStatus(detail,'color')}">{{filterStatus(detail,'name')}}</view>
  5. <view class="all-container">
  6. <view class="address-container card" v-if="addressInfo">
  7. <view class="main">
  8. <view class="left">
  9. <view class="icon"><text class="iconfont icon-dingwei1"></text></view>
  10. <view class="hasdata">
  11. <view class="name">{{addressInfo.name}}<text>{{addressInfo.phone}}</text></view>
  12. <view class="address ellipsis-2">
  13. {{addressInfo.province}}{{addressInfo.city}}{{addressInfo.area}}{{addressInfo.street}}{{addressInfo.address}}{{addressInfo.houseNo}}
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="card goods">
  20. <view class="common-title">产品信息</view>
  21. <view class="item">
  22. <image :src="product.categoryUrl" mode="aspectFill"></image>
  23. <view class="right">
  24. <view class="name">{{product.goodsLeaseName}}</view>
  25. <view class="name remark">{{product.repairRemark}}</view>
  26. </view>
  27. </view>
  28. <view class="items">
  29. <view class="label">下单日期</view>
  30. <view class="value">{{detail.createTime}}</view>
  31. </view>
  32. <view class="items">
  33. <view class="label">租赁时间</view>
  34. <view class="value">{{product.startDate.substring(0,10) + ' 至 ' + product.endDate.substring(0,10)}}</view>
  35. </view>
  36. <view class="items">
  37. <view class="label">租赁订金</view>
  38. <view class="value">{{detail.bookAmount}}</view>
  39. </view>
  40. <view class="items">
  41. <view class="label">租赁总金额</view>
  42. <view class="value">{{product.totalAmount}}</view>
  43. </view>
  44. <block v-if="product.renewalLeaseAmount">
  45. <view class="items">
  46. <view class="label">续租结束日期</view>
  47. <view class="value">{{product.endDate.substring(0,10)}}</view>
  48. </view>
  49. <view class="items">
  50. <view class="label">续租价格/月</view>
  51. <view class="value">{{product.renewalPrice || 0}}</view>
  52. </view>
  53. <view class="items">
  54. <view class="label">续租总金额</view>
  55. <view class="value">{{product.renewalLeaseAmount || 0}}</view>
  56. </view>
  57. </block>
  58. <view class="items">
  59. <view class="label">备注信息</view>
  60. <view class="value">{{detail.remark}}</view>
  61. </view>
  62. </view>
  63. <view class="card order-container">
  64. <view class="common-title">
  65. <view :class="tabIndex==1?'active text':'text'" @click="tabIndex = 1">订单信息</view>
  66. <view :class="tabIndex==2?'active text':'text'" @click="tabIndex = 2">租赁记录</view>
  67. </view>
  68. <block v-if="tabIndex==1">
  69. <view class="item">
  70. <view class="label"><text>订单编号</text>{{detail.id}}</view>
  71. <view class="value copy" @tap="$copy(detail.id)">复制</view>
  72. </view>
  73. <view class="item">
  74. <view class="label"><text>创建时间</text>{{detail.createTime}}</view>
  75. </view>
  76. <view class="item">
  77. <view class="label"><text>付款时间</text>{{detail.payTime || detail.createTime}}</view>
  78. </view>
  79. <view class="item">
  80. <view class="label"><text>支付方式</text>{{detail.payType=='WECHAT'?'微信支付':'到店支付'}}</view>
  81. </view>
  82. <view class="item">
  83. <view class="label"><text>支付单号</text>{{detail.record.outTradeNo}}</view>
  84. <view class="value copy" @tap="$copy(detail.record.outTradeNo)">复制</view>
  85. </view>
  86. <view class="item">
  87. <view class="label"><text>确认时间</text>{{detail.confirmTime}}</view>
  88. </view>
  89. </block>
  90. <block v-else>
  91. <view v-for="(item,index) in detail.records" :key="index" style="padding-bottom: 30rpx;border-bottom: 1rpx solid #dddddd;">
  92. <view class="item">
  93. <view class="label"><text>提交时间</text>{{detail.createTime}}</view>
  94. </view>
  95. <view class="item">
  96. <view class="label"><text>续租开始时间</text>{{detail.startDate}}</view>
  97. </view>
  98. <view class="item">
  99. <view class="label"><text>续租结束时间</text>{{detail.endDate}}</view>
  100. </view>
  101. <view class="item">
  102. <view class="label"><text>续租价格/月</text>{{detail.renewalPrice}}</view>
  103. </view>
  104. <view class="item">
  105. <view class="label"><text>续租总金额</text>{{detail.payValue}}</view>
  106. </view>
  107. </view>
  108. <Loading v-if="detail.records.length == 0" :loadStatus="2" :dataList="detail.records" />
  109. </block>
  110. </view>
  111. </view>
  112. </view>
  113. <template slot="footer">
  114. <view class="footer flex">
  115. <block v-if="!detail.payStatus">
  116. <u-button type="primary" style="flex: 1" shape="circle" color="#428dff" text="去支付" @click="payOrder(detail.id)"></u-button>
  117. </block>
  118. <block v-else>
  119. <u-button type="primary" v-if="detail.status == 'LEASE' || detail.status == 'OVER'" style="flex: 1;width: 210rpx;margin-right: 20rpx" shape="circle" color="#428dff" text="我要续租" @click="toRelet(detail.id)"></u-button>
  120. <u-button type="primary" style="flex: 1" shape="circle" color="#428dff" text="我要报修" v-if="detail.status == 'LEASE'" @click="toRepair(detail.id)"></u-button>
  121. </block>
  122. </view>
  123. </template>
  124. <zjDialogDatePicker :value="isShowDate" @cancel="cancelDate()"></zjDialogDatePicker>
  125. </zj-page-layout>
  126. </template>
  127. <script>
  128. import { weixinPay, mini_env } from '@/common/utils/util.js';
  129. import zjDialogDatePicker from '@/components/zj-dialog/zj-dialog-datePicker.vue';
  130. export default {
  131. components: {
  132. zjDialogDatePicker
  133. },
  134. data() {
  135. return {
  136. detail: {},
  137. product: {},
  138. addressInfo: null,
  139. isShowDate: false,
  140. is_confirm: true,
  141. userInfo: {},
  142. endDate: '',
  143. qty: 1,
  144. tabIndex: 1,
  145. payType: 'WECHAT',
  146. remark: '',
  147. }
  148. },
  149. computed: {
  150. filterStatus(){
  151. return function(item,type){
  152. if(!item.payStatus){
  153. return {name: '待付款',color: '#ce68ff'}[type]
  154. }else{
  155. if(item.status == 'WAIT'){
  156. return {name: '待审核',color: '#ff5300'}[type]
  157. }
  158. else if(item.status == 'WAIT_START'){
  159. return {name: '待开始',color: '#64c842'}[type]
  160. }else if(item.status == 'LEASE'){
  161. return {name: '租赁中',color: '#1281ff'}[type]
  162. }else if(item.status == 'OVER'){
  163. return {name: '待回收',color: '#9c84fe'}[type]
  164. }else if(item.status == 'RECOVER'){
  165. return {name: '已回收',color: '#817f7f'}[type]
  166. }
  167. }
  168. }
  169. }
  170. },
  171. async onLoad({id}) {
  172. console.log(id)
  173. this.id = id
  174. this.getDetail(id)
  175. this.crossPage.$on('confirm', result => {
  176. this.endDate = result.choosDate
  177. this.isShowDate = false
  178. })
  179. },
  180. onUnload() {
  181. this.crossPage.$off('chooseAddress');
  182. },
  183. methods: {
  184. // 获取品牌列表
  185. getDetail(id) {
  186. this.$api.post('/lease/order/detail',{
  187. id
  188. }).then(res => {
  189. this.getAddressData(res.data.userAddressId)
  190. this.detail = res.data;
  191. this.product = res.data.items[0]
  192. })
  193. },
  194. // 获取地址信息
  195. getAddressData(userAddressId) {
  196. this.$api.get('/user/address/detail', {
  197. userAddressId
  198. }).then(res => {
  199. this.addressInfo = {
  200. name: res.data.name,
  201. phone: res.data.phone,
  202. province: res.data.province,
  203. city: res.data.city,
  204. area: res.data.area,
  205. street: res.data.street,
  206. address: res.data.address,
  207. houseNo: res.data.houseNo,
  208. defaultAddr: res.data.defaultAddr,
  209. }
  210. })
  211. },
  212. //去续租
  213. toRelet(id){
  214. this.$navToPage({
  215. url: '/packageWorkorder/pages/tenancyReletOrder?id=' + id
  216. })
  217. },
  218. //去报修
  219. toRepair(id){
  220. this.$navToPage({
  221. url: '/packageWorkorder/pages/tenancyRepairOrder?id=' + id
  222. })
  223. },
  224. // 立即付款
  225. payOrder(id) {
  226. mini_env((bool) => {
  227. let that = this;
  228. this.$api.post('/lease/order/pay', {
  229. userId: this.$store.state.user.userId,
  230. id,
  231. ...(() => {
  232. if (bool) {
  233. return {
  234. miniPay: true,
  235. openId: this.$store.state.user.miniOpenId
  236. }
  237. }
  238. return {}
  239. })()
  240. }).then(res => {
  241. if (bool) {
  242. uniWebview.navigateTo({
  243. url: `/pages/pay/pay?${Object.entries({
  244. ...res.data,
  245. payPackage: res.data.payPackage.split("=")[0] || "",
  246. payPackageVal: res.data.payPackage.split("=")[1] || ""
  247. }).map(item => item.join("=")).join("&")}`
  248. })
  249. } else {
  250. weixinPay(res.data, function(res) {
  251. that.$successToast('支付成功');
  252. that.pageNum = 1;
  253. that.getOrderList();
  254. that.requestMessage();
  255. })
  256. }
  257. })
  258. })
  259. },
  260. },
  261. }
  262. </script>
  263. <style lang="scss" scoped>
  264. .container{
  265. padding-bottom: 100rpx;
  266. box-sizing: border-box;
  267. }
  268. .head{
  269. padding: 20rpx 60rpx;
  270. color: #ffffff;
  271. }
  272. .card {
  273. @include zj-card;
  274. margin-top: 20rpx;
  275. padding: 30rpx;
  276. }
  277. .flex{
  278. display: flex;
  279. }
  280. .flex_asb{
  281. display: flex;
  282. justify-content: space-between;
  283. align-items: center;
  284. }
  285. .common-title {
  286. font-size: 32rpx;
  287. font-weight: 500;
  288. margin-bottom: 20rpx;
  289. text {
  290. color: $error-color;
  291. font-weight: normal;
  292. }
  293. }
  294. .all-container {
  295. padding: 0 20rpx;
  296. }
  297. .order-container{
  298. min-height: 490rpx;
  299. .item{
  300. display: flex;
  301. align-items: center;
  302. justify-content: space-between;
  303. height: 50rpx;
  304. margin-bottom: 10rpx;
  305. text{
  306. margin-right: 50rpx;
  307. }
  308. .copy{
  309. color: #ff5300 !important;
  310. }
  311. }
  312. .common-title {
  313. display: flex;
  314. font-size: 34rpx;
  315. margin-bottom: 20rpx;
  316. .text {
  317. margin-right: 40rpx;
  318. }
  319. .active{
  320. color: #428dff;
  321. font-weight: 600;
  322. }
  323. }
  324. }
  325. .service-container {
  326. .item {
  327. display: flex;
  328. align-items: center;
  329. justify-content: space-between;
  330. height: 50rpx;
  331. margin-bottom: 30rpx;
  332. .label {
  333. margin-right: 30rpx;
  334. text {
  335. color: $error-color;
  336. }
  337. }
  338. .picker {
  339. .placeholder {
  340. color: $sec-font;
  341. }
  342. .iconfont {
  343. margin-left: 12rpx;
  344. color: $sec-font;
  345. }
  346. }
  347. }
  348. }
  349. .address-container {
  350. .main {
  351. display: flex;
  352. justify-content: space-between;
  353. align-items: center;
  354. margin-top: 30rpx;
  355. }
  356. .right {
  357. font-size: 32rpx;
  358. color: $sec-font;
  359. flex-shrink: 0;
  360. }
  361. .left {
  362. display: flex;
  363. align-items: center;
  364. margin-right: 20rpx;
  365. .icon {
  366. width: 52rpx;
  367. height: 52rpx;
  368. border-radius: 50%;
  369. background: $theme-color;
  370. display: flex;
  371. flex-shrink: 0;
  372. justify-content: center;
  373. align-items: center;
  374. margin-right: 20rpx;
  375. .iconfont {
  376. font-size: 36rpx;
  377. color: #ffffff;
  378. }
  379. }
  380. .nodata {
  381. font-size: 28rpx;
  382. color: #999999;
  383. }
  384. .hasdata {
  385. .name {
  386. font-size: 32rpx;
  387. color: #333333;
  388. text {
  389. color: #999999;
  390. font-size: 28rpx;
  391. margin-left: 16rpx;
  392. }
  393. }
  394. .address {
  395. font-size: 28rpx;
  396. color: #666666;
  397. line-height: 34rpx;
  398. margin-top: 10rpx;
  399. }
  400. }
  401. }
  402. }
  403. .goods{
  404. .item{
  405. display: flex;
  406. align-items: center;
  407. box-sizing: border-box;
  408. image {
  409. width: 140rpx;
  410. height: 140rpx;
  411. margin-right: 20rpx;
  412. }
  413. .right{
  414. flex: 1;
  415. .name{
  416. font-weight: bold;
  417. color: #000000;
  418. font-size: 32rpx;
  419. line-height: 40rpx;
  420. margin-bottom: 20rpx;
  421. }
  422. .remark{
  423. font-size: 26rpx;
  424. color: #59a7ff;
  425. }
  426. .qty{
  427. display: flex;
  428. justify-content: flex-end;
  429. }
  430. }
  431. }
  432. .items {
  433. display: flex;
  434. align-items: center;
  435. justify-content: space-between;
  436. height: 50rpx;
  437. margin-bottom: 30rpx;
  438. .label {
  439. margin-right: 30rpx;
  440. text {
  441. color: $error-color;
  442. }
  443. }
  444. .picker {
  445. .placeholder {
  446. color: $sec-font;
  447. }
  448. .iconfont {
  449. margin-left: 12rpx;
  450. color: $sec-font;
  451. }
  452. }
  453. }
  454. }
  455. .footer{
  456. background-color: #ffffff;
  457. padding: 20rpx;
  458. box-sizing: border-box;
  459. .tip{
  460. background-color: #fffdef;
  461. color: #ff5300;
  462. font-size: 28rpx;
  463. padding: 20rpx 0;
  464. }
  465. .left{
  466. width: 260rpx;
  467. margin-right: 60rpx;
  468. }
  469. }
  470. </style>