2025-12-04 09:58:14 +08:00

281 lines
6.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="container">
<view class="box">
<!-- <view class="iptBox">
<input type="text" placeholder="请输入核销码" value="{{code}}" placeholder-style="font-size: 36rpx;color: #999999;" />
</view>
<view class="text">*请输入正确的核销码</view>
<view class="btn">立即核销</view> -->
<view class="cirBox">
<view class="cir" @click="headerScanCodeClick">
<image src="https://static.hshuishang.com/scan.png" mode="widthFix" />
扫码核销
</view>
</view>
</view>
<u-popup :show="show" @close="onClose" mode="center">
<view class="sucess">
<image src="https://static.hshuishang.com/sucess_icon.png" mode="widthFix" />
订单核销成功
</view>
</u-popup>
<u-popup :show="show2" @close="onClose" :round='30' mode="center">
<view class="Info">
<view class="Tit">核销信息</view>
<view class="rows">
<view class="rows_tit">商品名称</view>
<view class="rows_con">{{Info.activity.title}}</view>
</view>
<view class="rows">
<view class="rows_tit">商品数量</view>
<view class="rows_con">{{Info.num}}</view>
</view>
<!-- <view class="rows">
<view class="rows_tit">核销商家</view>
<view class="rows_con">{{Info.business}}</view>
</view> -->
<view class="rows">
<view class="rows_tit">预约时间</view>
<view class="rows_con">{{Info.create_time}}</view>
</view>
<view class="btn" @click="eliminate">核销</view>
</view>
</u-popup>
</view>
</template>
<script>
import { request } from '../../utils';
import { apiArr } from '../../api/reservation';
export default {
data() {
return {
show: false,
show2: false,
code: '',
Info: "",
}
},
methods: {
//TODO: 模拟扫码结果, 后续删除
moni() {
const res = {
"id": 4,
"activity_id": 8,
"user_id": 67,
"city_id": 3,
"area_id": 81,
"business_id": 1266,
"order_no": "887B54E47EB34E828EB87250975977D7",
"qrcode": "/static/67812025-04-21.png",
"community_id": 5,
"facility_id": 27,
"room_id": 361,
"owner_id": 1004,
"shop_id": 0,
"num": 1,
"status": 1,
"create_time": "2025-04-21 09:10:02",
"update_time": "2025-04-21 11:31:55",
"activity": {
"activity_id": 8,
"cate_id": 15,
"shop_id": 0,
"community_id": 0,
"tuan_id": 0,
"city_id": 3,
"area_id": 81,
"business_id": 1266,
"title": "预约领花膜",
"intro": "增加商铺客流 活跃民众气氛",
"photo": "/static/activity/2024/04/12/66188e1f769ce.png",
"thumb": "",
"bar_code": "",
"price": 0,
"bg_date": "2025-03-28",
"end_date": "2025-05-02",
"time": "",
"sign_end": "2025-04-05",
"addr": "河北生衡水市桃城区全境",
"orderby": 1,
"audit": 2,
"closed": 2,
"sign_num": 6,
"total": 3,
"storage_method": 0,
"self_num": 3,
"household_num": 2,
"created_at": null,
"create_ip": "27.157.70.53",
"template": "",
"del_time": ""
},
"community": {
"community_id": 5,
"shop_id": 10,
"hw_shop_id": 0,
"uid": "",
"user_id": 44,
"city_id": 3,
"area_id": 81,
"business_id": 1266,
"type": 1,
"name": "滏阳锦苑",
"addr": "衡水市桃城区红旗大街与河阳东路交叉口西行200米路北",
"tel": "03182198889",
"pic": "/static/xiaoqu/2024/09/14/66e4ed5abe092.jpg",
"swiper_img": "",
"village_id": 0,
"property": "欣居物业",
"lng": "115.696998",
"lat": "37.727164",
"tag": "",
"closed": 0,
"del_time": null,
"orderby": 1,
"create_time": "2024-05-26 18:16:00",
"create_ip": "110.247.90.112",
"end_date": "0000-00-00",
"menu": "",
"setting": "",
"change_comm": 1,
"pc_pay_config": "",
"mini_pay_config": "",
"commission": 0,
"is_open_platform": 1
},
"shop": null,
"city": {
"city_id": 3,
"name": "河北省",
"user_id": 0,
"agent_id": 0,
"photo": "",
"pinyin": "",
"is_open": 1,
"domain": 0,
"lng": "",
"lat": "",
"orderby": 100,
"first_letter": "",
"theme": "default",
"pid": 0,
"short_name": "河北省",
"level_type": 0,
"city_code": 0,
"zip_code": 0,
"merger_name": "",
"parent_id": 0,
"closed": 0,
"create_time": "2021-04-20 14:21:43",
"create_ip": ""
},
"area": {
"area_id": 81,
"city_id": 3,
"area_name": "衡水市",
"user_id": 0,
"name": "衡水市",
"level_type": 0,
"city_code": 0,
"zip_code": 0,
"merger_name": "",
"lng": "",
"lat": "",
"pinyin": "",
"orderby": 100
},
"business": {
"business_id": 1266,
"business_name": "桃城区",
"area_id": 81,
"lng": "",
"lat": "",
"orderby": 100,
"is_hot": 0
}
}
// this.Info = res;
// this.show2 = true;
// return;
},
headerScanCodeClick() {
let _this = this;
// TODO: 模拟扫码结果, 后续删
this.moni();
return;
uni.scanCode({
success(res) {
console.log('12312313', res);
_this.ScanQrcode(res.result)
},
fail(err) {
console.log('扫码异常', err)
}
})
},
//获取订单详情
async ScanQrcode(e) {
console.log('asda', e);
const res = await request(apiArr.ScanCodeInfo, "POST", {
order_no: e
});
console.log('erer', res);
this.Info = res;
this.show2 = true;
},
onClose() {
this.show2 = false;
this.show = false;
},
async eliminate() {
uni.showLoading({
title: '核销中...',
mask: true
})
try {
const res = await request(apiArr.eliminate, 'POST', {
order_id: this.Info.id,
shop_id: Number(uni.getStorageSync('shopId'))
}, { silent: false, nested: true });
uni.hideLoading();
console.log('122131231', res);
this.show2 = false;
this.show = true;
} catch (error) {
console.log('接口报错', error);
this.show2 = false;
uni.showToast({
title: res.data.msg,
icon: "none"
})
}
},
}
}
</script>
<style>
@import url("./index.css");
</style>