Browse Source

format v1.1.0 release

dev
赵明涛 11 months ago
parent
commit
3d2738ffbe
  1. 2
      app/src/main/assets/apps/__UNI__3B4D40B/www/app-service.js
  2. 2
      daemonlibrary/src/main/java/com/shihoo/daemon/watchdog/MainWorkService.java
  3. 17
      uniapp_project_code/src/components/index/keyboard/input_box_QR.vue
  4. 6
      uniapp_project_code/src/components/index/list_item.vue
  5. 3
      uniapp_project_code/src/components/index/page_standby.vue
  6. 4
      uniapp_project_code/src/components/login/form.vue
  7. 4
      uniapp_project_code/src/components/login/pads_picker.vue
  8. 267
      uniapp_project_code/src/components/login/setting_mask.vue
  9. 89
      uniapp_project_code/src/pages/index/index.vue
  10. 23
      uniapp_project_code/src/pages/index/standby.vue
  11. 45
      uniapp_project_code/src/pages/login/index.vue
  12. 2
      uniapp_project_code/src/pages/login/success.vue
  13. 146
      uniapp_project_code/src/pages/pay/index.vue
  14. 517
      uniapp_project_code/src/pages/pay/readme.md
  15. 4
      uniapp_project_code/src/utils/api.js
  16. 1
      uniapp_project_code/src/utils/print.js
  17. 34
      uniapp_project_code/src/utils/util.js

2
app/src/main/assets/apps/__UNI__3B4D40B/www/app-service.js
File diff suppressed because it is too large
View File

2
daemonlibrary/src/main/java/com/shihoo/daemon/watchdog/MainWorkService.java

