123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- <template>
- <zj-page-layout :hasFooter="true">
- <view class="all-container">
- <view class="address-container card">
- <view class="main">
- <view class="left">
- <view class="icon"><text class="iconfont icon-dingwei1"></text></view>
- <view class="hasdata">
- <view class="name">{{addressInfo.name}}<text>{{addressInfo.phone}}</text></view>
- <view class="address ellipsis-2">
- {{addressInfo.province}}{{addressInfo.city}}{{addressInfo.area}}{{addressInfo.street}}{{addressInfo.address}}{{addressInfo.houseNo}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="card goods">
- <view class="common-title">产品信息</view>
- <view class="item">
- <image :src="product.categoryUrl" mode="aspectFill"></image>
- <view class="right">
- <view class="name">{{product.goodsLeaseName}}</view>
- <view class="name remark">{{product.repairRemark}}</view>
- </view>
- </view>
- <view class="items">
- <view class="label">下单日期</view>
- <view class="value">{{detail.createTime}}</view>
- </view>
- <view class="items">
- <view class="label">租赁时间</view>
- <view class="value">{{product.startDate.substring(0,10) + ' 至 ' + product.endDate.substring(0,10)}}</view>
- </view>
- <view class="items">
- <view class="label"><text>*</text>续租结束日期</view>
- <view class="picker" @tap="isShowDate = true">
- <text class="value" v-if="endDate">{{endDate}}</text>
- <text class="placeholder" v-else>请选择</text>
- <text class="iconfont icon-jinru"></text>
- </view>
- </view>
- <view class="items">
- <view class="label">续租价格/月</view>
- <view class="value">¥{{product.renewalPrice}}</view>
- </view>
- <view class="items">
- <view class="label">续租总金额</view>
- <view class="value">¥{{totalPrice}}</view>
- </view>
- </view>
- <view class="card service-container">
- <view class="common-title">备注信息</view>
- <u--textarea v-model="remark" placeholder="请输入内容" border="none" height="100"></u--textarea>
- </view>
- </view>
- <template slot="footer">
- <view class="footer">
- <view class="flex_asb">
- <view class="left flex_asb">
- <text style="color: #666666;font-size: 28rpx;">续租总金额</text>
- <text style="color: #ff5300;">¥{{totalPrice}}</text>
- </view>
- <u-button text="确定续租" shape="circle" color="#428dff" type="primary" @click="submitData"></u-button>
- </view>
- </view>
- </template>
- <!-- <zjDialogDatePicker :value="isShowDate" @cancel="cancelDate()"></zjDialogDatePicker> -->
- <u-datetime-picker
- :show="isShowDate"
- v-model="datePickerValue"
- mode="date"
- :formatter="formatter"
- @cancel="isShowDate = false"
- @close="isShowDate = false"
- @confirm="confirmDate"
- :minDate="minDate"
- ></u-datetime-picker>
- </zj-page-layout>
- </template>
- <script>
- import { weixinPay, mini_env } from '@/common/utils/util.js';
- import zjDialogDatePicker from '@/components/zj-dialog/zj-dialog-datePicker.vue';
- export default {
- components: {
- zjDialogDatePicker
- },
- data() {
- return {
- detail: {},
- addressInfo: null,
- isShowDate: false,
- is_confirm: true,
- userInfo: {},
- product: {},
- endDate: '',
- qty: 1,
- totalPrice: 0,
- payType: 'WECHAT',
- remark: '',
- datePickerValue: Number(new Date()),
- minDate: Number(new Date()),
- }
- },
- computed: {
- },
- async onLoad({id}) {
- this.id = id
- this.getDetail(id)
- this.crossPage.$on('confirm', result => {
- this.endDate = result.choosDate
- console.log(111)
- if(result.choosDate){
- console.log(111)
- this.computePrice()
- }
- this.isShowDate = false
- })
- },
- onUnload() {
- this.crossPage.$off('chooseAddress');
- },
- methods: {
- formatter(type, value) {
- if (type === 'year') {
- return `${value}年`
- }
- if (type === 'month') {
- return `${value}月`
- }
- if (type === 'day') {
- return `${value}日`
- }
- return value
- },
- confirmDate(e) {
- this.isShowDate = false;
- let time = new Date(e.value);
- let y = time.getFullYear();
- let m = (time.getMonth()+1) < 10 ? '0' + (time.getMonth()+1) : time.getMonth()+1;
- let d = (time.getDate()) < 10 ? '0' + (time.getDate()) : time.getDate();
- let hh = (time.getHours()) < 10 ? '0' + (time.getHours()) : time.getHours();
- let mm = (time.getMinutes()) < 10 ? '0' + (time.getMinutes()) : time.getMinutes();
- let ss = (time.getSeconds()) < 10 ? '0' + (time.getSeconds()) : time.getSeconds();
- this.endDate = `${y}-${m}-${d}`;
- this.computePrice(`${y}-${m}-${d} 00:00:00'`)
- },
- // 获取品牌列表
- getDetail(id) {
- this.$api.post('/lease/order/detail',{
- id
- }).then(res => {
- this.getAddressData(res.data.userAddressId)
- this.detail = res.data;
- this.product = res.data.items[0]
- })
- },
- // 获取地址信息
- getAddressData(userAddressId) {
- this.$api.get('/user/address/detail', {
- userAddressId
- }).then(res => {
- this.addressInfo = {
- name: res.data.name,
- phone: res.data.phone,
- province: res.data.province,
- city: res.data.city,
- area: res.data.area,
- street: res.data.street,
- address: res.data.address,
- houseNo: res.data.houseNo,
- defaultAddr: res.data.defaultAddr,
- }
- })
- },
- computePrice(endDate){
- this.$api.post('/lease/order/compute/renewal/amount', {
- id: this.id,
- endDate
- }).then(res => {
- this.totalPrice = res.data
- })
- },
- cancelDate(){
- this.isShowDate = false
- },
- // 去选择地址
- chooseAddress() {
- this.$navToPage({
- url: '/packageMine/pages/address/list?isChoose=' + true
- })
- },
- submitData() {
- if (!this.endDate) return this.$toast('请选择续租结束日期');
- if (!this.is_confirm) { return this.$toast('请勿频繁点击!') }
- this.is_confirm = false
- setTimeout(() => {
- this.is_confirm = true
- }, 3000)
- this.workerPay()
- },
- //代客支付
- workerPay() {
- mini_env((bool) => {
- const that = this
- this.$api.post('/lease/order/pay', {
- id: this.id,
- endDate: this.endDate + ' 00:00:00',
- remark: this.remark,
- ...(() => {
- if (bool) {
- return {
- miniPay: true,
- openId: this.$store.state.user.miniOpenId
- }
- }
- return {}
- })()
- }).then((res) => {
- if (!res.data) return false;
- if (bool) {
- uniWebview.navigateTo({
- url: `/pages/pay/zhupin?${Object.entries({
- ...res.data,
- payPackage: res.data.payPackage.split("=")[0] || "",
- payPackageVal: res.data.payPackage.split("=")[1] || ""
- }).map(item => item.join("=")).join("&")}`
- })
- } else {
- weixinPay(res.data, function (res) {
- that.$successToast('支付成功');
- setTimeout(() => {
- that.$navToPage({
- url: `/packageWorkorder/pages/tenancyOrderList`
- }, 'redirectTo')
- }, 1000)
- })
- }
- })
- })
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .all-container{
- padding: 0 20rpx 20rpx;
- box-sizing: border-box;
- }
- .card {
- @include zj-card;
- margin-top: 20rpx;
- padding: 30rpx;
- }
- .flex{
- display: flex;
- }
- .flex_asb{
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .common-title {
- font-size: 32rpx;
- font-weight: 500;
- margin-bottom: 20rpx;
- text {
- color: $error-color;
- font-weight: normal;
- }
- }
- .service-container {
- .item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 50rpx;
- margin-bottom: 30rpx;
- .label {
- margin-right: 30rpx;
- text {
- color: $error-color;
- }
- }
- .picker {
- .placeholder {
- color: $sec-font;
- }
- .iconfont {
- margin-left: 12rpx;
- color: $sec-font;
- }
- }
- }
- }
- .address-container {
- .main {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 30rpx;
- }
- .right {
- font-size: 32rpx;
- color: $sec-font;
- flex-shrink: 0;
- }
- .left {
- display: flex;
- align-items: center;
- margin-right: 20rpx;
- .icon {
- width: 52rpx;
- height: 52rpx;
- border-radius: 50%;
- background: $theme-color;
- display: flex;
- flex-shrink: 0;
- justify-content: center;
- align-items: center;
- margin-right: 20rpx;
- .iconfont {
- font-size: 36rpx;
- color: #ffffff;
- }
- }
- .nodata {
- font-size: 28rpx;
- color: #999999;
- }
- .hasdata {
- .name {
- font-size: 32rpx;
- color: #333333;
- text {
- color: #999999;
- font-size: 28rpx;
- margin-left: 16rpx;
- }
- }
- .address {
- font-size: 28rpx;
- color: #666666;
- line-height: 34rpx;
- margin-top: 10rpx;
- }
- }
- }
- }
- .goods{
- .item{
- display: flex;
- align-items: center;
- box-sizing: border-box;
- image {
- width: 140rpx;
- height: 140rpx;
- margin-right: 20rpx;
- }
- .right{
- flex: 1;
- .name{
- font-weight: bold;
- color: #000000;
- font-size: 32rpx;
- line-height: 40rpx;
- margin-bottom: 20rpx;
- }
- .remark{
- font-size: 26rpx;
- color: #59a7ff;
- }
- .qty{
- display: flex;
- justify-content: flex-end;
- }
- }
- }
- .items {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 50rpx;
- margin-bottom: 30rpx;
- .label {
- margin-right: 30rpx;
- text {
- color: $error-color;
- }
- }
- .picker {
- .placeholder {
- color: $sec-font;
- }
- .iconfont {
- margin-left: 12rpx;
- color: $sec-font;
- }
- }
- }
- }
- .footer{
- background-color: #ffffff;
- padding: 20rpx;
- box-sizing: border-box;
- .tip{
- background-color: #fffdef;
- color: #ff5300;
- font-size: 28rpx;
- padding: 20rpx 0;
- }
- .left{
- width: 370rpx;
- margin-right: 60rpx;
- }
- }
- </style>
|