123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- <template>
- <view class="page" :style="{'min-height':(h)+'px','padding-top':mt+'px'}">
- <c-nav-bar title="核销" @goBack="back()"></c-nav-bar>
- <view class="types">
- <view class="item bg2" @tap="scanCode(0)">
- <view class="n">扫码核销</view>
- <u-icon name="arrow-right" color="#fff" size="26" label="点击扫描" label-color="#fff" label-size="28" cu
- label-pos="left"></u-icon>
- </view>
- <view class="item bg1" @tap="scanCode(1)">
- <view class="n">扫身份证</view>
- <u-icon name="arrow-right" color="#fff" size="26" label="点击扫描" label-color="#fff" label-size="28"
- label-pos="left"></u-icon>
- </view>
- </view>
- <view class="orderInfo">
- <view class="tit">
- 订单详情
- </view>
- <view class="time">{{orderInfo.playDate}} {{orderInfo.playTime}}出发</view>
- <view class="bottom">
- <text>{{orderInfo.num}}人</text>
- <text>出游·{{orderInfo.playLength||0}}小时</text>
- <text>¥{{orderInfo.realPrice}}</text>
- </view>
- </view>
- <view class="list">
- <view class="tit">{{boatNo}} 共({{data.length}})人</view>
- <view class="item" v-for="(i,index) in data" :key="index">
- <text class="type" :class="i.remark=='book'?'t1':'t2'">{{i.remark=='book'?'预订单':'现场单'}}</text>
- <view class="personInfo">
- <view class="name">{{i.touristName}}</view>
- <view class="code">
- 身份证 {{i.touristCode}}
- </view>
- </view>
- <u-icon name="minus-circle" size="36" color="#FEA400" @tap="jian(item)"
- v-if="i.remark!='book'"></u-icon>
- </view>
- </view>
- <view class="btn">
- <text @click="hexiao">开始发船</text>
- </view>
- </view>
- </template>
- <script>
- var that;
- export default {
- data() {
- return {
- date: new Date().Format('yyyy-MM-dd'),
- show: false,
- data: [],
- merchantId: uni.getStorageSync('merchantId'),
- playTime: '',
- boatNo: '',
- type: '',
- orderInfo: {},
- keyName: ''
- }
- },
- onLoad(opt) {
- that = this;
- this.playTime = opt.playTime || '';
- this.boatNo = opt.boatNo || '';
- this.getOrderInfo();
- //获取上次核销缓存
- },
- methods: {
- back() {
- this.keyName = this.orderInfo.playDate + this.orderInfo.playTime + this.boatNo;
- uni.setStorageSync(this.keyName, JSON.stringify(this.data));
- //decodeURIComponent
- },
- getOrderInfo() {
- this.$api.post('/scenic/order/queryStartOrderInfo', {
- merchantId: this.merchantId,
- boatNo: this.boatNo
- }).then(res => {
- console.log(res.data)
- if (res.data.code == 0) {
- console.log(res)
- this.orderInfo = res.data.data;
- this.keyName = this.orderInfo.playDate + this.orderInfo.playTime + this.boatNo;
- console.log(uni.getStorageSync(this.keyName))
- this.data = JSON.parse(uni.getStorageSync(this.keyName)) || [];
- console.log(this.data)
- }
- })
- },
- scanCode(type) {
- uni.scanCode({
- onlyFromCamera: true,
- success: (res) => {
- console.log('扫码结果:' + res.result);
- // 扫码成功后的操作,例如:
- that.handleScanResult(res.result, type);
- },
- fail: (err) => {
- console.error('扫码失败:' + err);
- }
- });
- },
- // 处理扫码结果的函数,可以根据实际需求进行扩展
- handleScanResult(result, type) {
- // 例如:导航到某个页面,或者处理其他业务逻辑
- let sendData = {};
- sendData.playDate = this.orderInfo.playDate;
- sendData.playTime = this.orderInfo.playTime;
- sendData.playLength = this.orderInfo.playLength || 1;
- sendData.merchantId = this.orderInfo.merchantId;
- sendData.orderType = this.orderInfo.orderType;
- sendData.type = type;
- sendData.writeOffCode = result;
- console.log(sendData)
- this.$api.post('/scenic/order/scanCode', sendData).then(res => {
- console.log(res.data)
- if (res.data.code == 0) {
- console.log(this.data.findIndex(item => {
- item.touristCode == res.data.data.touristCode
- }))
- if (this.data.findIndex((item) => {
- return item.touristCode == res.data.data.touristCode
- }) > -1) {
- this.$showToast('该核验码已扫')
- } else {
- this.data.push(res.data.data)
- }
- } else {
- this.$showToast(res.data.msg)
- }
- })
- },
- check() {
- uni.navigateTo({
- url: '/pagesHouse/Verification/check'
- })
- },
- hexiao() {
- if (this.data.length == 0) {
- this.$showToast('请选择核销人')
- }
- this.$api.post('/scenic/order/sailWriteOff', {
- orderType: this.orderInfo.orderType,
- touristList: this.data
- }).then(res => {
- if (res.data.code == 0) {
- uni.redirectTo({
- url: "/pagesHouse/Verification/success?boatNo=" + this.boatNo + '&price=' +
- this.orderInfo.realPrice
- })
- }
- })
- uni.removeStorageSync(this.keyName);
- }
- }
- }
- </script>
- <style lang="less" scoped>
- /deep/.u-icon {
- justify-content: flex-end;
- }
- .btn {
- position: fixed;
- bottom: 0;
- left: 0;
- z-index: 1;
- padding: 16rpx 30rpx 36rpx 30rpx;
- width: 100%;
- box-sizing: border-box;
- background: #fff;
- text {
- display: block;
- background-color: #007A69;
- color: #007A69;
- color: #fff;
- height: 88rpx;
- line-height: 88rpx;
- border-radius: 44rpx;
- text-align: center;
- font-size: 32rp;
- font-weight: bold;
- box-sizing: border-box;
- }
- }
- .page {
- background: #F5F8FA;
- padding: 20rpx 24rpx 160rpx;
- box-sizing: border-box;
- .types {
- display: flex;
- gap: 36rpx;
- justify-content: space-between;
- .n {
- margin-bottom: 20rpx;
- color: #fff;
- }
- .item {
- width: 330rpx;
- height: 156rpx;
- padding: 34rpx 24rpx;
- font-size: 36rpx;
- font-weight: bold;
- box-sizing: border-box;
- }
- .bg2 {
- background: url('https://i.ringzle.com/file/20240316/3fc9f6a78557492e98caa50392411e3a.png') no-repeat center;
- background-size: 100%;
- }
- .bg1 {
- background: url('https://i.ringzle.com/file/20240316/8a927d5d4da84728b6bb0896541baccf.png') no-repeat center;
- background-size: 100%;
- }
- }
- .orderInfo {
- background-color: #fff;
- color: #333;
- padding: 0 24rpx 36rpx;
- margin: 20rpx 0;
- background: #fff;
- border-radius: 16rpx;
- .tit {
- padding: 32rpx 0 24rpx;
- font-size: 32rpx;
- }
- .time {
- font-size: 36rpx;
- font-weight: bold;
- margin-bottom: 32rpx;
- }
- .bottom {
- display: flex;
- align-items: center;
- text {
- &:first-child {
- width: 88rpx;
- height: 54rpx;
- background-color: #007A69;
- color: #fff;
- font-size: 34rpx;
- font-weight: bold;
- margin-right: 10rpx;
- text-align: center;
- border-radius: 12rpx;
- }
- &:nth-child(2) {
- width: 200rpx;
- flex: 1;
- }
- &:last-child {
- font-size: 30rpx;
- font-weight: bold;
- }
- }
- }
- }
- }
- .list {
- box-sizing: border-box;
- padding: 0 24rpx 0;
- border-radius: 16rpx;
- background-color: #fff;
- .tit {
- font-size: 36rpx;
- font-weight: bold;
- color: #111;
- padding: 36rpx 0 17rpx;
- }
- .item {
- display: flex;
- justify-content: space-between;
- padding: 24rpx 0;
- align-items: center;
- .type {
- width: 110rpx;
- height: 48rpx;
- text-align: center;
- display: inline-block;
- line-height: 48rpx;
- border-radius: 11rpx;
- font-size: 26rpx;
- font-weight: bold;
- color: #111;
- margin-right: 16rpx;
- }
- .t1 {
- background-color: #F0F8F6;
- color: #007A69;
- }
- .t2 {
- background-color: #E8EFFD;
- color: #326EE0;
- }
- .personInfo {
- flex: 1;
- .name {
- font-size: 30rpx;
- color: #111;
- margin-bottom: 16rpx;
- }
- .code {
- color: #666;
- font-size: 28rpx;
- }
- }
- }
- }
- </style>
|