Browse Source

核销搜索

master
jiazhipeng 10 months ago
parent
commit
4821fdbb0d
  1. 35
      components/scanCode.vue
  2. 2
      manifest.json
  3. 4
      pages/user/user.vue
  4. 238
      pages/verification/index.vue
  5. 4
      static/js/request.js
  6. 4
      subPackages/user/infoFilling.vue
  7. 3
      subPackages/user/register.vue
  8. 3
      subPackages/user/userInfo.vue

35
components/scanCode.vue

@ -1,7 +1,7 @@
<template> <template>
<view> <view class="scan-bg">
<text>{{ result }}</text> <!-- <text>{{ result }}</text> -->
<qrcode-stream @decode="onDecode" @init="initQR" /> <qrcode-stream @decode="onDecode" @init="initQR" class="scan-code"/>
</view> </view>
</template> </template>
@ -20,14 +20,16 @@
methods: { methods: {
onDecode(result) { onDecode(result) {
this.result = result; this.result = result;
_this.$emit("success", result) this.$emit("success", result)
}, },
async initQR(promise) { async initQR(promise) {
let _this = this let _this = this
try {
const { capabilities } = await promise; const { capabilities } = await promise;
const TORCH_IS_SUPPORTED = !!capabilities.torch; const TORCH_IS_SUPPORTED = !!capabilities.torch;
try {
let res = await promise; let res = await promise;
console.log(res) console.log(res)
} catch (error) { } catch (error) {
@ -54,3 +56,26 @@
} }
</script> </script>
<style lang="scss" scoped>
*{
box-sizing: border-box;
}
.scan-bg{
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100vh;
background: black;
z-index: 99999;
.scan-code{
width: 100%;
height: 100%;
}
}
</style>

2
manifest.json

@ -1,6 +1,6 @@
{ {
"name" : "daoyou", "name" : "daoyou",
"appid" : "__UNI__359C6E6", "appid" : "__UNI__4A60AD2",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",

4
pages/user/user.vue

@ -2,7 +2,7 @@
<view class="bg"> <view class="bg">
<view class="top-box flex-between" @click="gotoPath('/subPackages/user/userInfo')"> <view class="top-box flex-between" @click="gotoPath('/subPackages/user/userInfo')">
<view class="top-left"> <view class="top-left">
<image src="https://static.ticket.sz-trip.com/tourGuide/images/index/topImg.png" mode="" class="avatar"></image> <image :src="showImg(userInfo.avatar || 'https://static.ticket.sz-trip.com/tourGuide/images/index/topImg.png')" mode="" class="avatar"></image>
<view class="flex-column"> <view class="flex-column">
<view class="top-title">{{userInfo.nickname}}</view> <view class="top-title">{{userInfo.nickname}}</view>
<view class="top-subtitle">{{userInfo.group_data.name}}</view> <view class="top-subtitle">{{userInfo.group_data.name}}</view>
@ -41,7 +41,7 @@
path: '/subPackages/user/accountPassword' path: '/subPackages/user/accountPassword'
} }
], ],
userInfo: {} userInfo: {group_data: {}}
} }
}, },
onShow() { onShow() {

238
pages/verification/index.vue

@ -9,32 +9,36 @@
</view> </view>
<view class="content-area flex-1 h-1rpx"> <view class="content-area flex-1 h-1rpx">
<view class="type0-container" v-show="type==0"> <template v-if="orderList.length<=0">
<image :src="showImg('/uploads/20241203/e114fd176d9ef85e81e57150274bcc4a.png')"></image> <view class="type0-container" v-show="type==0">
<view @click="scanCode">点击扫码核销</view> <image @click="scanCode" :src="showImg('/uploads/20241203/e114fd176d9ef85e81e57150274bcc4a.png')"></image>
</view> <view @click="scanCode">点击扫码核销</view>
<view class="type1-container" v-show="type==1">
<view class="flex flex-items-center">
<view class="hexiao-text">输入核销码</view>
<input v-model="HXCode" class="hexiao-code" placeholder="请输入内容" />
</view> </view>
<view class="hexiao-btn" @click="verifyByCode">立即核销</view> <view class="type1-container" v-show="type==1">
</view>
<view class="type1-container" v-show="type==2">
<view v-if="orderList.length<=0">
<view class="flex flex-items-center"> <view class="flex flex-items-center">
<view class="hexiao-text">输入手机号</view> <view class="hexiao-text">输入核销码</view>
<input v-model="HXPhone" class="hexiao-code" placeholder="请输入内容" /> <input v-model="HXCode" class="hexiao-code" placeholder="请输入内容" />
</view> </view>
<view class="tips"> <view class="hexiao-btn" @click="verifyByCode">立即核销</view>
<view>仅支持查询当日订单 </view> </view>
<view>支持手机号模糊搜索不少于4位</view> <view class="type1-container" v-show="type==2">
<view v-if="orderList.length<=0">
<view class="flex flex-items-center">
<view class="hexiao-text">输入手机号</view>
<input v-model="HXPhone" class="hexiao-code" placeholder="请输入内容" />
</view>
<view class="tips">
<view>仅支持查询当日订单 </view>
<view>支持手机号模糊搜索不少于4位</view>
</view>
<view class="hexiao-btn" style="margin-top: 100rpx;" @click="searchByPhone">查询</view>
</view> </view>
<view class="hexiao-btn" style="margin-top: 100rpx;" @click="searchByPhone">查询</view>
</view> </view>
</template>
<view class="order-list" v-else>
<view class="order-item"> <view class="type1-container" v-else>
<view class="order-list" >
<view class="order-item" v-for="(item,i) in orderList" :key="i">
<view class="title">订单详情</view> <view class="title">订单详情</view>
<view class="flex" > <view class="flex" >
<view class="label">下单日期:</view> <view class="label">下单日期:</view>
@ -46,7 +50,7 @@
</view> </view>
<view class="flex"> <view class="flex">
<view class="label">订单名称:</view> <view class="label">订单名称:</view>
<view class="text"> {{item.name}}</view> <view class="text"> {{item.goods_title}}</view>
</view> </view>
<view class="flex"> <view class="flex">
<view class="label">数量:</view> <view class="label">数量:</view>
@ -58,81 +62,32 @@
</view> </view>
<view class="flex"> <view class="flex">
<view class="label">时段:</view> <view class="label">时段:</view>
<view class="text"></view> <view class="text">{{item.use_date}}</view>
</view> </view>
<view class="flex"> <view class="flex">
<view class="label">出行人:</view> <view class="label">出行人:</view>
<view class="text">{{item.nickname}}</view> <view class="text">{{item.contact_name}}</view>
</view> </view>
<view class="flex"> <view class="flex">
<view class="label">出行人手机号:</view> <view class="label">出行人手机号:</view>
<view class="text">{{item.phone}}</view> <view class="text">{{item.contact_tel}}</view>
</view> </view>
<view class="flex"> <view class="flex">
<view class="label">出行人身份证:</view> <view class="label">出行人身份证:</view>
<view class="text">{{item.user_id_number}}</view> <view class="text">{{item.id_number}}</view>
</view> </view>
<view class="hexiao-btn" @click="verifyByPhone">核销</view> <view class="hexiao-btn" @click="verifyByPhone">核销</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 核销弹窗 -->
<uni-popup ref="popup" type="center" style="width: 100%;">
<view class="pop-order-detail order-item">
<view class="title flex-shrink-0">确认是否核销</view>
<view class="pop-order-content flex-1 h-1rpx">
<template v-for="(item,i) in orderList">
<view class="flex" :key="i">
<view class="label">下单日期:</view>
<view class="text">{{item.create_time}}</view>
</view>
<view class="flex">
<view class="label">订单号:</view>
<view class="text">{{item.order_id}}</view>
</view>
<view class="flex">
<view class="label">订单名称:</view>
<view class="text"> {{item.name}}</view>
</view>
<view class="flex">
<view class="label">数量:</view>
<view class="text">{{item.num}}</view>
</view>
<view class="flex">
<view class="label">订单状态:</view>
<view class="text">{{item.status_text}}</view>
</view>
<view class="flex">
<view class="label">时段:</view>
<view class="text"></view>
</view>
<view class="flex">
<view class="label">出行人:</view>
<view class="text">{{item.nickname}}</view>
</view>
<view class="flex">
<view class="label">出行人手机号:</view>
<view class="text">{{item.phone}}</view>
</view>
<view class="flex">
<view class="label">出行人身份证:</view>
<view class="text">{{item.user_id_number}}</view>
</view>
</template>
</view>
<view class="bottom-btn">
<view class="hexiao-btn" @click="confirmVerify">核销</view>
</view>
</view>
</uni-popup>
<template v-if="showScan"> <view v-if="showScan">
<scanCodeVue ref="scanCodeVueRef" @success="getCode" @fail="scanFail"></scanCodeVue> <scanCodeVue ref="scanCodeVueRef" @success="getCode" @fail="scanFail"></scanCodeVue>
</template> </view>
</view> </view>
</template> </template>
@ -163,6 +118,12 @@
getCode (res) { getCode (res) {
console.log(res) console.log(res)
this.showScan = false this.showScan = false
if (res) {
let param = {child_id: res}
this.getOrderList(param)
}
}, },
scanFail(res) { scanFail(res) {
this.showScan = false this.showScan = false
@ -173,26 +134,35 @@
setType (type) { setType (type) {
if (this.type != type) {
this.orderList = []
}
this.type = type this.type = type
}, },
// //
getOrderByCode (code) { getOrderList (param) {
this.Post({ this.orderList = []
code: code this.Post(param, '/api/Merchants/search').then(res=>{
}, '/api/wx/jsSdk').then(res=>{
if (res && res.code == 1 && res.data) { if (res && res.code == 1 && res.data) {
this.orderList = [res.data] this.orderList = res.data || []
this.$refs.popup.open()
if (this.orderList.length<=0) {
uni.showToast({
title:'未查询到需核销的订单',
icon:"none"
})
}
} }
}) })
}, },
// //
verifyByCode () { verifyByCode () {
if (this.HXCode.trim() == '') { if (this.HXCode.trim() == '') {
uni.showToast({title:'请输入核销码',icon:"none"}) uni.showToast({title:'请输入核销码',icon:"none"})
return return
} }
this.getOrderByCode(this.HXCode) let param = {child_id: this.HXCode.trim()}
this.getOrderList(param)
}, },
// //
confirmVerify () { confirmVerify () {
@ -216,12 +186,8 @@
uni.showToast({title:'查询手机号最低4位',icon:"none"}) uni.showToast({title:'查询手机号最低4位',icon:"none"})
return return
} }
// this.Post({ let param = {mobile: this.HXPhone.trim()}
// mobile: this.HXPhone this.getOrderList(param)
// }, '/api/wx/jsSdk').then(res=>{
// })
this.orderList = [{}]
}, },
// //
verifyByPhone () { verifyByPhone () {
@ -241,46 +207,6 @@
}, },
//
initWX () {
try {
// if (window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i) == "micromessenger") {
let that = this
this.Post({
web_url: encodeURIComponent(window.location.href.split('#')[0]),
apis: 'scanQRCode'
}, '').then(res => {
if (res) {
let data = res.jssdk
//
wx.config({
debug: false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,// + "asdfasdf",//
jsApiList: ['scanQRCode']
});
}
})
// }
} catch (e) {}
},
//
saoma() {
let that = this
wx.scanQRCode({
needResult: 1, // 01
scanType: ["qrCode", "barCode"], //
success: function (res) {
that.getOrderByCode(res.resultStr.split('?')[1].split('=')[1])
},
fail: function (error) {
console.log(error)
}
});
},
}, },
} }
@ -413,6 +339,7 @@
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
color: #000000; color: #000000;
margin-bottom: 30rpx;
&>view{ &>view{
margin-bottom: 26rpx; margin-bottom: 26rpx;
} }
@ -434,44 +361,11 @@
.hexiao-btn{ .hexiao-btn{
margin: 0; margin: 0;
margin-left: auto; margin-left: auto;
} width: 200rpx;
} height: 66rpx;
line-height: 66rpx;
.pop-order-detail{
width: 640rpx;
height: 800rpx;
background: #FFFFFF;
border-radius: 13rpx;
display: flex;
flex-direction: column;
overflow: hidden;
.pop-order-content{
overflow-x: hidden;
overflow-y: auto;
&>view{
margin-bottom: 12rpx;
}
}
.bottom-btn{
display: flex;
width: 100%;
padding: 20rpx 0 0;
align-items: center;
justify-content: space-between;
margin: 0;
}
.hexiao-btn{
width: 160rpx;
height: 60rpx;
background: #96684F;
border-radius: 30rpx;
font-weight: 500; font-weight: 500;
font-size: 24rpx; font-size: 28rpx;
color: #FFFFFF;
line-height: 60rpx;
text-align: center;
display: block;
} }
} }
</style> </style>

