Browse Source

v1.1.1 release

dev
赵明涛 11 months ago
parent
commit
55dedb655e
  1. 4
      app/build.gradle
  2. 2
      app/src/main/assets/apps/__UNI__3B4D40B/www/app-service.js
  3. 101
      uniapp_project_code/src/App.vue
  4. 5
      uniapp_project_code/src/components/index/keyboard/input_box_QR.vue
  5. 2
      uniapp_project_code/src/components/index/keyboard/view_keyboard.vue
  6. 2
      uniapp_project_code/src/components/index/list_item.vue
  7. 73
      uniapp_project_code/src/components/login/setting_mask.vue
  8. 95
      uniapp_project_code/src/pages/index/index.vue
  9. 56
      uniapp_project_code/src/pages/index/standby.vue
  10. 18
      uniapp_project_code/src/pages/login/index.vue
  11. 55
      uniapp_project_code/src/pages/login/success.vue
  12. 214
      uniapp_project_code/src/pages/pay/index.vue
  13. 34
      uniapp_project_code/src/utils/server.js
  14. 46
      uniapp_project_code/src/utils/util.js
  15. 2
      uniplugin_padprinter/src/main/java/net/zmt/padprinter/Helper/Printer_Helper.java

4
app/build.gradle

@ -8,8 +8,8 @@ android {
minSdkVersion 21
targetSdkVersion 28 //21 io.dcloud.PandoraEntry apk入口时 targetSDKVersion>=21
versionCode 110
versionName "1.1.0"
versionCode 111
versionName "1.1.1"
multiDexEnabled true
ndk {
// abiFilters 'x86','armeabi-v7a'

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

101
uniapp_project_code/src/App.vue

@ -10,11 +10,15 @@
// onHide(() => {
// console.log("App Hide");
// });
import util from "@/utils/util.js"
import {API} from "@/utils/api";
import {ox} from "@/utils/server";
export default {
onLaunch() {
console.log("App Launch default");
this.globalData.autoLogin = true;
this.reloadUserInfo()
},
onShow() {
console.log("App Show default");
@ -24,35 +28,102 @@ export default {
},
globalData: {
autoLogin: false,
goodsList : [],
shopList : [],
accountInfo : {
brand_id: "63",
store_id: "167", //stadium_id
username: "Ella06",
password: "123456",
assistant_client:"PC",
token: "e6cabeae-0c1a-11ee-aa40-5254005df464",
role:""
},
stadiumInfo:{
goodsList: [],
shopList: [],
accountInfo: {},
// accountInfo : {
// brand_id: "63",
// store_id: "167", //stadium_id
// username: "Ella06",
// password: "123456",
// assistant_client:"PC",
// token: "e6cabeae-0c1a-11ee-aa40-5254005df464",
// role:""
// },
stadiumInfo: {
id: "", //stadium_id
brand_id: "",
venue_name:"",
venue_name: "",
},
loginInfo : {
loginInfo: {
phone: "",
password: "",
token: "",
vip: false,
},
payInfo : {
payInfo: {
payType: "",
paySuccess: false,
},
},
methods: {
reloadUserInfo(){
let _info = uni.getStorageSync('userInfo')
let app = getApp()
if(_info) app.globalData.accountInfo = _info
},
async updateGoodsList () {
return new Promise((resolve, reject) => {
let {brand_id,stadium_id,token} = util.getPostParams()
let urlParams = {
brand_id,stadium_id,token,
"type_key": "",
"key": "",
"page": "1",
"page_size": "9999",
"is_sale": "1",
"is_show_on_assistant": "1",
}
ox.post({
url: API.getGoodsList,
data: urlParams,
isDefaultGet: false,
failMsg: "获取商品列表失败"
})
.then(res => {
console.log("getGoodsList suc: ", res)
res = res.data.data
//res.listshopCountPrice,shopCount
res.list.forEach(item => {
item.shopCount = 1
// item.shopCountPrice = item.erp_goods.erp_goods_price
item.shopCountPrice = item.user_price
})
this.globalData.goodsList = res.list
resolve(res)
})
})
let {brand_id,stadium_id,token} = util.getPostParams()
let urlParams = {
brand_id,stadium_id,token,
"type_key": "",
"key": "",
"page": "1",
"page_size": "9999",
"is_sale": "1",
"is_show_on_assistant": "1",
}
return ox.post({
url: API.getGoodsList,
data: urlParams,
isDefaultGet: false,
failMsg: "获取商品列表失败"
})
.then(res => {
util.hideLoad();
console.log("getGoodsList suc: ", res)
//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
})
},
}
}

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

@ -41,7 +41,7 @@
},
maxInput: {
type: Number,
default: 10
default: 20
}
})
@ -164,7 +164,8 @@
color: #FF0000;
margin-left: 31.25rpx;
position: absolute;
top: 218.33rpx;
margin-top: 220rpx;
// top: 218.33rpx;
}
.input-keyboard {

2
uniapp_project_code/src/components/index/keyboard/view_keyboard.vue

@ -21,7 +21,7 @@
const props = defineProps({
maxInput: {
type: Number,
default: 11
default: 20
},
})

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

@ -29,7 +29,7 @@
<text class="brbr-score">{{mitem.score||0}}</text></view> -->
<view class="brbr-total-price">
<text class="brbrp-price1">¥</text>
<text class="brbrp-price2">{{mitem.shopCountPrice||"-"}}</text>
<text class="brbrp-price2">{{mitem.shopCountPrice.toFixed(2)||"-"}}</text>
</view>
</view>
</view>

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

@ -6,6 +6,27 @@
<view class="sc-title">平板配置</view>
<view class="sc-container">
<view class="sc-line">
<view class="sl-desc">品牌: {{getStadiumInfo.brand_name}}</view>
</view>
<view class="sc-line">
<view class="sl-desc">门店: {{getStadiumInfo.name}}</view>
</view>
<view class="sc-line">
<view class="sl-desc">门店ID: {{getStadiumInfo.id}}</view>
</view>
<!-- <view class="sc-line">
<view class="sl-desc">当前门店信息</view>
<button class="sd-btn sd-btn-unuse" @click="">{{getStadiumInfo.id}}</button>
</view> -->
<view class="sc-line">
<view class="sl-desc">本店商品总数</view>
<button class="sd-btn sd-btn-unuse" @click="">{{goodsListLength}}</button>
</view>
<view class="sc-line">
<view class="sl-desc">更新商品列表</view>
<button class="sd-btn " @click="appUpdateGoodsList">更新商品列表</button>
</view>
<view class="sc-line">
<view class="sl-desc">设备账号控制</view>
<button class="sd-btn" @click="logout">退出登录</button>
</view>
@ -17,6 +38,8 @@
<view class="sl-desc">程序版本更新</view>
<button class="sd-btn" @click="updateApp">前往更新</button>
</view>
<!-- <view class="sc-line">
<view class="sl-desc">屏幕适配设置</view>
</view> -->
@ -27,17 +50,43 @@
<script setup>
import util from '../../utils/util';
import { computed,onMounted,ref } from 'vue'
// #ifdef APP-PLUS
const Daemon_Uni = uni.requireNativePlugin('Daemon_Uni');
// #endif
//
const emits = defineEmits(['closeSetting'])
var goodsListLength = ref(0)
onMounted(async () => {
console.log("setting_mask onReady")
goodsListLength.value = getGoodsListLength()
});
var getGoodsCount = computed(() => {
let app = getApp()
return app.globalData.goodsList?.total||'0'
})
const getStadiumInfo = computed(() => {
let stadiumInfo = uni.getStorageSync("stadiumInfo")
return stadiumInfo||{}
})
const getGoodsListLength = () => {
let app = getApp()
return app.globalData.goodsList.list?.length||0
}
const handle_closeSetting = () => {
emits("closeSetting", "false")
}
const onGlobalDataChange = (newVal, oldVal) => {
console.log("onGlobalDataChange", newVal, oldVal)
}
const logout = () => {
console.log("logout")
@ -58,6 +107,8 @@
const handle_logout = () => {
getApp().globalData.stadiumInfo = {}
getApp().globalData.accountInfo = {}
getApp().globalData.goodsList = {}
uni.removeStorageSync("stadiumInfo")
uni.removeStorageSync("accountInfo")
uni.removeStorageSync("userInfo")
@ -118,6 +169,22 @@
});
}
const appUpdateGoodsList = async () => {
let app = getApp()
uni.showLoading({
title: '更新商品列表...',
mask: true
});
await app.updateGoodsList().then((res)=>{
console.log("updateGoodsList suc: ", res)
uni.hideLoading();
util.showNone("更新商品数量: "+res.list.length||0)
goodsListLength.value = res.list.length||0
}).finally(()=>{
uni.hideLoading();
})
}
</script>
<style lang="scss">
@ -165,6 +232,7 @@
.sl-desc {
@include flcw(16.88upx, 23.61upx, #1B1B1B, 500);
@include tHide;
// font-weight: 400;
}
.sd-btn {
@ -177,6 +245,9 @@
border-radius: 6.56upx;
@include flcw(16.88upx, 41.26upx, #fff, 500);
}
.sd-btn-unuse{
background:lightslategray;
}
}
}
}

95
uniapp_project_code/src/pages/index/index.vue

@ -21,7 +21,7 @@
</view>
<!-- 条形码输入框 -->
<input-qr-box v-if="showQRInputBox" :maskHeight="screenHeight" :maxInput="11"
<input-qr-box v-if="showQRInputBox" :maskHeight="screenHeight" :maxInput="20"
@showIt="handle_closeQRInputBox" @clickCommit="handle_clickCommit_qr"></input-qr-box>
<!-- 手机尾号后4位数验证 -->
@ -122,6 +122,7 @@
},
async onLoad(res) {
console.log("onload:", res)
this.clearShopList();
this.searchGoodBySku = util.searchGoodBySku
if(res.skulist){
@ -130,6 +131,7 @@
},
async onReady() {
// this.clearShopList();
this.screenHeight = await util.getPageHeight()
console.log(`the index page onReady----` + this.screenHeight)
app = getApp();
@ -141,6 +143,10 @@
}, 1000)
},
methods: {
clearShopList(){
console.log("clearShopList")
this.shopList = []
},
acceptSKUList(skulist){
skulist = JSON.parse(decodeURIComponent(skulist));
console.log("acceptSKUList:",skulist)
@ -166,7 +172,8 @@
// }
let shopListData = this.shopList.map(item => {
return {
id: item.erp_goods.id,
// id: item.erp_goods.id,
id: item.id,
// name: item.erp_goods.erp_goods_name,
// price: item.erp_goods.erp_goods_price,
name:item.goods_name,
@ -179,7 +186,7 @@
let _query = {
shopList: shopListData,
shopListTotalPrice: this.shopListTotalPrice,
shopListTotalPrice: this.shopListTotalPrice.toFixed(2),
shopListTotalCount: this.shopListTotalCount
}
console.log("clickToPay", _query)
@ -237,6 +244,7 @@
if(this.checkStock(_list[_index])){
this.handle_add(_index)
}else{
item.shopCount = 1;
_list_cannot_add.push(item)
}
// _list[_index].shopCount += 1
@ -364,7 +372,7 @@
let urlParams = util.getUrlParams(url);
console.log("urlParams:", urlParams)
return ox.get({
return ox.post({
url: API.getGoodsList,
data: urlParams,
isDefaultGet: false
@ -375,21 +383,21 @@
},
//
getGoodFromPad(sku, brand_id) {
return ox.get({
url: API.getGoodFromPad,
data: {
sku,
brand_id
},
isDefaultGet: true
})
.then(res => {
return ox.post({
url: API.getGoodFromPad,
data: {
sku,
brand_id
},
isDefaultGet: true
})
.then(res => {
util.hideLoad();
if (res.data.code == 0) {}
util.hideLoad();
if (res.data.code == 0) {}
return res
})
return res
})
},
//
async updateGoodsList() {
@ -409,30 +417,39 @@
app.globalData.shopList = this.shopList
},
getGoodsList() {
let url =
"https://testmanager.ouxuanzhineng.cn/admin/erpRetailGoods/list?brand_id=63&stadium_id=167&type_key=&key=&page=1&page_size=9999&is_sale=1&is_show_on_assistant=1&token=e6cabeae-0c1a-11ee-aa40-5254005df464";
let urlParams = util.getUrlParams(url);
console.log("getGoodsList需要适配urlParams:", urlParams)
// let url =
// "https://testmanager.ouxuanzhineng.cn/admin/erpRetailGoods/list?brand_id=63&stadium_id=167&type_key=&key=&page=1&page_size=9999&is_sale=1&is_show_on_assistant=1&token=e6cabeae-0c1a-11ee-aa40-5254005df464";
// let urlParams = util.getUrlParams(url);
// console.log("getGoodsListurlParams:", urlParams)
let {brand_id,stadium_id,token} = util.getPostParams()
let urlParams = {
brand_id,stadium_id,token,
"type_key": "",
"key": "",
"page": "1",
"page_size": "9999",
"is_sale": "1",
"is_show_on_assistant": "1",
}
return ox.post({
url: API.getGoodsList,
data: urlParams,
isDefaultGet: true,
failMsg: "获取商品列表失败"
})
.then(res => {
return ox.get({
url: API.getGoodsList,
data: urlParams,
isDefaultGet: true,
failMsg: "获取商品列表失败"
})
.then(res => {
util.hideLoad();
console.log("getGoodsList suc: ", res)
//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
util.hideLoad();
console.log("getGoodsList suc: ", res)
//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) {
// console.error(1231231)

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

@ -173,7 +173,7 @@ export default {
},
//
getGoodFromPad(sku, brand_id) {
return ox.get({
return ox.post({
url: API.getGoodFromPad,
data: {
sku,
@ -201,27 +201,53 @@ export default {
getGoodsList() {
let url =
"https://testmanager.ouxuanzhineng.cn/admin/erpRetailGoods/list?brand_id=63&stadium_id=167&type_key=&key=&page=1&page_size=9999&is_sale=1&is_show_on_assistant=1&token=e6cabeae-0c1a-11ee-aa40-5254005df464";
let urlParams = util.getUrlParams(url);
console.log("getGoodsList需要适配urlParams:", urlParams)
return ox.get({
// let urlParams = util.getUrlParams(url);
// console.log("getGoodsListurlParams:", urlParams)
let {brand_id,stadium_id,token} = util.getPostParams()
let urlParams = {
brand_id,stadium_id,token,
"type_key": "",
"key": "",
"page": "1",
"page_size": "9999",
"is_sale": "1",
"is_show_on_assistant": "1",
}
return ox.post({
url: API.getGoodsList,
data: urlParams,
isDefaultGet: true,
failMsg: "获取商品列表失败"
})
.then(res => {
.then(res => {
util.hideLoad();
console.log("getGoodsList suc: ", res)
util.hideLoad();
console.log("getGoodsList suc: ", res)
if(!res.list||res.list.length==0){//
return uni.showModal({
title: '提示',
content: "该门店暂无商品,请尝试更换门店",
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
util.routeTo('/pages/login/index','rL')
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}else{
//res.listshopCountPrice,shopCount
res.list.forEach(item => {
item.shopCount = 1
item.shopCountPrice = item.user_price
})
return res
}
//res.listshopCountPrice,shopCount
res.list.forEach(item => {
item.shopCount = 1
item.shopCountPrice = item.user_price
})
return res
})
})
},

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

@ -110,8 +110,10 @@
saveUserInfo({username:username.value,password:password.value,brand_id:brand_id.value,token,role})
//
if(autoLogin&&stadiumInfo){
if(autoLogin&&stadiumInfo&&checkBrandID(brand_id.value)){
getApp().globalData.autoLogin = false
setTimeout(()=>{
util.routeTo(`/pages/index/standby`, 'nT');
},1000)
@ -130,6 +132,17 @@
util.hideLoad();
})
function checkBrandID(brand_id){ //
let stadiumInfo = uni.getStorageSync('stadiumInfo');
if(brand_id==stadiumInfo.brand_id){
return true
}else{
console.log("登录的品牌不是历史登录设备的品牌, 清空stadiumInfo缓存")
uni.clearStorageSync('stadiumInfo')
return false
}
}
}
function saveUserInfo(userInfo){
uni.setStorageSync('userInfo', userInfo);
@ -138,9 +151,10 @@
getApp().globalData.accountInfo.password = userInfo.password
getApp().globalData.accountInfo.token = userInfo.token
getApp().globalData.accountInfo.role = userInfo.role
console.log('存储到本地localStorage '+uni.getStorageSync('userInfo').username)
}
function autoLogin(){
let userInfo = uni.getStorageSync('userInfo');
console.log(`page-onReady autoLogin userInfo: `,userInfo||"none")

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

@ -53,11 +53,12 @@ var stadiumName = computed(() => {
console.log("stadiumInfo: ",uni.getStorageSync('stadiumInfo'))
stadiumInfo = uni.getStorageSync('stadiumInfo')
}
if(stadiumInfo)stadiumName = stadiumInfo.venue_name
if(stadiumInfo)stadiumName = stadiumInfo.brand_name
return stadiumName
})
var isStadiumAutoShowBack = computed(() => {
const isStadiumAutoShowBack = ()=>{
let stadiumInfo = uni.getStorageSync("stadiumInfo")
if(stadiumInfo){
let index = padListOrigin.value.findIndex((e)=>{
@ -72,7 +73,7 @@ var isStadiumAutoShowBack = computed(() => {
}
}
return false
})
}
function handle_closeSetting(val){
console.log("handle_closeSetting",val)
@ -84,14 +85,48 @@ function handle_pickerChange(val){
saveStadiumInfo(val)
}
function clickJumpIndex(){
if(!isStadiumAutoShowBack.value){
async function clickJumpIndex(){
let app = getApp()
if(!isStadiumAutoShowBack()){
util.showNone("请选择门店")
return
}
util.routeTo(`/pages/index/standby`, 'nT');
let goodsList = app.globalData.goodsList
if (!goodsList.list||goodsList.list.length<1){
uni.showModal({
title: '提示',
content: '商品列表为空, 是否要更新商品列表?',
success: async function (res) {
if (res.confirm) {
uni.showLoading({
title: '更新商品列表...',
mask: true
});
await app.updateGoodsList().then((res)=>{
console.log("first load updateGoodsList suc, goodsList :", res)
goodsList = res
uni.hideLoading();
util.routeTo(`/pages/index/standby`, 'nT');
}).finally(()=>{
uni.hideLoading();
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}else{
util.routeTo(`/pages/index/standby`, 'nT');
}
}
function clickSetting(){
if(!isStadiumAutoShowBack()){
util.showNone("请选择门店")
return
}
showSettingMask.value = !showSettingMask.value
}
function clickUpdate(){
@ -112,11 +147,13 @@ function saveStadiumInfo(val){
}
function updatePadList(){
console.log("updatePadList")
util.showLoad('更新门店列表...');
let {brand_id,token} = getApp().globalData.accountInfo
let accountInfo = util.getPostParams()
// let {brand_id,token} = getApp().globalData.accountInfo
if(!accountInfo)return util.showNone("获取用户信息失败")
let {brand_id,token} = accountInfo
let urlParams = {
brand_id,token,
page: 1,
@ -126,7 +163,7 @@ function updatePadList(){
url: API.padList,
data: urlParams,
isDefaultGet: true,
failMsg: '操作失败!'
failMsg: '更新门店列表失败!'
})
.then(data => {
util.hideLoad();

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

@ -51,7 +51,7 @@
computed: {
payTotal() {//
let _payTotal = this.dataQuery.amount||0
return _payTotal.toFixed(2)||"0.00"
return _payTotal||"0.00"
}
},
watch:{
@ -66,7 +66,9 @@
paySuccessStatus:0,
decryptList: [],
strResult: "",
dataQuery:""
dataQuery:"",
reCheckOrderCount:0,//
reCheckOrderCountMax:30,//
}
},
async onLoad(res) {
@ -78,8 +80,24 @@
},
async onReady() {
await this.setPageHeight()
// this.testAcceptScanCode()
},
methods: {
//,,acceptScanCode
testAcceptScanCode(){
uni.showModal({
title: '模拟扫码',
content: '模拟扫码,点确定时执行acceptScanCode',
showCancel: true,
confirmText: '确定',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
this.acceptScanCode("282659672061313993")
}
}
});
},
setPayData(res){
console.log("setPayData:",res)
res = JSON.parse(res.query)
@ -128,7 +146,7 @@
}).then((payInfo)=>{
console.log("payInfo-result:",payInfo)
return this.checkOrder(payInfo)
}).then((checkInfo)=>{
}).then(async (checkInfo)=>{
console.log("最终checkInfo:",checkInfo)
let {payRes,checkRes} = checkInfo
// util.showNone(payRes.res.respMsg+"-"+payRes.res.respCode)
@ -138,21 +156,192 @@
this.printOrder(checkInfo)
}else{
// util.showNone(checkRes.res.respMsg+"-"+checkRes.res.respCode)
let msg = checkRes.res.respMsg||"未知原因"+"-"+checkRes.res.respCode+'\n';
let {orderStatus,requestDate,respCode,respMsg,tradeNo,transNo} = checkRes.res
if(orderStatus=="PROCESSING"){
//
console.log("等待支付中,需要继续查询支付结果")
uni.showModal({
title: '等待支付中...',
content: "如您已确认付款成功,请点击确认,继续查询支付结果!",
showCancel: false,
confirmText: '确认已支付成功',
success: async (res) => {
if (res.confirm) {
console.log('用户点击确定');
if(util.getPageRoute()=='pages/pay/index'){
this.doLoopCheck(checkInfo)
}else{
util.showNone('请重新扫码使用')
}
}
}
});
}else{
await this.checkInfoReactive(checkInfo)
}
}
}).finally(()=>{
util.hideLoad()
})
},
async doLoopCheck(checkInfo){
let max = this.reCheckOrderCountMax
for(let i=0;i<=max;i++){
// let res = null
uni.showLoading({
title: '支付结果查询中...'+i+"/"+this.reCheckOrderCountMax,
mask: true
});
let recheckInfo = await this.checkOrder(checkInfo.payRes).then((_recheckInfo)=>{
return _recheckInfo
}).catch(err=>{
console.warn("reCheckOrder err:",err)
rj(false)
})
console.log("recheckInfo--1:",recheckInfo)
let {orderStatus,requestDate,respCode,respMsg,tradeNo,transNo} = recheckInfo.checkRes.res
console.log("doLoopCheck recheckInfo:",recheckInfo)
if(orderStatus=="SUCCESS"){
let {payRes,checkRes} = recheckInfo
// util.showNone(payRes.res.respMsg+"-"+payRes.res.respCode)
if(checkRes.pay_order.status == "1"){
util.showNone(checkRes.res.respMsg)
this.paySuccessStatus = 1
this.printOrder(checkInfo)
}
break
}else{
await util.asyncSetTimeOut(2000)
continue
}
}
uni.hideLoading()
},
async checkInfoReactive(checkInfo){ //
return new Promise((rs,rj)=>{
console.log("checkInfoReactive",checkInfo)
let {payRes,checkRes} = checkInfo
let {orderStatus,requestDate,respCode,respMsg,tradeNo,transNo} = checkRes.res
// 200021,200008,,200004
let msg = checkRes.res.respMsg||"未知原因"+"-"+checkRes.res.respCode+'\n';
if(checkRes.pay_order.status == "1"){
util.showNone(checkRes.res.respMsg)
this.paySuccessStatus = 1
this.printOrder(checkInfo)
rs(true)
}
else if(respCode=="200021"||respCode=="200008"||respCode=="200004"){
//
console.warn("需要重新下单")
uni.showModal({
title: '支付失败',
content: msg,
showCancel: false,
confirmText: '确定',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
util.routeTo(`/pages/index/standby`, 'rL');
rs(true)
}
}
});
}else if(respCode=="200103"||orderStatus=="FAIL"){
//
msg = "支付失败code:"+checkRes.res.respCode+".请联系管理员!"
uni.showModal({
title: '支付失败',
content: checkRes.res.respMsg+"-"+checkRes.res.respCode,
content: msg,
showCancel: false,
confirmText: '确定',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
util.routeTo(`/pages/index/standby`, 'rL');
rs(true)
}
}
});
}else if(orderStatus=="PROCESSING"&&this.reCheckOrderCount==0){
//
console.log("等待支付中,需要继续查询支付结果")
uni.showModal({
title: '等待支付中...',
content: "如您已确认付款成功,请点击确认,继续查询支付结果!",
showCancel: false,
confirmText: '确认已支付成功',
success: async (res) => {
if (res.confirm) {
console.log('用户点击确定');
rs(true)
// await this.reCheckOrder(checkInfo).then((recheckInfo)=>{
// console.warn("finally checkInfo:",recheckInfo)
// })
}
}
});
}else if(orderStatus=="PROCESSING"&&this.reCheckOrderCount>0){
rj(checkInfo)
}
}).finally(()=>{
util.hideLoad()
})
},
loopReCheckOrder(_checkInfo){ //
reCheckOrder(_checkInfo).then((checkInfo)=>{
loopReCheckOrder(checkInfo)
}).catch(err=>{
console.warn("loopReCheckOrder err:",err)
util.showNone("支付结果查询超时,请联系管理员!"+err)
})
},
async reCheckOrder(_checkInfo){ //
let payRes = _checkInfo.payRes
return new Promise(async (rs,rj)=>{
this.reCheckOrderCount++
// uni.showLoading({
// title: '...'+this.reCheckOrderCount+"/"+this.reCheckOrderCountMax,
// mask: true
// });
if(this.reCheckOrderCount>=this.reCheckOrderCountMax){
uni.hideLoading()
util.showNone("支付结果查询超时,请联系管理员!")
rj(false)
}else{
console.log("reCheckOrder:",payRes)
await this.checkOrder(payRes).then((recheckInfo)=>{
console.log("checkInfo:",recheckInfo)
return recheckInfo
}).then((_recheckInfo)=>{
}).catch(err=>{
console.warn("reCheckOrder err:",err)
rj(false)
})
let _recheckInfo = await this.checkOrder(payRes)
await this.checkInfoReactive(_recheckInfo).then((res)=>{
rs(res)
}).catch(err=>{
console.warn("reCheckOrder err:",err)
rj(false)
})
}
})
},
printOrder(checkInfo){
@ -290,8 +479,11 @@
})
},
async makeOrder(){
let {store_id,brand_id,token} = getApp().globalData.accountInfo
let {brand_id,token} = getApp().globalData.accountInfo
let store_id = uni.getStorageSync("stadiumInfo").id||""
let {goods_data,amount} = this.dataQuery
brand_id = parseInt(brand_id)
amount = parseFloat(amount)
let urlParams = {
store_id,brand_id,token,amount,
"goods_data": goods_data,
@ -300,7 +492,7 @@
"card_no": "",
"mark": ""
}
console.log("需要适配makeOrder urlParams:", urlParams)
console.log("makeOrder urlParams:", urlParams)
return ox.post({
url: API.makeOrder,
@ -329,7 +521,7 @@
"goods_info": order_no,
}
console.log("需要适配payOrder urlParams:", urlParams)
console.log("payOrder urlParams:", urlParams)
return ox.post({
url: API.payOrder,
@ -358,9 +550,9 @@
transNo,payCode,brand_id,token,orderAmt,
"manual": "yes",//
}
console.log("需要适配checkOrder urlParams:", urlParams)
console.log("checkOrder urlParams:", urlParams)
return ox.get({
return ox.post({
url: API.checkOrder,
data: urlParams,
isDefaultGet: true,

34
uniapp_project_code/src/utils/server.js

@ -11,7 +11,7 @@ export class Server {
uni.request({
url,
timeout: 20000,
timeout: 300000,
sslVerify:false,
data,
method, // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
@ -19,7 +19,15 @@ export class Server {
success: res=>{
if(res.extension)util.updateTimeDifference(res.extension); //每次请求都更新时间差
if(islog){
console.log('islog req success---->')
let weburl = getWebURL(data,url)
let temp = url.split("?")[0].split("/")
let postName = temp[temp.length-1]
console.log("-------------------->> ["+postName+"][log]\n"+"请求 Data: \n" + JSON.stringify(data)+ "\n URL:\n"+weburl+"\n <<-------------------- ["+postName+"][log] ↑↑↑\n")
}
if(isDefaultGet){
if(failMsg == '')throw Error('默认回调,失败提示不能为空 key -> failMsg');
defaultGet({
@ -33,13 +41,7 @@ export class Server {
return
}
if(islog){
console.log('islog req success---->')
let weburl = getWebURL(data,url)
let temp = url.split("?")[0].split("/")
let postName = temp[temp.length-1]
console.log("-------------------->> ["+postName+"][log]\n"+"请求 Data: \n" + JSON.stringify(data)+ "\n URL:\n"+weburl+"\n <<-------------------- ["+postName+"][log] ↑↑↑\n")
}
rs(res);
},
fail: err=>{
@ -75,6 +77,20 @@ export class Server {
}else{
util.hideLoad();
util.showNone(res.data.message || failMsg || '');
if(res.data.code==401){//用户异常
uni.showModal({
title: '提示',
content: res.data.message,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
util.routeTo('/pages/login/index','rL')
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
reject({url,res,data});
}
}

46
uniapp_project_code/src/utils/util.js

@ -3,6 +3,7 @@ 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]+$/);
export const specialReg = new RegExp("[^a-zA-Z0-9\_\u4e00-\u9fa5]","i");
@ -529,7 +530,7 @@ function encrypt(config) {
let t = parseInt(new Date().getTime() / 1000 - config.timeDifference);
let s = a + '|1ba2212f78610369467de90fb1e3d345|' + b + '|4e68cd333457cb297a05ec7f77a9ad978b56cf57|' + t;
console.warn("签名",s)
// console.warn("签名",s)
let md5_str = md5.hex_md5(s)
return { S: md5_str, T: t }
}
@ -568,11 +569,13 @@ function searchGoodBySku(sku) {
console.warn('searchGoodBySku:',sku)
return new Promise((resolve, reject) => {
let app = getApp();
let _list = app.globalData.goodsList.list
//sku可能不唯一, 返回数组
let _list = app.globalData.goodsList.list
// if(!sku||!_list||_list.length<1)reject(false)
let _goods = _list.filter(item => {
let sku_check = (item.erp_goods.erp_goods_sku == sku)
let stock_check = (item.erp_goods.stock_num>1)
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
@ -586,6 +589,38 @@ function searchGoodBySku(sku) {
})
}
function getPostParams(){
let app = getApp();
let stadiumInfo = uni.getStorageSync("stadiumInfo")
if(!app.globalData.accountInfo||!app.globalData.accountInfo.brand_id||!app.globalData.accountInfo.token){
routeTo('/pages/login/index','rL')
return false
}
console.warn(stadiumInfo)
let {brand_id,token} = app.globalData.accountInfo
return {
brand_id,token,
"stadium_id":stadiumInfo.id
}
}
async function asyncSetTimeOut(time){
const res = await new Promise(resolve => {
setTimeout(() => resolve("asyncSetTimeOut"), time||1000);
});
return res
}
async function getPageRoute(){
const res = await new Promise(resolve => {
var pages = getCurrentPages();
var currentPage = pages[pages.length - 1];
var currentRoute = currentPage.route;
});
return currentRoute
}
export default {
checkSerialPortMessage,
formatTime,
@ -629,5 +664,8 @@ export default {
getH5RefSize,
resetHeader,
updateTimeDifference,
searchGoodBySku
searchGoodBySku,
getPostParams,
asyncSetTimeOut,
getPageRoute,
}

2
uniplugin_padprinter/src/main/java/net/zmt/padprinter/Helper/Printer_Helper.java

@ -126,7 +126,7 @@ public class Printer_Helper {
//居中打印标题,完成后切回默认字体
mPrinter.setPrinter(Command.ALIGN, Command.ALIGN_CENTER);
mPrinter.setFont(0, 1, 1, 0, 0);
mPrinter.printText("零售小票" + "\n");
mPrinter.printText("零售小票测试" + "\n");
mPrinter.setPrinter(Command.ALIGN, Command.ALIGN_LEFT);
mPrinter.setFont(0, 0, 0, 0, 0);

Loading…
Cancel
Save