@ -78,7 +78,7 @@ public class MainWorkService extends AbsWorkService {
public void startWork() {
Log.e(TAG, "检查磁盘中是否有上次销毁时保存的数据");
mDisposable = Observable
.interval(8, TimeUnit.SECONDS)
.interval(3, TimeUnit.SECONDS)
//取消任务时取消定时唤醒
.doOnDispose(new Action() {
@Override

17
uniapp_project_code/src/components/index/keyboard/input_box_QR.vue

@ -87,21 +87,8 @@
if (i == 11) return "" //delete
}
const searchGoodBySku=(sku)=>{
let app = getApp();
return new Promise((resolve,reject)=>{
let _list = app.globalData.goodsList.list
// let _good = _list.find(item=>item.erp_goods.erp_goods_sku == sku)
//sku,
let _goods = _list.filter(item=>item.erp_goods.erp_goods_sku == sku)
console.log("searchGoodBySku:",_goods)
if(_goods.length){
resolve(_goods)
}else{
reject("未找到商品")
}
})
}
const searchGoodBySku = util.searchGoodBySku
</script>
<style lang="scss" scoped>

6
uniapp_project_code/src/components/index/list_item.vue

@ -6,7 +6,7 @@
</view>
<view class="buy-item-right">
<view class="br-top">
<text class="brt-title">{{mitem.erp_goods?.erp_goods_name||"-"}}</text>
<text class="brt-title">{{mitem.goods_name||"-"}}</text>
<image class="img" src="/static/index/delete_icon.png" mode="scaleToFill" @click="del"/>
</view>
<view class="br-bottom">
@ -14,8 +14,8 @@
<!-- 规格 -->
<text class="brb-specs">{{mitem.erp_goods?.erp_goods_specs||"-"}}</text>
<view class="brb-price">
<text class="brbp-single-price">¥{{mitem.erp_goods?.erp_goods_price||"-"}}</text>
<text class="brbp-underline-price">¥{{mitem.erp_goods?.erp_goods_price||"-"}}</text>
<text class="brbp-single-price">¥{{mitem.user_price||"-"}}</text>
<text class="brbp-underline-price" v-if="mitem.underlined_price_show">¥{{mitem.underlined_price||"-"}}</text>
</view>
</view>
<view class="brb-middle">

3
uniapp_project_code/src/components/index/page_standby.vue

@ -86,7 +86,8 @@
.content_title {
// align-self: flex-start;
width: 750rpx;
// width: 750rpx;
width: 90%;
margin-left: 47rpx;
margin-top: 50rpx;

4
uniapp_project_code/src/components/login/form.vue

@ -3,7 +3,7 @@
<view class="login-form">
<view class="lf-item">
<image class="li-icon" mode="aspectFit" src="/static/images/person.png"></image>
<input class="li-ipt" :value="props.brand_id" placeholder="请输入品牌ID"
<input class="li-ipt" type="number" :value="props.brand_id" placeholder="请输入品牌ID"
@input="emit('update:brand_id', $event.detail.value)"/>
</view>
<view class="lf-item">
@ -13,7 +13,7 @@
</view>
<view class="lf-item">
<image class="li-icon" mode="aspectFit" src="/static/images/lock.png"></image>
<input class="li-ipt" type="safe-password"
<input class="li-ipt" type="digit"
:password="true" :value="props.password" placeholder="请输入登录密码"
@input="emit('update:password', $event.detail.value)"/>
</view>

4
uniapp_project_code/src/components/login/pads_picker.vue

@ -1,11 +1,11 @@
<template>
<view class="pads-picker">
<view class="pp-content">
<view class="pc-text">请选择平板</view>
<view class="pc-text">请选择门店</view>
<view class="pc-frame">
<picker class="pt-picker" mode="selector" :range="padList" @change="padBindChange">
<view class="pp-box">
<view class="pb-text">{{ padList[selectIndex]|| '请选择平板'}}</view>
<view class="pb-text">{{ padList[selectIndex]|| '请选择门店'}}</view>
<image class="pt-icon" mode="aspectFtt" src="/static/images/triangle.png"></image>
</view>
</picker>

267
uniapp_project_code/src/components/login/setting_mask.vue

@ -1,111 +1,184 @@
<template>
<view class="setting-mask">
<view class="sm-content">
<image class="sc-close" mode="aspectFit" src="/static/images/close.png" @click="handle_closeSetting"></image>
<view class="sc-title">平板信息配置</view>
<view class="sc-container">
<view class="sc-line">
<view class="sl-desc">当前设备名称收银端</view>
<button class="sd-btn" @click="logout">退出登录</button>
</view>
<view class="sc-line">
<view class="setting-mask">
<view class="sm-content">
<image class="sc-close" mode="aspectFit" src="/static/images/close.png" @click="handle_closeSetting">
</image>
<view class="sc-title">平板配置</view>
<view class="sc-container">
<view class="sc-line">
<view class="sl-desc">设备账号控制</view>
<button class="sd-btn" @click="logout">退出登录</button>
</view>
<view class="sc-line">
<view class="sl-desc">进程守护切换</view>
<button class="sd-btn" @click="selectDaemon">/</button>
</view>
<view class="sc-line">
<view class="sl-desc">程序版本更新</view>
<button class="sd-btn" @click="updateApp">前往更新</button>
</view>
<!-- <view class="sc-line">
<view class="sl-desc">屏幕适配设置</view>
</view>
</view>
</view>
</view>
</view> -->
</view>
</view>
</view>
</template>
<script setup>
import util from '../../utils/util';
// #ifdef APP-PLUS
const Daemon_Uni = uni.requireNativePlugin('Daemon_Uni');
// #endif
//
const emits = defineEmits(['closeSetting'])
const handle_closeSetting = ()=>{
emits("closeSetting","false")
const handle_closeSetting = () => {
emits("closeSetting", "false")
}
const logout = () => {
console.log("logout")
uni.showModal({
title: '提示',
content: '确定退出登录?',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
handle_logout()
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
const handle_logout = () => {
getApp().globalData.stadiumInfo = {}
getApp().globalData.accountInfo = {}
uni.removeStorageSync("stadiumInfo")
uni.removeStorageSync("accountInfo")
uni.removeStorageSync("userInfo")
uni.reLaunch({
url: '/pages/login/index'
});
}
const selectDaemon = () => {
let _arr = ["开启-进程守护", "关闭-进程守护"];
uni.showActionSheet({
itemList: _arr,
success: async function(res) {
let _sel = _arr[res.tapIndex]
let _val = ""
console.log('选中了第' + (res.tapIndex + 1) + '个按钮' + _sel);
// #ifdef APP-PLUS
if (res.tapIndex == 0) {
Daemon_Uni.startWatchDog({
"api_name": "",
}, (ret) => {
console.log(ret)
util.showNone("开启")
})
} else {
Daemon_Uni.closeWatchDog({
"api_name": "",
}, (ret) => {
console.log(ret)
util.showNone("关闭")
})
}
// #endif
console.log("daemonRun", _sel, _val)
},
fail: function(res) {
console.log(res.errMsg);
}
})
}
const logout = ()=>{
console.log("logout")
uni.showModal({
title: '提示',
content: '确定退出登录?',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
handle_logout()
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
const handle_logout = ()=>{
getApp().globalData.stadiumInfo = {}
getApp().globalData.accountInfo = {}
uni.removeStorageSync("stadiumInfo")
uni.removeStorageSync("accountInfo")
uni.removeStorageSync("userInfo")
uni.reLaunch({
url: '/pages/login/index'
});
}
const updateApp = () => {
util.showNone("")
uni.showModal({
title: '提示',
content: '跳转更新前,请先关闭进程守护',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
plus.runtime.openURL('https://www.pgyer.com/oxcheckoutpad', function(
res) {}); //console.log(res);
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
</script>
<style lang="scss">
.setting-mask{
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, .5);
.sm-content{
position: absolute;
top: 0;
right: 0;
padding-top: 69.4upx;
width: 559upx;
height: 100%;
background: #fff;
.sc-close{
position: absolute;
right: 28.33upx;
top: 18.76upx;
width: 34.51upx;
height: 34.51upx;
}
.sc-title{
text-align: center;
@include flcw(22.5upx, 31.25upx, #1B1B1B, 500);
}
.sc-container{
margin-top: 52.22upx;
padding: 0 20.39upx;
.sc-line{
@include ctf;
&+.sc-line{
margin-top: 6.57upx;
}
.sl-desc{
@include flcw(16.88upx, 23.61upx, #1B1B1B, 500);
@include tHide;
}
.sd-btn{
@include clearBtn;
flex-shrink: 0;
margin-left: 26upx;
text-align: center;
width: 120upx;
background: $mColor;
border-radius: 6.56upx;
@include flcw(16.88upx, 41.26upx, #fff, 500);
}
}
}
}
}
.setting-mask {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, .5);
.sm-content {
position: absolute;
top: 0;
right: 0;
padding-top: 69.4upx;
width: 559upx;
height: 100%;
background: #fff;
.sc-close {
position: absolute;
right: 28.33upx;
top: 18.76upx;
width: 34.51upx;
height: 34.51upx;
}
.sc-title {
text-align: center;
@include flcw(22.5upx, 31.25upx, #1B1B1B, 500);
}
.sc-container {
margin-top: 52.22upx;
padding: 0 20.39upx;
.sc-line {
@include ctf;
&+.sc-line {
margin-top: 6.57upx;
}
.sl-desc {
@include flcw(16.88upx, 23.61upx, #1B1B1B, 500);
@include tHide;
}
.sd-btn {
@include clearBtn;
flex-shrink: 0;
margin-left: 26upx;
text-align: center;
width: 120upx;
background: $mColor;
border-radius: 6.56upx;
@include flcw(16.88upx, 41.26upx, #fff, 500);
}
}
}
}
}
</style>

89
uniapp_project_code/src/pages/index/index.vue

@ -122,7 +122,8 @@
},
async onLoad(res) {
console.log("onload:", res)
this.searchGoodBySku = util.searchGoodBySku
if(res.skulist){
this.acceptSKUList(res.skulist)
}
@ -166,8 +167,10 @@
let shopListData = this.shopList.map(item => {
return {
id: item.erp_goods.id,
name: item.erp_goods.erp_goods_name,
price: item.erp_goods.erp_goods_price,
// name: item.erp_goods.erp_goods_name,
// price: item.erp_goods.erp_goods_price,
name:item.goods_name,
price:item.user_price,
nums: item.shopCount,
unit: item.erp_goods.erp_goods_unit
}
@ -219,21 +222,34 @@
util.showNone("会员登录")
this.showEndPhoneBox = !this.showEndPhoneBox
},
combinedList(list1, list2) {
combinedList(list1, list2) {//list,list
//skulist, , ,
console.log("combinedList", list1, list2)
if(!list2)return util.showNone("未找到商品")
let _list = list1
let _list_cannot_add = []
let _list_can_add = []
list2.forEach(item => {
let _index = _list.findIndex(_item => _item.id == item.id)
if (_index != -1) {
_list[_index].shopCount += 1
_list[_index].shopCountPrice = _list[_index].erp_goods.erp_goods_price * _list[_index].shopCount
} else {
_list.push(item)
if (_index != -1) {//
if(this.checkStock(_list[_index])){
this.handle_add(_index)
}else{
_list_cannot_add.push(item)
}
// _list[_index].shopCount += 1
// _list[_index].shopCountPrice = _list[_index].erp_goods.erp_goods_price * _list[_index].shopCount
} else {//
_list_can_add.push(item)
}
})
_list.push(..._list_can_add)
console.log("_list_cannot_add:",_list_cannot_add)
if(_list_cannot_add.length>0){
util.showNone("存在库存不足商品")
}
return _list
},
async setFooterHeight() {
@ -294,20 +310,27 @@
},
handle_add(i) {
console.log("handle_add", i)
if(!this.checkStock(this.shopList[i])) return util.showNone("该商品库存不足")
this.shopList[i].shopCount++
this.shopList[i].shopCountPrice = (this.shopList[i].erp_goods?.erp_goods_price || 0) * this.shopList[i]
this.shopList[i].shopCountPrice = (this.shopList[i].user_price || 0) * this.shopList[i]
.shopCount
},
handle_minus(i) {
console.log("handle_minus", i)
if (this.shopList[i].shopCount > 1) {
this.shopList[i].shopCount--
this.shopList[i].shopCountPrice = (this.shopList[i].erp_goods?.erp_goods_price || 0) * this.shopList[i]
this.shopList[i].shopCountPrice = (this.shopList[i].user_price || 0) * this.shopList[i]
.shopCount
} else {
util.showNone("商品数量不能小于1")
}
},
checkStock(item){ //
let item_stock = item.erp_goods.stock_num
let use_stock = item.shopCount||0
if (item_stock-use_stock>=1)return true
return false
},
handle_del(i) {
let that = this
console.log("handle_del", i)
@ -373,6 +396,12 @@
let _list = await this.getGoodsList()
//
console.log("app.globaldata: ", app.globalData)
//
// _list.list = _list.list.map(e=>{
// e.erp_goods.stock_num = 2
// return e
// })
app.globalData.goodsList = _list
},
//
@ -399,25 +428,31 @@
//res.listshopCountPrice,shopCount
res.list.forEach(item => {
item.shopCount = 1
item.shopCountPrice = item.erp_goods.erp_goods_price
// item.shopCountPrice = item.erp_goods.erp_goods_price
item.shopCountPrice = item.user_price
})
return res
})
},
searchGoodBySku(sku) {
return new Promise((resolve, reject) => {
let _list = app.globalData.goodsList.list
// let _good = _list.find(item=>item.erp_goods.erp_goods_sku == sku)
//sku,
let _goods = _list.filter(item => item.erp_goods.erp_goods_sku == sku)
if (_goods.length) {
resolve(_goods)
} else {
reject(false)
}
})
},
// searchGoodBySku(sku) {
// console.error(1231231)
// return new Promise((resolve, reject) => {
// let _list = app.globalData.goodsList.list
// // let _good = _list.find(item=>item.erp_goods.erp_goods_sku == sku)
// //sku,
// let _goods = _list.filter(item => {
// let sku_check = (item.erp_goods.erp_goods_sku == sku)
// let stock_check = (item.erp_goods.stock_num>100)
// console.log(999,item,sku_check,stock_check)
// return sku_check&&stock_check
// })
// if (_goods.length) {
// resolve(_goods)
// } else {
// reject(false)
// }
// })
// },
}
}

23
uniapp_project_code/src/pages/index/standby.vue

@ -77,9 +77,9 @@ export default {
},
async onLoad(res) {
console.log("onload:", res)
this.searchGoodBySku = util.searchGoodBySku
// this.test()
// this.showPageStandby = true
console.log(123,print.testPrintInfo,print.resetOXPrintInfo(print.testPrintInfo))
},
async onReady() {
// this.screenHeight = await util.getPageHeight()
@ -97,7 +97,7 @@ export default {
let skulist = await this.searchGoodBySku("10000012")
this.shopList = this.shopList.concat(skulist)
},
combinedList(list1, list2) {
console.log("combinedList", list1, list2)
@ -108,7 +108,7 @@ export default {
let _index = _list.findIndex(_item => _item.id == item.id)
if (_index != -1) {
_list[_index].shopCount += 1
_list[_index].shopCountPrice = _list[_index].erp_goods.erp_goods_price * _list[_index].shopCount
_list[_index].shopCountPrice = _list[_index].user_price * _list[_index].shopCount
} else {
_list.push(item)
}
@ -218,25 +218,12 @@ export default {
//res.listshopCountPrice,shopCount
res.list.forEach(item => {
item.shopCount = 1
item.shopCountPrice = item.erp_goods.erp_goods_price
item.shopCountPrice = item.user_price
})
return res
})
},
searchGoodBySku(sku) {
return new Promise((resolve, reject) => {
let _list = app.globalData.goodsList.list
// let _good = _list.find(item=>item.erp_goods.erp_goods_sku == sku)
//sku,
let _goods = _list.filter(item => item.erp_goods.erp_goods_sku == sku)
if (_goods.length) {
resolve(_goods)
} else {
reject(false)
}
})
},
}
}

45
uniapp_project_code/src/pages/login/index.vue

@ -13,8 +13,7 @@
></login-form>
</view>
<view class="li-tip" @click="testPrinter">*登录账号密码请从pc端后台管理设备运营管理平板管理里获取</view>
<view class="li-tip" @click="testPH">*登录账号密码请从pc端后台管理222222里获取</view>
<view class="li-tip" @click="">*登录账号密码请从pc端后台管理设备运营管理平板管理里获取</view>
<view class="li-btn">
<login-button @click="clickLogin">登录</login-button>
@ -26,11 +25,8 @@
<script setup>
// #ifdef APP-PLUS
// const modal = uni.requireNativePlugin('modal');
const ox_pad_printer = uni.requireNativePlugin('OX_Pad_Printer');
const ph_module = uni.requireNativePlugin('Ph-Module');
const tmodule = uni.requireNativePlugin('TestModule');
// const ox_pad_printer = uni.requireNativePlugin('OX_Pad_Printer');
// const tmodule = uni.requireNativePlugin('TestModule');
// #endif
import loginBackground from '@/components/login/background.vue';
@ -52,7 +48,6 @@
} from 'vue'
import { onLoad,onReady } from '@dcloudio/uni-app';
import md5 from '@/utils/md5.js'
import print from "@/utils/print";
onReady(async () => {
autoLogin()
@ -69,49 +64,15 @@
const update_brand_id = (val)=>{brand_id.value = val}
//,,
function testPH(){
tmodule.testAsyncFunc({
'testPrinter':"testPrinter",
})
}
function testPrinter2(){
ox_pad_printer.execAPI({
'testPrinter111':"testPrinter111",
})
}
function testPrinter(){
console.log("OX_Pad_Printer test------begin---!")
// OX_Pad_Printer.execAPI_Printer(
// {
// 'testPrinter':"testPrinter" ,
// },
// ret => {
// console.log("testPrinter " + JSON.stringify(ret))
// }
// );
let obj = print.resetOXPrintInfo(print.testPrintInfo)
ox_pad_printer.execAPI({
api_name:"doPrint",
value:obj
},ret => {
console.log("testPrinter: " + JSON.stringify(ret))
})
// OX_Pad_Printer.execAPI_Printer(
// {
// 'api_name': "doPrint",
// // 'value': obj
// },
// ret => {
// console.log("testPrinter " + JSON.stringify(ret))
// }
// );
// console.log(123,print.testPrintInfo,print.resetOXPrintInfo(print.testPrintInfo))
}
function testmd5(){
console.log("testmd5-------------------")

2
uniapp_project_code/src/pages/login/success.vue

@ -13,7 +13,7 @@
<login-button @click="clickJumpIndex">进入使用</login-button>
</view>
<view class="ls-links">
<view class="ll-item" @click="clickUpdate">更新</view>
<!-- <view class="ll-item" @click="clickUpdate">更新</view> -->
<view class="ll-item" @click="clickUpdatePadList">更新门店</view>
<view class="ll-item" @click="clickSetting">设置</view>
</view>

146
uniapp_project_code/src/pages/pay/index.vue

@ -19,6 +19,10 @@
</template>
<script>
// #ifdef APP-PLUS
const ox_pad_printer = uni.requireNativePlugin('OX_Pad_Printer');
// #endif
import print from "@/utils/print";
import util from "@/utils/util.js"
import {
API
@ -26,7 +30,6 @@
import {
ox
} from "@/utils/server";
import print from "@/utils/print";
import dictKeyboard from '@/utils/dictOfKeyboard'
import viewHeader from '@/components/index/view_header.nvue';//
@ -47,7 +50,7 @@
},
computed: {
payTotal() {//
let _payTotal = this.dataQuery.amount
let _payTotal = this.dataQuery.amount||0
return _payTotal.toFixed(2)||"0.00"
}
},
@ -68,7 +71,10 @@
},
async onLoad(res) {
console.log("pay onload:",res)
this.setPayData(res)
if(res){this.setPayData(res)}
// let resres = this.getTestPrintData()
// this.printOrder(resres)
},
async onReady() {
await this.setPageHeight()
@ -110,6 +116,7 @@
util.showNone("支付类型未知,请重试!")
return
}
await this.makeOrder((makeInfo)=>{
console.log("makeInfo-result",makeInfo)
}).then((orderInfo)=>{
@ -128,6 +135,7 @@
if(checkRes.pay_order.status == "1"){
util.showNone(checkRes.res.respMsg)
this.paySuccessStatus = 1
this.printOrder(checkInfo)
}else{
// util.showNone(checkRes.res.respMsg+"-"+checkRes.res.respCode)
uni.showModal({
@ -146,22 +154,140 @@
util.hideLoad()
})
},
printOrder(){
printOrder(checkInfo){
console.warn("printOrder checkInfo: ",checkInfo)
util.showNone("小票打印中...")
let {store_id,brand_id,token} = getApp().globalData.accountInfo
let stadiumInfo = uni.getStorageSync('stadiumInfo')
let {venue_name} = stadiumInfo
let {goods_data,amount} = this.dataQuery
let {finishedDate:time,transNo:order_no} = checkInfo.payRes.res
time = this.getTimeFromFinishedDate(time)
let {time,order_no} = this.paySuccessInfo
let {venue_name} = stadiumInfo
let print_info = {
...dataQuery,venue_name,time,order_no
...this.dataQuery,venue_name,time,order_no
}
console.log("print_info:",print_info)
// console.log("print_info:",print_info)
//TODO
// print.resetOXPrintInfo(print.testPrintInfo)
let obj = print.resetOXPrintInfo(print_info)
console.log("uni call android OX_Pad_Printer ------begin---!",obj)
// #ifdef APP-PLUS
return ox_pad_printer.execAPI({
api_name:"doPrint",
value:obj
},ret => {
console.log("ox_pad_printer doPrint result: " + JSON.stringify(ret))
})
// #endif
console.warn("请在APP离线打包环境测试打印功能")
print.resetOXPrintInfo(print.testPrintInfo)
},
getTimeFromFinishedDate(finishedDate) {
console.log(finishedDate)
//
let year = finishedDate.substring(0, 4);
let month = finishedDate.substring(4, 6);
let day = finishedDate.substring(6, 8);
let hour = finishedDate.substring(8, 10);
let minute = finishedDate.substring(10, 12);
let second = finishedDate.substring(12, 14);
//
let formattedDate = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
//
return formattedDate;
},
getTestPrintData(){
return {
"payRes": {
"order_no": "LS20240221105640796608",
"pay_code": "282659672061313993",
"pay_type": "ALI_BARCODEPAY",
"orderAmt": "1",
"transNo": "LS20240221105640796608",
"res": {
"channelOrderNo": "350105100000000000000382731226",
"finishedDate": "20240221105643",
"orderAmt": "1",
"orderStatus": "SUCCESS",
"payOrderNo": "322024022122001464831442986322",
"payType": "ALI_BARCODEPAY",
"respCode": "000000",
"respMsg": "交易成功",
"tradeNo": "19010520240221105641100306264795",
"transNo": "LS20240221105640796608"
}
},
"checkRes": {
"err": null,
"pay_order": {
"id": 1143536,
"appid": "",
"mchId": "ouxuanmchid-2d4af93d5fb4",
"user": "",
"out_trade_no": "LS20240221105640796608",
"transaction_id": "",
"group": "63",
"pay_way": "HuiShouQian",
"call_way": "WeChatMiniApp",
"total_fee": 0.01,
"refund_total_fee": 0,
"Title": "",
"subject": "零售订单",
"status": 1,
"refund_status": 0,
"flag": 0,
"tags": null,
"extension": {
"brand_id": 63,
"brand_stadium_logo": "https://imgcdn.ouxuanzhineng.cn/upload/63/logo/6b36b6b89557a7b7d90904f1a943a311.png",
"brand_stadium_name": "Test门店",
"stadium_id": 167,
"total_fee": 0.01,
"transaction_id": ""
},
"error_log": "",
"is_profit_sharing": 0,
"usefulness": "erp_goods_retail",
"medium": "money",
"invoice_status": "None",
"is_enable_expiration": 1,
"expiration_time": "2024-02-21T11:26:40+08:00",
"payment_time": "",
"remaining_refund": null
},
"res": {
"channelOrderNo": "350105100000000000000382731226",
"finishedDate": "20240221105644",
"goodsInfo": "LS20240221105640796608",
"memo": "{\"timeExpire\":\"20240221105746\",\"latitude\":\"0\",\"spbillCreateIp\":\"127.0.0.1\",\"longitude\":\"0\"}",
"orderAmt": "1",
"orderStatus": "SUCCESS",
"payOrderNo": "322024022122001464831442986322",
"payType": "ALI_BARCODEPAY",
"requestDate": "20240221105641",
"respCode": "000000",
"respMsg": "交易成功",
"tradeNo": "19010520240221105641100306264795",
"transNo": "LS20240221105640796608"
}
}
}
},
testPrinter(){
console.log("OX_Pad_Printer test------begin---!")
let obj = print.resetOXPrintInfo(print.testPrintInfo)
ox_pad_printer.execAPI({
api_name:"doPrint",
value:obj
},ret => {
console.log("testPrinter: " + JSON.stringify(ret))
})
},
async makeOrder(){
let {store_id,brand_id,token} = getApp().globalData.accountInfo

517
uniapp_project_code/src/pages/pay/readme.md

@ -0,0 +1,517 @@
```
pay onload:
{
"query": "{\"shopList\":[{\"id\":32,\"name\":\"乔丹篮球\",\"price\":0.01,\"nums\":1,\"unit\":\"个\"}],\"shopListTotalPrice\":0.01,\"shopListTotalCount\":1}"
}
makeOrder suc:
{
"order": {
"id": 851,
"created_at": "2024-02-21 10:56:40",
"updated_at": "2024-02-21 10:56:40",
"retail_order_goods": [
{
"id": 32,
"name": "123456",
"namereal": "",
"price": 0,
"nums": 1,
"unit": "个",
"spec": "中型",
"erp_retail_goods": {
"id": 32,
"created_at": "2022-06-17 14:17:14",
"updated_at": "2023-11-08 16:56:25",
"brand_id": 63,
"stadium_id": 151,
"erp_goods_id": 32,
"goods_name": "123456",
"goods_type_key": "be46949a-eafa-11ec-869b-5254005df464",
"goods_img": "https://imgcdn.ouxuanzhineng.cn/upload/63/151/retailGoods/db9b6fea692e54e3c1291599af9b621a.jpg",
"goods_desc": "",
"is_sale": true,
"is_show_on_user": true,
"is_show_on_assistant": true,
"assistant_price": 0,
"user_price": 0,
"weights": 0,
"extension": {
"retail_codes": [
1
],
"user_level_price_list": [
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 10,
"user_level_name": "游客"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 12,
"user_level_name": "白银"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 15,
"user_level_name": "钻石"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 16,
"user_level_name": "至尊黑会员"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 35,
"user_level_name": "超级会员"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 42,
"user_level_name": "分销商白银身份等级"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 39,
"user_level_name": "无敌会员"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 40,
"user_level_name": "高高高会员"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 44,
"user_level_name": "分销商铂金用户身份"
}
]
},
"erp_goods": {
"id": 32,
"created_at": "2021-04-25 14:18:42",
"updated_at": "2021-09-22 10:40:07",
"erp_goods_name": "乔丹篮球",
"erp_goods_cid": 18,
"erp_goods_sku": "1000000005",
"erp_goods_unit": "个",
"erp_goods_type": "成人",
"erp_goods_specs": "中型",
"erp_goods_brandid": 63,
"erp_goods_price": 0.01,
"stock_num": 0
},
"cate_name": "",
"underlined_price": 0,
"underlined_price_show": false
}
}
],
"sys_optuname": "ou",
"other_pay_type": "",
"brand_id": 63,
"stadium_id": 167,
"user_id": 0,
"amount": 0.01,
"pay_amount": 0.01,
"refund_amount": 0,
"integral": 0,
"deduction_integral": 0,
"refund_integral": 0,
"deduction_amount": 0,
"refund_deduction_amount": 0,
"coupons_amount": 0,
"discount_amount": 0,
"coupon_ids": null,
"pay_status": 0,
"pay_time": "",
"success_time": "",
"refund_no": "",
"refund_reason": "",
"refund_time": "",
"pay_type": 7,
"card_no": "",
"trade_no": "",
"order_no": "LS20240221105640796608",
"desc": "",
"source": "欧轩测试体育场馆",
"pay_info": null,
"extension": {
"consume_record_admin_type_params": {
"admin_id": 722,
"admin_type": "back"
},
"offline_pay_params": {
"amount": 0.01,
"brand_id": 63,
"card_no": "",
"mark": "",
"order_no": "LS20240221105640796608",
"pay_type": ""
},
"pay_type_text": ""
},
"order_category": "",
"ori_goods": null,
"mobile": "",
"nickname": "",
"source_type": 0,
"retail_source": "商家助手(ou)",
"retail_code_id": 29,
"operator": "",
"brand_name": "",
"stadium_name": "",
"stadium_logo": "",
"pay_status_text": "",
"refund_records": null
},
"order_no": "LS20240221105640796608"
}
orderInfo-result
{
"order": {
"id": 851,
"created_at": "2024-02-21 10:56:40",
"updated_at": "2024-02-21 10:56:40",
"retail_order_goods": [
{
"id": 32,
"name": "123456",
"namereal": "",
"price": 0,
"nums": 1,
"unit": "个",
"spec": "中型",
"erp_retail_goods": {
"id": 32,
"created_at": "2022-06-17 14:17:14",
"updated_at": "2023-11-08 16:56:25",
"brand_id": 63,
"stadium_id": 151,
"erp_goods_id": 32,
"goods_name": "123456",
"goods_type_key": "be46949a-eafa-11ec-869b-5254005df464",
"goods_img": "https://imgcdn.ouxuanzhineng.cn/upload/63/151/retailGoods/db9b6fea692e54e3c1291599af9b621a.jpg",
"goods_desc": "",
"is_sale": true,
"is_show_on_user": true,
"is_show_on_assistant": true,
"assistant_price": 0,
"user_price": 0,
"weights": 0,
"extension": {
"retail_codes": [
1
],
"user_level_price_list": [
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 10,
"user_level_name": "游客"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 12,
"user_level_name": "白银"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 15,
"user_level_name": "钻石"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 16,
"user_level_name": "至尊黑会员"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 35,
"user_level_name": "超级会员"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 42,
"user_level_name": "分销商白银身份等级"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 39,
"user_level_name": "无敌会员"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 40,
"user_level_name": "高高高会员"
},
{
"enable": false,
"price": 0,
"underline_price": 0,
"user_level_config_item_id": 44,
"user_level_name": "分销商铂金用户身份"
}
]
},
"erp_goods": {
"id": 32,
"created_at": "2021-04-25 14:18:42",
"updated_at": "2021-09-22 10:40:07",
"erp_goods_name": "乔丹篮球",
"erp_goods_cid": 18,
"erp_goods_sku": "1000000005",
"erp_goods_unit": "个",
"erp_goods_type": "成人",
"erp_goods_specs": "中型",
"erp_goods_brandid": 63,
"erp_goods_price": 0.01,
"stock_num": 0
},
"cate_name": "",
"underlined_price": 0,
"underlined_price_show": false
}
}
],
"sys_optuname": "ou",
"other_pay_type": "",
"brand_id": 63,
"stadium_id": 167,
"user_id": 0,
"amount": 0.01,
"pay_amount": 0.01,
"refund_amount": 0,
"integral": 0,
"deduction_integral": 0,
"refund_integral": 0,
"deduction_amount": 0,
"refund_deduction_amount": 0,
"coupons_amount": 0,
"discount_amount": 0,
"coupon_ids": null,
"pay_status": 0,
"pay_time": "",
"success_time": "",
"refund_no": "",
"refund_reason": "",
"refund_time": "",
"pay_type": 7,
"card_no": "",
"trade_no": "",
"order_no": "LS20240221105640796608",
"desc": "",
"source": "欧轩测试体育场馆",
"pay_info": null,
"extension": {
"consume_record_admin_type_params": {
"admin_id": 722,
"admin_type": "back"
},
"offline_pay_params": {
"amount": 0.01,
"brand_id": 63,
"card_no": "",
"mark": "",
"order_no": "LS20240221105640796608",
"pay_type": ""
},
"pay_type_text": ""
},
"order_category": "",
"ori_goods": null,
"mobile": "",
"nickname": "",
"source_type": 0,
"retail_source": "商家助手(ou)",
"retail_code_id": 29,
"operator": "",
"brand_name": "",
"stadium_name": "",
"stadium_logo": "",
"pay_status_text": "",
"refund_records": null
},
"order_no": "LS20240221105640796608"
}
payOrder suc:
{
"data": {
"Type": 5,
"Raw": "{\"success\":true,\"result\":\"{\\\"channelOrderNo\\\":\\\"350105100000000000000382731226\\\",\\\"finishedDate\\\":\\\"20240221105643\\\",\\\"orderAmt\\\":\\\"1\\\",\\\"orderStatus\\\":\\\"SUCCESS\\\",\\\"payOrderNo\\\":\\\"322024022122001464831442986322\\\",\\\"payType\\\":\\\"ALI_BARCODEPAY\\\",\\\"respCode\\\":\\\"000000\\\",\\\"respMsg\\\":\\\"交易成功\\\",\\\"tradeNo\\\":\\\"19010520240221105641100306264795\\\",\\\"transNo\\\":\\\"LS20240221105640796608\\\"}\",\"errorCode\":null,\"errorMsg\":null,\"sign\":\"6060dbad95d51e5c9f89906fbea25284766b7ea84d63decbf532cf060b7b616c84611088aca66b2a21a929dc82dc8ec95148874e1f7bd4c0ed978044720722a0e5a485ac9e5cdccb6beaf4747b251f0b03d93f3e9d96bbc00085f7aaa1c90785f17b127993014474e5fbbd9f59cc28c1c9a5f9c11c226a8a78be3e92c00f6d9aa398636aaf2581a6083cc6494262db2d3fa8fc97c3c6f3ed6b1c8afa50eef177575b78cb4db9f60cd18a700ddd3a83ba72fbf1414768c430f49f381642bc803fcd629dcde6f9f3b268bbb927d0859871504107721f80ccdc4436d3a3e800477283a7906d3605acc8ff931a196071b99fb3914f0668cfdd90f9c09e8062e19508\"}",
"Str": "",
"Num": 0,
"Index": 0,
"Indexes": null
},
"err2": null,
"res": {
"channelOrderNo": "350105100000000000000382731226",
"finishedDate": "20240221105643",
"orderAmt": "1",
"orderStatus": "SUCCESS",
"payOrderNo": "322024022122001464831442986322",
"payType": "ALI_BARCODEPAY",
"respCode": "000000",
"respMsg": "交易成功",
"tradeNo": "19010520240221105641100306264795",
"transNo": "LS20240221105640796608"
}
}
payInfo-result:
{
"order_no": "LS20240221105640796608",
"pay_code": "282659672061313993",
"pay_type": "ALI_BARCODEPAY",
"orderAmt": "1",
"transNo": "LS20240221105640796608",
"res": {
"channelOrderNo": "350105100000000000000382731226",
"finishedDate": "20240221105643",
"orderAmt": "1",
"orderStatus": "SUCCESS",
"payOrderNo": "322024022122001464831442986322",
"payType": "ALI_BARCODEPAY",
"respCode": "000000",
"respMsg": "交易成功",
"tradeNo": "19010520240221105641100306264795",
"transNo": "LS20240221105640796608"
}
}
checkOrder suc:
{
"order_no": "LS20240221105640796608",
"pay_code": "282659672061313993",
"pay_type": "ALI_BARCODEPAY",
"orderAmt": "1",
"transNo": "LS20240221105640796608",
"res": {
"channelOrderNo": "350105100000000000000382731226",
"finishedDate": "20240221105643",
"orderAmt": "1",
"orderStatus": "SUCCESS",
"payOrderNo": "322024022122001464831442986322",
"payType": "ALI_BARCODEPAY",
"respCode": "000000",
"respMsg": "交易成功",
"tradeNo": "19010520240221105641100306264795",
"transNo": "LS20240221105640796608"
}
}
最终checkInfo:
{
"payRes": {
"order_no": "LS20240221105640796608",
"pay_code": "282659672061313993",
"pay_type": "ALI_BARCODEPAY",
"orderAmt": "1",
"transNo": "LS20240221105640796608",
"res": {
"channelOrderNo": "350105100000000000000382731226",
"finishedDate": "20240221105643",
"orderAmt": "1",
"orderStatus": "SUCCESS",
"payOrderNo": "322024022122001464831442986322",
"payType": "ALI_BARCODEPAY",
"respCode": "000000",
"respMsg": "交易成功",
"tradeNo": "19010520240221105641100306264795",
"transNo": "LS20240221105640796608"
}
},
"checkRes": {
"err": null,
"pay_order": {
"id": 1143536,
"appid": "",
"mchId": "ouxuanmchid-2d4af93d5fb4",
"user": "",
"out_trade_no": "LS20240221105640796608",
"transaction_id": "",
"group": "63",
"pay_way": "HuiShouQian",
"call_way": "WeChatMiniApp",
"total_fee": 0.01,
"refund_total_fee": 0,
"Title": "",
"subject": "零售订单",
"status": 1,
"refund_status": 0,
"flag": 0,
"tags": null,
"extension": {
"brand_id": 63,
"brand_stadium_logo": "https://imgcdn.ouxuanzhineng.cn/upload/63/logo/6b36b6b89557a7b7d90904f1a943a311.png",
"brand_stadium_name": "Test门店",
"stadium_id": 167,
"total_fee": 0.01,
"transaction_id": ""
},
"error_log": "",
"is_profit_sharing": 0,
"usefulness": "erp_goods_retail",
"medium": "money",
"invoice_status": "None",
"is_enable_expiration": 1,
"expiration_time": "2024-02-21T11:26:40+08:00",
"payment_time": "",
"remaining_refund": null
},
"res": {
"channelOrderNo": "350105100000000000000382731226",
"finishedDate": "20240221105644",
"goodsInfo": "LS20240221105640796608",
"memo": "{\"timeExpire\":\"20240221105746\",\"latitude\":\"0\",\"spbillCreateIp\":\"127.0.0.1\",\"longitude\":\"0\"}",
"orderAmt": "1",
"orderStatus": "SUCCESS",
"payOrderNo": "322024022122001464831442986322",
"payType": "ALI_BARCODEPAY",
"requestDate": "20240221105641",
"respCode": "000000",
"respMsg": "交易成功",
"tradeNo": "19010520240221105641100306264795",
"transNo": "LS20240221105640796608"
}
}
}
```

4
uniapp_project_code/src/utils/api.js

@ -1,5 +1,5 @@
// export const ORIGIN = `http://ouxuanmaganer.ouxuanzhineng.cn`; // 正式
export const ORIGIN = `https://testmanager.ouxuanzhineng.cn`; // 测试
export const ORIGIN = `http://ouxuanmaganer.ouxuanzhineng.cn`; // 正式
// export const ORIGIN = `https://testmanager.ouxuanzhineng.cn`; // 测试
export const API = {

1
uniapp_project_code/src/utils/print.js

@ -1,4 +1,5 @@
function resetOXPrintInfo(printInfo) {
let data = [];
// 遍历 printInfo 中的 goods_data 数组,对每个商品对象进行处理
let line_46mm = "-------------------------------\n";

34
uniapp_project_code/src/utils/util.js

@ -1,6 +1,7 @@
// import {emojiMap,emojiUrl} from './emojiMap';
import md5 from './md5';
import qs from 'qs';
import api from './api.js'
export const phoneReg = new RegExp(/^1(3|4|5|6|7|8|9)\d{9}$/);
export const mailReg = new RegExp(/^\w+((.\w+)|(-\w+))@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+).[A-Za-z0-9]+$/);
@ -527,6 +528,8 @@ function encrypt(config) {
let t = parseInt(new Date().getTime() / 1000 - config.timeDifference);
let s = a + '|1ba2212f78610369467de90fb1e3d345|' + b + '|4e68cd333457cb297a05ec7f77a9ad978b56cf57|' + t;
console.warn("签名",s)
let md5_str = md5.hex_md5(s)
return { S: md5_str, T: t }
}
@ -543,6 +546,7 @@ function updateTimeDifference(extension){
// 重置请求头,增加鉴权校验
function resetHeader(header,url,data,params){
url = filterUrl(url)
// if(Object.keys(header).length == 0){} //check header {}
let timeDifference = getApp().globalData.timeDifference || 0
let {S,T} = encrypt({data,params,url,timeDifference})
@ -553,6 +557,35 @@ function resetHeader(header,url,data,params){
// 'Authorization': uni.getStorageSync('token') || '',
}
}
//按后端要求,更改url
function filterUrl(url){
let _url = url.split("?")[0]
_url = _url.split(api.ORIGIN) //['', '/admin/stadium/list']
return _url[_url.length-1]
}
function searchGoodBySku(sku) {
console.warn('searchGoodBySku:',sku)
return new Promise((resolve, reject) => {
let app = getApp();
let _list = app.globalData.goodsList.list
//sku可能不唯一, 返回数组
let _goods = _list.filter(item => {
let sku_check = (item.erp_goods.erp_goods_sku == sku)
let stock_check = (item.erp_goods.stock_num>1)
// console.log('erp stock check: ',item.erp_goods.erp_goods_sku,sku_check,stock_check)
console.log(sku,sku_check,item.erp_goods.stock_num)
return sku_check&&stock_check
})
if (_goods.length) {
resolve(_goods)
} else {
reject(false)
}
})
}
export default {
checkSerialPortMessage,
formatTime,
@ -596,4 +629,5 @@ export default {
getH5RefSize,
resetHeader,
updateTimeDifference,
searchGoodBySku
}
Loading…
Cancel
Save