4
static/js/request.js

@ -1,7 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import store from '@/store' import store from '@/store'
let NEWAPIURL = process.env.NODE_ENV == 'development' ? 'http://47.103.142.123:1010' : 'http://47.103.142.123:1010' let NEWAPIURL = process.env.NODE_ENV == 'development' ? 'https://guide.sz-trip.com' : 'https://guide.sz-trip.com'
Vue.prototype.NEWAPIURL = NEWAPIURL Vue.prototype.NEWAPIURL = NEWAPIURL
// #ifdef H5 // #ifdef H5
NEWAPIURL = '/api' NEWAPIURL = '/api'
@ -10,7 +10,7 @@ Vue.prototype.NEWAPIURL = NEWAPIURL
Vue.prototype.Post = (params, apiurl) => { Vue.prototype.Post = (params, apiurl) => {
if (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo')).token) params.merchants_token = JSON.parse(uni.getStorageSync('userInfo')).token if (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo')).token) params.merchants_token = JSON.parse(uni.getStorageSync('userInfo')).token
else if (store.state.user.userInfo.token) params.merchants_token = store.state.user.userInfo.token else if (store.state.user.userInfo.token) params.merchants_token = store.state.user.userInfo.token
params.merchants_token = "f6339f83-a62a-4030-81d3-34429c7d4c95" // params.merchants_token = "f6339f83-a62a-4030-81d3-34429c7d4c95"
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'

