123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667 |
- <template>
- <view class="bagStorageOrders">
- <navigation-bar-view ref="nav" :maxTimer="60"></navigation-bar-view>
- <view class="label-box">第一步:选择箱门</view>
- <view class="selected-box">
- <block v-for="(item, i) in rentCabinetList" :key="i">
- <view class="item" :class="selectedIndex == i ? 'active' : ''" @click="changeSpec(i)">
- <image class="selected-icon" :src="require('../../static/images/icon-selected.png')" v-if="selectedIndex == i"></image>
- <block v-if="item.cabinetType == 1">
- <image class="small-icon" :src="require('../../static/images/icon-sub-box-selected.png')" v-if="selectedIndex == i"></image>
- <image class="small-icon" :src="require('../../static/images/icon-sub-box.png')" v-else></image>
- <view class="label">小格子</view>
- </block>
- <block v-if="item.cabinetType == 2">
- <image class="middle-icon" :src="require('../../static/images/icon-middle-box-selected.png')" v-if="selectedIndex == i"></image>
- <image class="middle-icon" :src="require('../../static/images/icon-middle-box.png')" v-else></image>
- <view class="label">中格子</view>
- </block>
- <block v-if="item.cabinetType == 3">
- <image class="big-icon" :src="require('../../static/images/icon-big-box-selected.png')" v-if="selectedIndex == i"></image>
- <image class="big-icon" :src="require('../../static/images/icon-big-box.png')" v-else></image>
- <view class="label">大格子</view>
- </block>
- <view class="message">{{item.cabinetDesc}}</view>
- </view>
- </block>
- </view>
- <view class="label-box">第二步:存物人手机号</view>
- <view class="input-box">{{options.phone}}</view>
- <view class="label-box">第三步:选择存放时长</view>
- <picker mode="selector" :range="rentOptionDtoList" range-key="name" :value="timersIndex" @change="changeTimers">
- <view class="input-box selected">
- <text v-if="rentOptionDtoList.length">{{rentOptionDtoList[timersIndex].name}}</text>
- <image class="arrow" :src="require('../../static/images/icon-arrow-right-grey.png')"></image>
- </view>
- </picker>
- <view class="agreement-box">
- <text>下单即同意</text>
- <text class="agreement" @click="openAgreementPopup">《木桩租柜服务用户协议》</text>
- </view>
- <view class="footer-btn">
- <view class="left">
- <view class="price" v-if="rentCabinetList.length">¥{{rentCabinetList[selectedIndex].price}}</view>
- <!-- -->
- <!-- <view class="message" @click="showPriceDetail">
- <text>查看价格详情</text>
- <image class="arrow" :src="require('../../static/images/icon-arrow-right-grey.png')"></image>
- </view> -->
- </view>
- <view class="right" @click="orders">下单</view>
- </view>
- <uni-popup ref="agreementPopup" type="center">
- <view class="agreement-popup">
- <image class="delete-icon" :src="require('../../static/images/icon-delete.png')" @click="closeAgreementPopup"></image>
- <scroll-view class="text-box" scroll-y>
- <rich-text :nodes="agreement.data"></rich-text>
- </scroll-view>
- </view>
- </uni-popup>
- <uni-popup ref="priceDetailPopup" type="center">
- <view class="price-popup">
- <image class="delete-icon" src="../../static/images/icon-delete.png" @click="closePriceDetail"></image>
- <view class="title">
- <text>存包费用:</text>
- <text class="num">3</text>
- <text>元</text>
- </view>
- <view class="label">详细价格详情</view>
- <block v-for="(item, i) in rentPopup" :key="i">
- <view class="cell">
- <image class="icon" :src="require('../../static/images/icon-sub-box-popup.png')" mode="aspectFit" v-if="item.cabinetType == 1"></image>
- <image class="icon" :src="require('../../static/images/icon-middle-box-popup.png')" mode="aspectFit" v-if="item.cabinetType == 2"></image>
- <image class="icon" :src="require" mode="aspectFit" v-if="item.cabinetType == 3"></image>
- <view class="info">
- <view class="message" v-for="(sub, j) in item.list" :key="j">
- <text>{{sub.description}},</text>
- <text class="num">{{sub.price}}</text>
- <text>元</text>
- </view>
- </view>
- </view>
- </block>
- <view class="btn" @click="closePriceDetail">知道了</view>
- </view>
- </uni-popup>
- <uni-popup ref="payPopup" type="center">
- <view class="pay-popup">
- <image class="delete-icon" :src="require('../../static/images/icon-delete.png')" @click="closePayDetail"></image>
- <view class="title">
- <text>请扫码支付,你的存物箱号为:{{order.caseSn}}</text>
- </view>
- <view class="code-box">
- <view class="item">
- <view class="qrcode">
- <!-- <canvas canvas-id="aliCode" /> -->
- <image :src="aliCodeImg"></image>
- <!-- <mosowe-canvas-image ref="aliCanvas" @canvasImage="aliCanvasImage" :lists="aliLists" height="40vw" width="40vw" /> -->
- </view>
- <view class="label">支付宝</view>
- </view>
- <view class="item">
- <view class="qrcode">
- <!-- <canvas canvas-id="weChatCode" /> -->
- <image :src="wxCodeImg"></image>
- <!-- <mosowe-canvas-image ref="wxCanvas" @canvasImage="wxCanvasImage" :lists="wxLists" height="40vw" width="40vw" /> -->
- </view>
- <view class="label">微信</view>
- </view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import navigationBarView from '../../components/navigationBarView.vue';
- import uniPopup from '@/components/uni-popup/uni-popup.vue'
- import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
- import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
- import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js';
- import mosoweCanvasImage from '@/components/mosowe-canvas-image/mosowe-canvas-image.vue'
- export default {
- components: {
- navigationBarView,
- uniPopup,
- uniPopupMessage,
- uniPopupDialog,
- mosoweCanvasImage
- },
- data() {
- return {
- selectedIndex: 0,
- rentOptionDtoList: [],
- timersIndex: 0,
- agreement: {},
- info: {},
- rentCabinetList: [],
- rentPopup: [],
- options: {},
- order: {},
- codeBody: {},
- timer: '',
- aliLists: [{
- type: 'qr',
- content: '',
- x: 0,
- y: 0,
- }],
- aliCodeImg: '',
- wxLists: [{
- type: 'qr',
- content: '',
- x: 0,
- y: 0,
- }],
- wxCodeImg: ''
- }
- },
- onLoad(options) {
- this.options = options
- this.getAgreement();
- this.getData();
- },
- onHide() {
- clearInterval(this.timer);
- const $this = this;
- $this.$nextTick(function() {
- $this.$refs.nav.clearTimer();
- })
- },
- beforeDestroy() {
- clearInterval(this.timer);
- },
- methods: {
- getData() {
- let sn = uni.getStorageSync('sn');
- this.$api.deviceInfo({
- deviceSn: sn
- }).then(res => {
- this.info = res.data;
- this.rentOptionDtoList = res.data.rentOptionDtoList;
- this.rentCabinetList = res.data.rentOptionDtoList.length ? res.data.rentOptionDtoList[this.timersIndex].rentCabinetList :
- [];
- let cabinetTypes = res.data.cabinetTypes.split(',')
- this.selectedIndex = Number(cabinetTypes[0]) - 1
- let lists = []
- // for (let i = 0; i < res.data.rentOptionDtoList.length; i++) {
- // let item = res.data.rentOptionDtoList[i];
- // for (let j = 0; j < item.rentCabinetList.length; j++) {
- // let rentCabinet = item.rentCabinetList[j];
- // rentCabinet.list = rentCabinet.list || []
- // let n = 0;
- // for (let k = 0; k < lists.length; k++) {
- // if (lists[k].cabinetType == rentCabinet.cabinetType) {
- // n++;
- // if (!lists[k].list) lists[k].list = []
- // lists[k].list.push({
- // ...item,
- // ...rentCabinet
- // })
- // }
- // }
- // if (n == 0) {
- // let list = [{
- // description: item.description,
- // price: rentCabinet.price
- // }]
- // rentCabinet.list = list
- // lists.push(rentCabinet)
- // }
- // }
- // }
- this.rentPopup = lists;
- })
- },
- changeSpec(e) {
- if (this.info.cabinetTypes.indexOf(String(e + 1)) == -1) {
- uni.showToast({
- icon: 'none',
- title: '该箱门不可用'
- })
- return;
- }
- this.selectedIndex = e
- },
- getAgreement() {
- this.$api.commonAboutus({
- type: 2
- }).then(res => {
- this.agreement = res;
- })
- },
- changeTimers(e) {
- this.timersIndex = e.detail.value
- },
- openAgreementPopup() {
- this.$nextTick(function() {
- this.$refs.agreementPopup.open();
- })
- },
- closeAgreementPopup() {
- this.$nextTick(function() {
- this.$refs.agreementPopup.close();
- })
- },
- aliCanvasImage(e) {
- this.aliCodeImg = e;
- },
- wxCanvasImage(e) {
- this.wxCodeImg = e;
- },
- orders() {
- const params = {
- cabinetType: this.rentCabinetList[this.selectedIndex].cabinetType,
- mobile: this.options.phone,
- optionId: this.rentOptionDtoList[this.timersIndex].id,
- deviceSn: uni.getStorageSync('sn')
- }
- this.$api.offorderCreateOffline(params).then(res => {
- console.log(res);
- this.order = res.order;
- this.codeBody.aliCode = res.aliCode;
- this.codeBody.wxCode = res.wxCode;
- this.aliCodeImg = res.aliCode;
- this.wxCodeImg = res.wxCode;
- const $this = this;
- let info = uni.getSystemInfoSync()
- // this.aliLists[0].content = res.aliCode;
- // this.aliLists[0].width = info.screenWidth * 0.4
- // this.aliLists[0].height = info.screenWidth * 0.4
- // this.wxLists[0].content = res.wxCode;
- // this.wxLists[0].width = info.screenWidth * 0.4
- // this.wxLists[0].height = info.screenWidth * 0.4
- this.$nextTick(function() {
- $this.$refs.nav.timer = 60;
- $this.$refs.nav.countdown()
- $this.$refs.payPopup.open();
- // setTimeout(function() {
- // $this.$refs.aliCanvas.createCanvas();
- // $this.$refs.wxCanvas.createCanvas();
- // }, 500)
- $this.timer = setInterval(function() {
- $this.getPayStatus();
- }, 3000)
- })
- })
- },
- getPayStatus() {
- this.$api.offorderGetStatus({
- orderSn: this.order.orderSn
- }).then(res => {
- if (res.status == 1) {
- clearInterval(this.timer);
- uni.redirectTo({
- url: '/pages/bagStorage/success?remind=' + this.order.remind
- })
- }
- })
- },
- showPriceDetail() {
- this.$nextTick(function() {
- this.$refs.priceDetailPopup.open();
- })
- },
- closePriceDetail() {
- this.$nextTick(function() {
- this.$refs.priceDetailPopup.close();
- })
- },
- closePayDetail() {
- clearInterval(this.timer)
- this.$nextTick(function() {
- this.$refs.payPopup.close();
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .bagStorageOrders {
- min-height: 100vh;
- background-color: #F8F8F8;
- .label-box {
- padding: 7.7vw 5vw 2.9vw;
- color: #222222;
- font-size: 4.2vw;
- line-height: 4.2vw;
- }
- .selected-box {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- margin: 0 4.8vw;
- .item {
- position: relative;
- display: flex;
- align-items: center;
- flex-direction: column;
- width: 26.5vw;
- padding-bottom: 9vw;
- margin-right: 4.2vw;
- border: .4vw solid #EBEBEB;
- border-radius: .8vw;
- background-color: #FFFFFF;
- &:last-child {
- margin-right: 0;
- }
- &.active {
- border-color: #FFDB82;
- }
- .selected-icon {
- position: absolute;
- top: 0;
- right: 0;
- width: 5.4vw;
- height: 5.4vw;
- }
- .small-icon {
- margin-top: 11vw;
- width: 16.3vw;
- height: 6.9vw;
- }
- .label {
- margin-top: 6vw;
- font-weight: 500;
- color: #FFB706;
- font-size: 4.2vw;
- line-height: 4.2vw;
- }
- .message {
- margin-top: 2.7vw;
- color: #AAAAAA;
- font-size: 2.9vw;
- line-height: 2.9vw;
- }
- .middle-icon {
- margin-top: 11vw;
- width: 16.7vw;
- height: 6.7vw;
- }
- .big-icon {
- margin-top: 9.6vw;
- width: 16.7vw;
- height: 8.1vw;
- }
- }
- }
- .input-box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 13.3vw;
- border: .4vw solid #DEDEDE;
- background-color: #F4F4F4;
- padding: 0 3.5vw;
- margin: .3vw 4.8vw 0;
- color: #444444;
- font-size: 5vw;
- border-radius: .8vw;
- &.selected {
- border-color: #FBD87F;
- font-weight: 500;
- color: #FFB706;
- background-color: #FFFFFF;
- }
- .arrow {
- width: 2.3vw;
- height: 3.8vw;
- }
- }
- .agreement-box {
- margin: 8vw 5vw 0;
- font-size: 2.9vw;
- line-height: 2.9vw;
- .agreement {
- color: #008CFF;
- }
- }
- .footer-btn {
- display: flex;
- height: 16.7vw;
- margin: 4vw 5vw 3.8vw;
- .left {
- flex: 1;
- display: flex;
- justify-content: center;
- flex-direction: column;
- padding: 0 8.1vw;
- border-radius: 16.7vw 0 0 16.7vw;
- background-color: #0C0B09;
- .price {
- color: #FFFFFF;
- font-size: 6.3vw;
- line-height: 6.3vw;
- }
- .message {
- display: flex;
- align-items: center;
- margin-top: 2.3vw;
- color: #9E9D9D;
- font-size: 2.9vw;
- line-height: 2.9vw;
- .arrow {
- width: 1.3vw;
- height: 1.7vw;
- margin-left: .6vw;
- }
- }
- }
- .right {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 35.4vw;
- border-radius: 0 16.7vw 16.7vw 0;
- background: linear-gradient(to right, #FEE704, #FDD001);
- font-size: 5vw;
- }
- }
- .agreement-popup {
- position: relative;
- width: 90.8vw;
- height: 70vh;
- background-color: #FFFFFF;
- border-radius: 1.7vw;
- overflow-y: scroll;
- .delete-icon {
- position: absolute;
- top: 4vw;
- right: 4vw;
- width: 3.3vw;
- height: 3.3vw;
- }
- .text-box {
- width: calc(100% - 11.6vw);
- height: 56.5vh;
- margin: 11.3vw 0 0;
- padding: 0 5.8vw;
- color: #888888;
- font-size: 3.2vw;
- }
- }
- .price-popup {
- position: relative;
- width: 90.8vw;
- height: 70vh;
- background-color: #FFFFFF;
- border-radius: 1.7vw;
- overflow-y: scroll;
- .delete-icon {
- position: absolute;
- top: 4vw;
- right: 4vw;
- width: 3.3vw;
- height: 3.3vw;
- }
- .title {
- margin-top: 14vw;
- text-align: center;
- font-weight: 500;
- font-size: 4.2vw;
- line-height: 4.2vw;
- .num {
- color: #FFB706;
- }
- }
- .label {
- margin: 7.3vw 5.8vw 5.6vw;
- font-size: 2.9vw;
- font-weight: 500;
- }
- .cell {
- display: flex;
- align-items: center;
- min-height: 18.5vw;
- margin: 0 5.8vw 1.9vw;
- border-radius: .8vw;
- background-color: #F8F8F8;
- .icon {
- width: 16.7vw;
- height: 6.7vw;
- margin: 0 11.5vw 0 6.5vw;
- }
- .info {
- flex: 1;
- .message {
- font-size: 2.1vw;
- line-height: 2.1vw;
- margin-bottom: 1.9vw;
- &:last-child {
- margin-bottom: 0;
- }
- .num {
- color: #FFB706;
- }
- }
- }
- }
- .btn {
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 5vw;
- line-height: 5vw;
- margin: 12.1vw 0 0;
- }
- }
- .pay-popup {
- position: relative;
- width: 90vw;
- min-height: 70vw;
- margin: 0 5.8vw 1.9vw;
- border-radius: .8vw;
- background-color: #F8F8F8;
- padding-top: 1rpx;
- .title {
- margin: 7vw 0;
- text-align: center;
- font-weight: 500;
- font-size: 4.2vw;
- line-height: 4.2vw;
- }
- .delete-icon {
- position: absolute;
- top: 4vw;
- right: 4vw;
- width: 3.3vw;
- height: 3.3vw;
- }
- .code-box {
- display: flex;
- align-items: center;
- justify-content: space-around;
- .item {
- display: flex;
- align-items: center;
- flex-direction: column;
- .qrcode {
- width: 40vw;
- height: 40vw;
- image {
- width: 40vw;
- height: 40vw;
- }
- }
- .label {
- margin-top: 2.9vw;
- font-size: 2.9vw;
- font-weight: 500;
- }
- }
- }
- }
- }
- </style>
|