核销功能的完善

This commit is contained in:
zpian 2024-02-02 16:33:40 +08:00
parent 4dcea9995b
commit 4ef596d01d
3 changed files with 205 additions and 101 deletions

View File

@ -705,7 +705,7 @@ export function createQRcode(data) {
}
// 完成核销操作
export function writeOff(data) {
return request.post("coupon/writeOff", data);
return request.post("coupon/write_off", data);
}

View File

@ -6,13 +6,13 @@ let VUE_APP_WS_URL = `ws://${location.hostname}?type=user`
let openPlantGrass = '-openPlantGrass-'
// 网络接口修改此字符 小程序域名要求https
// let httpApi = 'https://bt.test.cdlfjy.com/' // 开发
let httpApi = 'https://mp.scwmbh.cn/' // 生产
let httpApi = 'https://bt.test.cdlfjy.com/' // 开发
// let httpApi = 'https://mp.scwmbh.cn/' // 生产
// 聊天接口修改此字符 小程序聊天要求wss 例如:
// let wsApi = 'wss://bt.test.cdlfjy.com'
let wsApi = 'wss://mp.scwmbh.cn'
let wsApi = 'wss://bt.test.cdlfjy.com'
// let wsApi = 'wss://mp.scwmbh.cn'
module.exports = {

View File

@ -1,14 +1,15 @@
<template>
<view class="page">
<view class="OrderCancellation">
<view class="header":style="{ 'background-image': `url(${domain}/static/images/cancellation-header.png)`}">
<view class="header" :style="{ 'background-image': `url(${domain}/static/images/cancellation-header.png)`}">
</view>
<view class="scan_count">
<view class="scan_bg"></view>
<view v-if="!iShidden" class="whiteBg">
<view class="input">
<input type="number" placeholder-class='placeholder' placeholder="请输入核销码" v-model="verify_code" />
<text @tap="codeChange">搜索</text>
<input type="number" placeholder-class='placeholder' placeholder="请输入核销码"
v-model="write_code" />
<text @tap="goCallate">核销</text>
</view>
<!-- #ifdef MP || MP-WEIXIN || APP-PLUS -->
<view class="bnt" @tap="scanCode"><text class="iconfont icon-saoma"></text>扫码核销</view>
@ -19,8 +20,8 @@
扫码核销
</view>
<!-- #endif -->
</view>
</view>
</view>
</view>
</view>
<!--授权登录-->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authClose"></authorize>
@ -28,71 +29,139 @@
</template>
<script>
import {mapGetters} from "vuex";
import authorize from '@/components/Authorize';
import { HTTP_REQUEST_URL } from '@/config/app';
import {
mapGetters
} from "vuex";
import authorize from '@/components/Authorize';
import {
HTTP_REQUEST_URL
} from '@/config/app';
import { writeOff } from '@/api/user.js';
export default {
components: {
authorize
},
data() {
return {
//
isAuto: false, //
isShowAuth: false,//
domain: HTTP_REQUEST_URL,
}
},
computed: {
...mapGetters(['isLogin', 'userInfo', 'viewColor'])
},
onLoad(options) {
let _this = this;
if(options.scene){
console.log('转换前参数:',options.scene)
let scene = _this.$util.getUrlParams(decodeURIComponent(options.scene));
console.log("接收参数",scene)
export default {
components: {
authorize
},
data() {
return {
//
isAuto: false, //
isShowAuth: false, //
domain: HTTP_REQUEST_URL,
iShidden: false,
write_code: '',
isWeixin: false,
}
},
computed: {
...mapGetters(['isLogin', 'userInfo', 'viewColor'])
},
onLoad(options) {
let _this = this;
console.log(_this)
if (options.scene) {
// console.log('', options.scene)
let scene = _this.$util.getUrlParams(decodeURIComponent(options.scene));
console.log('转换后参数:', scene);
if(scene.write_code) {
this.write_code = scene.write_code
writeOff({
write_code: this.write_code,
}).then(res => {
this.$util.Tips({
title: res.message
});
}).catch(res => {
this.$util.Tips({
title: res
});
});
}
}
//
if (!_this.isLogin) {
//
_this.isAuto = true;
_this.isShowAuth = true
} else {
//
_this.init();
}
},
//
onReachBottom() {},
methods: {
//
onLoadFun() {
if (this.isLogin) {
this.isShowAuth = false;
this.init();
}
},
//
authClose(e) {
this.isShowAuth = e
},
//
init() {
}
//
if (!_this.isLogin) {
//
_this.isAuto = true;
_this.isShowAuth = true
}else{
//
_this.init();
}
},
//
onReachBottom() {},
methods: {
//
onLoadFun() {
if(this.isLogin){
this.isShowAuth = false;
this.init();
}
},
//
authClose(e) {
this.isShowAuth = e
},
//
init () {
},
}
}
},
goCallate() {
let that = this
writeOff({
write_code: that.write_code,
}).then(res => {
that.$util.Tips({
title: res.message
});
}).catch(res => {
that.$util.Tips({
title: res
});
});
},
//
scanCode() {
var self = this;
// #ifdef MP || APP-PLUS
wx.scanCode({
scanType: ["qrCode", "barCode"],
success(res) {
console.log(res);
self.write_code = res.result
goCallate()
},
fail(res) {
console.log(res);
},
})
// #endif
//#ifdef H5
if (this.$wechat.isWeixin()) {
this.$wechat.wechatEvevt('scanQRCode', {
needResult: 1,
scanType: ["qrCode", "barCode"]
}).then(res => {
console.log(res);
this.write_code = res.resultStr
goCallate()
}).catch(res => {
this.$util.Tips({
title: res
});
});;
}
//#endif
},
}
}
</script>
<style lang="scss">
.page{
.page {
// height: 100vh;
}
.OrderCancellation .header {
padding-top: 30rpx;
width: 100%;
@ -101,22 +170,26 @@ export default {
background-size: 100% 100%;
position: relative;
}
.OrderCancellation {
width: 100%;
width: 100%;
}
.OrderCancellation .title_bg {
height: 90rpx;
background: #E93323;
width: 100%;
}
.OrderCancellation .scan_count{
.OrderCancellation .scan_count {
position: relative;
top: -140rpx;
width: 690rpx;
margin: 0 auto;
}
.OrderCancellation .scan_bg{
.OrderCancellation .scan_bg {
width: 100%;
height: 70rpx;
border-radius: 16rpx;
@ -125,6 +198,7 @@ export default {
background-repeat: no-repeat;
}
.OrderCancellation .whiteBg {
width: 640rpx;
background-color: #fff;
@ -134,10 +208,12 @@ export default {
padding-bottom: 77rpx;
box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.05);
}
.OrderCancellation .whiteBg .placeholder{
.OrderCancellation .whiteBg .placeholder {
color: #282828;
font-size: 40rpx;
}
.OrderCancellation .whiteBg .input {
width: 580rpx;
background: #F4F4F4;
@ -145,22 +221,25 @@ export default {
border-bottom: 1px solid #eee;
padding: 0 100rpx 0 20rpx;
border-radius: 10rpx;
position: relative;
}
.OrderCancellation .whiteBg .input text{
.OrderCancellation .whiteBg .input text {
position: absolute;
right: 20rpx;
top: 30rpx;
color: #666666;
font-size: 32rpx;
}
.OrderCancellation .whiteBg .input input {
font-size: 60rpx;
color: #282828;
line-height: 100rpx;
height: 100rpx;
height: 100rpx;
}
.OrderCancellation .whiteBg .bnt {
font-size: 32rpx;
color: #fff;
@ -172,21 +251,25 @@ export default {
line-height: 86rpx;
margin: 60rpx auto 0 auto;
}
.OrderCancellation .whiteBg .bnt .icon-saoma{
.OrderCancellation .whiteBg .bnt .icon-saoma {
color: #ffffff;
font-size: 30rpx;
margin-right: 15rpx;
}
.OrderCancellation .scan {
width: 300rpx;
height: 300rpx;
margin: 160rpx auto 0 auto;
}
.OrderCancellation .scan image {
width: 100%;
height: 100%;
display: block;
}
.WriteOff {
width: 640rpx;
background-color: #fff;
@ -195,7 +278,7 @@ export default {
border-radius: 4rpx 4rpx 16rpx 16rpx;
padding-bottom: 77rpx;
box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.05);
}
}
.WriteOff .num {
font-size: 28rpx;
@ -203,6 +286,7 @@ export default {
border-bottom: 1px solid #EEEEEE;
padding-bottom: 22rpx;
}
.WriteOff .num .see {
font-size: 16rpx;
color: #fff;
@ -211,10 +295,11 @@ export default {
padding-left: 5rpx;
margin-left: 12rpx;
}
.WriteOff .num .see .iconfont {
font-size: 15rpx;
}
.WriteOff .sure {
font-size: 32rpx;
color: #fff;
@ -228,104 +313,123 @@ export default {
background-image: -webkit-linear-gradient(to right, #f67a38 0%, #f11b09 100%);
background-image: -moz-linear-gradient(to right, #f67a38 0%, #f11b09 100%);
}
.WriteOff .sure.cancel {
background-image: none;
color: #666666;
margin-top: 30rpx;
border: 1px solid #BBBBBB;
}
.WriteOff .order_count scroll-view{
.WriteOff .order_count scroll-view {
max-height: 450rpx;
}
.WriteOff .order_count .order_list{
.WriteOff .order_count .order_list {
margin-top: 30rpx;
justify-content: space-between;
align-items: center;
}
.WriteOff .order_list .pictrue{
.WriteOff .order_list .pictrue {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
image{
image {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
}
}
.WriteOff .order_list .name{
.WriteOff .order_list .name {
color: #282828;
font-size: 28rpx;
}
.WriteOff .order_list .pro_name{
.WriteOff .order_list .pro_name {
width: 320rpx;
}
.WriteOff .order_list .price{
.WriteOff .order_list .price {
color: #999999;
font-size: 28rpx;
text-align: right;
line-height: 40rpx;
}
.WriteOff .order_list .btn-item{
.WriteOff .order_list .btn-item {
display: block;
font-size: 24rpx;
color: #E93323;
margin-top: 16rpx;
}
.WriteOff .order_price{
.WriteOff .order_price {
margin-top: 20rpx;
text-align: right;
font-size: 26rpx;
text{
text {
color: #E93323;
font-weight: bold;
}
}
.views {
font-size: 24rpx;
color: #666666;
}
.views-jian {
font-size: 10px;
}
.spin {
display: block;
transform: rotate(180deg);
font-size: 36rpx;
}
.popupn{
.popupn {
width: 100%;
text-align: center;
height: 60rpx;
line-height: 60rpx;
color: #fff;
.title{
background: rgba(0,0,0,.15);
.title {
background: rgba(0, 0, 0, .15);
max-width: 360rpx;
margin: 0 auto;
position: relative;
border-radius: 30rpx;
}
.iconfont{
.iconfont {
display: inline-block;
position: relative;
top: 4rpx;
right: 0;
}
.mer_logo{
.mer_logo {
width: 34rpx;
height: 34rpx;
position: relative;
top: 6rpx;
right: 10px;
right: 10px;
}
.mer_name{
.mer_name {
display: inline-block;
max-width: 650rpx;
}
.invoice-content{
.invoice-content {
background-color: #ffffff;
}
}
</style>
</style>