4
subPackages/user/infoFilling.vue

@ -327,16 +327,15 @@
// } // }
// console.log(this.fileList) // console.log(this.fileList)
const tempFilePaths = res.tempFilePaths; const tempFilePaths = res.tempFilePaths;
const uploadTask = uni.uploadFile({ const uploadTask = uni.uploadFile({
url: url, url: url,
filePath: tempFilePaths[0], filePath: tempFilePaths[0],
name: 'file', name: 'file',
header: {"token": '7e4bd097-8298-4cbe-8c75-535874a5c0e0'},
success: (uploadFileRes) => { success: (uploadFileRes) => {
try { try {
let res = JSON.parse(uploadFileRes.data) let res = JSON.parse(uploadFileRes.data)
if (res.code == 1) { if (res.code == 1) {
// _this.fileList.push(res.data.fullurl)
_this.fileList.push(res.data.url) _this.fileList.push(res.data.url)
} }
} catch(e) {} } catch(e) {}
@ -377,7 +376,6 @@
url: url, url: url,
filePath: tempFilePath, filePath: tempFilePath,
name: 'file', name: 'file',
header: {"token": '7e4bd097-8298-4cbe-8c75-535874a5c0e0'},
success: (uploadFileRes) => { success: (uploadFileRes) => {
uni.hideLoading() uni.hideLoading()
try { try {

3
subPackages/user/register.vue

@ -196,12 +196,11 @@
url: url, url: url,
filePath: tempFilePaths[0], filePath: tempFilePaths[0],
name: 'file', name: 'file',
header: {"token": '7e4bd097-8298-4cbe-8c75-535874a5c0e0'},
success: (uploadFileRes) => { success: (uploadFileRes) => {
try { try {
let res = JSON.parse(uploadFileRes.data) let res = JSON.parse(uploadFileRes.data)
if (res.code == 1) { if (res.code == 1) {
_this.info.avatar = res.data.fullurl _this.info.avatar = res.data.url
} }
} catch(e) {} } catch(e) {}

3
subPackages/user/userInfo.vue

@ -206,12 +206,11 @@
url: url, url: url,
filePath: tempFilePaths[0], filePath: tempFilePaths[0],
name: 'file', name: 'file',
header: {"token": '7e4bd097-8298-4cbe-8c75-535874a5c0e0'},
success: (uploadFileRes) => { success: (uploadFileRes) => {
try { try {
let res = JSON.parse(uploadFileRes.data) let res = JSON.parse(uploadFileRes.data)
if (res.code == 1) { if (res.code == 1) {
_this.info.avatar = res.data.fullurl _this.info.avatar = res.data.url
} }
} catch(e) {} } catch(e) {}

Loading…
Cancel
Save