Browse Source

after test 0220

dev
赵明涛 11 months ago
parent
commit
e2865e0d2d
  1. 13
      uniapp_project_code/src/components/index/keyboard/keyboard_listener.vue
  2. 4
      uniapp_project_code/src/components/index/list_item.vue
  3. 24
      uniapp_project_code/src/components/index/page_standby.vue
  4. 8
      uniapp_project_code/src/components/index/view_footer.nvue
  5. 10
      uniapp_project_code/src/components/index/view_header.nvue
  6. 6
      uniapp_project_code/src/components/pay/paying.vue
  7. 48
      uniapp_project_code/src/components/pay/success.vue
  8. 0
      uniapp_project_code/src/pages/index/-standby.nvue
  9. 132
      uniapp_project_code/src/pages/index/index.vue
  10. 244
      uniapp_project_code/src/pages/index/standby.vue
  11. 7
      uniapp_project_code/src/pages/login/index.vue
  12. 39
      uniapp_project_code/src/pages/login/success.vue
  13. 22
      uniapp_project_code/src/pages/pay/index.vue
  14. BIN
      uniapp_project_code/src/static/index/camera_icon2.png
  15. 8
      uniapp_project_code/src/utils/util.js

13
uniapp_project_code/src/components/index/keyboard/keyboard_listener.vue

@ -13,7 +13,7 @@
</script> </script>
<script module="keyboard" lang="renderjs"> <script module="keyboard" lang="renderjs">
import { onBeforeUnmount } from 'vue';
import { onBeforeUnmount,getCurrentInstance } from 'vue';
export default { export default {
mounted() { mounted() {
const onKey = (event) => { const onKey = (event) => {
@ -30,11 +30,22 @@
names.forEach(name => { names.forEach(name => {
document.addEventListener(name, onKey, false) document.addEventListener(name, onKey, false)
}) })
//vue 2.x
// this.$on('hook:beforeDestroy', () => { // this.$on('hook:beforeDestroy', () => {
// names.forEach(name => { // names.forEach(name => {
// document.removeEventListener(name, onKey, false) // document.removeEventListener(name, onKey, false)
// }) // })
// }) // })
// 使 ctx ,vue3
const instance = getCurrentInstance()
const ctx = instance.ctx
ctx.$on('hook:beforeUnmount', () => {
names.forEach(name => {
document.removeEventListener(name, onKey, false)
})
})
}, },
setup() { setup() {
// //

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

@ -24,9 +24,9 @@
<image class="img" src="/static/index/add_icon.png" mode="scaleToFill" @click="add"/> <image class="img" src="/static/index/add_icon.png" mode="scaleToFill" @click="add"/>
</view> </view>
<view class="brb-right"> <view class="brb-right">
<view class="brbr-get-score">
<!-- <view class="brbr-get-score">
<text class="txt">下单得积分</text> <text class="txt">下单得积分</text>
<text class="brbr-score">{{mitem.score||0}}</text></view>
<text class="brbr-score">{{mitem.score||0}}</text></view> -->
<view class="brbr-total-price"> <view class="brbr-total-price">
<text class="brbrp-price1">¥</text> <text class="brbrp-price1">¥</text>
<text class="brbrp-price2">{{mitem.shopCountPrice||"-"}}</text> <text class="brbrp-price2">{{mitem.shopCountPrice||"-"}}</text>

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

@ -1,7 +1,7 @@
<template> <template>
<view class="content"> <view class="content">
<view class="content_title"> <view class="content_title">
<text class="txt" @click="secretClickBackToSetting">欧轩智能场馆丛云店</text>
<text class="txt" @click="secretClickBackToSetting">{{stadiumName}}</text>
</view> </view>
<view class="content_info"> <view class="content_info">
<text class="txt">欢迎使用自助收银</text> <text class="txt">欢迎使用自助收银</text>
@ -26,11 +26,29 @@
import { import {
onMounted, onMounted,
ref
ref,
computed
} from 'vue' } from 'vue'
const countClick = ref(0) const countClick = ref(0)
var stadiumName = computed(() => {
let {accountInfo,stadiumInfo} = getApp().globalData
let stadiumName = accountInfo.username || "用户"
if(uni.getStorageSync('stadiumInfo')){
console.log("stadiumInfo: ",uni.getStorageSync('stadiumInfo'))
stadiumInfo = uni.getStorageSync('stadiumInfo')
}
if(stadiumInfo)stadiumName = stadiumInfo.venue_name
return stadiumName
})
var stadiumName2 = () => {
let {accountInfo,stadiumInfo} = getApp().globalData
let stadiumName = getApp().globalData.accountInfo.username || "用户"
if(uni.getStorageSync('stadiumInfo'))stadiumInfo = uni.getStorageSync('stadiumInfo')
if(stadiumInfo)stadiumName = stadiumInfo.data.venue_name
return stadiumName
}
function clickToUse() { function clickToUse() {
util.routeTo(`/pages/login/success`, 'nT'); util.routeTo(`/pages/login/success`, 'nT');
} }
@ -52,7 +70,7 @@
const secretClick = util.debounce(function(){ const secretClick = util.debounce(function(){
countClick.value = 0 countClick.value = 0
},2500,false)
},1000,false)
</script> </script>

8
uniapp_project_code/src/components/index/view_footer.nvue

@ -25,7 +25,7 @@
<view class="f-total-price"> <view class="f-total-price">
<text class="txt1">应付:</text> <text class="txt1">应付:</text>
<text class="txt2">¥</text> <text class="txt2">¥</text>
<text class="txt3">{{tolPrice}}</text>
<text class="txt3">{{tolPrice.toFixed(2)||'0.00'}}</text>
</view> </view>
<text class="txt_middle">|</text> <text class="txt_middle">|</text>
<view class="f-total-count"> <view class="f-total-count">
@ -38,10 +38,10 @@
<image class="qr-img" src="/static/index/qr_icon.png" mode="scaleToFill" /> <image class="qr-img" src="/static/index/qr_icon.png" mode="scaleToFill" />
<text class="txt">输入条形码</text> <text class="txt">输入条形码</text>
</view> </view>
<view class="vip-box " @click="handle_clickVIP">
<!-- <view class="vip-box " @click="handle_clickVIP">
<image class="vip-img" src="/static/index/vip_icon.png" mode="scaleToFill" /> <image class="vip-img" src="/static/index/vip_icon.png" mode="scaleToFill" />
<text class="txt">会员登录</text> <text class="txt">会员登录</text>
</view>
</view> -->
</view> </view>
</view> </view>
@ -98,7 +98,7 @@ import util from "@/utils/util.js"
} }
onMounted(async (res) => { onMounted(async (res) => {
console.log(res + ` the keyboard_box component is now mounted. ` + props.maskHeight)
// console.log(res + ` the component is now mounted. ` + props.maskHeight)
}) })
</script> </script>

10
uniapp_project_code/src/components/index/view_header.nvue

@ -1,7 +1,7 @@
<template> <template>
<view class="header-box" :style="[{ background: props.backgroundCustom }, getBorderStyle]"> <view class="header-box" :style="[{ background: props.backgroundCustom }, getBorderStyle]">
<view class="video-tip"> <view class="video-tip">
<image class="v-image" src="/static/index/camera_icon.png" mode="widthFix" />
<image class="v-image" src="/static/index/camera_icon2.png" mode="widthFix" />
<text class="v-text">您已进入视频覆盖区</text> <text class="v-text">您已进入视频覆盖区</text>
</view> </view>
<view class="cancel-button" @click="handle_closeUse"> <view class="cancel-button" @click="handle_closeUse">
@ -13,7 +13,7 @@
<script setup> <script setup>
//触发自定义事件 //触发自定义事件
import util from "@/utils/util.js" import util from "@/utils/util.js"
import { ref,onMounted,onBeforeUnmount } from 'vue'
import { ref,onMounted,onBeforeUnmount,onUnmounted } from 'vue'
import { defineEmits, defineProps, computed } from 'vue' import { defineEmits, defineProps, computed } from 'vue'
const emits = defineEmits(['closeUse']) const emits = defineEmits(['closeUse'])
const props = defineProps({ const props = defineProps({
@ -27,7 +27,7 @@ const props = defineProps({
} }
}) })
const countDown = ref(90)
const countDown = ref(300)//默认倒计时5分钟
let timer = ref(null) let timer = ref(null)
onMounted(async (res) => { onMounted(async (res) => {
@ -37,6 +37,10 @@ onBeforeUnmount(() => {
clearInterval(timer) clearInterval(timer)
timer = null timer = null
}) })
onUnmounted(() => {
clearInterval(timer)
timer = null
})
function setCountDown() { function setCountDown() {
clearInterval(timer) clearInterval(timer)

6
uniapp_project_code/src/components/pay/paying.vue

@ -20,14 +20,14 @@
<text class="p-tips">请将付款码对准右下方扫码口</text> <text class="p-tips">请将付款码对准右下方扫码口</text>
<view class="p-btn" @click="handle_clickCard">
<!-- <view class="p-btn" @click="handle_clickCard">
<image class="pb-image" src="/static/pay/pay-vip-icon.png" mode="aspectFit" /> <image class="pb-image" src="/static/pay/pay-vip-icon.png" mode="aspectFit" />
<text class="pb-text">储值卡支付</text> <text class="pb-text">储值卡支付</text>
</view>
</view> -->
<view class="p-user"> <view class="p-user">
<text class="p-txt">未登录00000000000</text>
<!-- <text class="p-txt">未登录00000000000</text> -->
</view> </view>
</view> </view>

48
uniapp_project_code/src/components/pay/success.vue

@ -18,20 +18,20 @@
<image class="sc-check-icon" src="/static/pay/check-icon.png" mode="acepectFit" /> <image class="sc-check-icon" src="/static/pay/check-icon.png" mode="acepectFit" />
<view>支付成功</view> <view>支付成功</view>
</view> </view>
<view class="sc-total">68.60</view>
<view class="sc-total">{{paySuccessInfo.amount||'0.00'}}</view>
</view> </view>
<text class="sc-num"> <text>15</text> 件商品</text>
<text class="sc-num"> <text>{{paySuccessInfo.goods_data.length}}</text> 件商品</text>
<text class="sc-tip-1">请领取小票期待下次光临</text> <text class="sc-tip-1">请领取小票期待下次光临</text>
<image class="sc-print-img" src="/static/pay/print-img.png" mode="acepectFit" /> <image class="sc-print-img" src="/static/pay/print-img.png" mode="acepectFit" />
<view class="sc-tip-2">
<!-- <view class="sc-tip-2">
获得<text>30积分</text>已放入您的账户 获得<text>30积分</text>已放入您的账户
</view>
<view class="sc-tip-3">请在小程序会员中心里查看</view>
</view> -->
<!-- <view class="sc-tip-3">请在小程序会员中心里查看</view> -->
<view class="sc-btn" @click="handle_clickToIndex"> <view class="sc-btn" @click="handle_clickToIndex">
<text class="scb-txt-1" >返回首页</text><text class="scb-txt-2">2s</text>
<text class="scb-txt-1" >返回首页</text><text class="scb-txt-2">{{countDown}}s</text>
</view> </view>
</view> </view>
</view> </view>
@ -40,17 +40,49 @@
<script setup> <script setup>
// //
import util from "@/utils/util.js" import util from "@/utils/util.js"
import { ref,onMounted,onBeforeUnmount,onUnmounted } from 'vue'
const emits = defineEmits(['clickToIndex']) const emits = defineEmits(['clickToIndex'])
const props = defineProps({ const props = defineProps({
paySuccessInfo: { paySuccessInfo: {
type: Object, type: Object,
default: {}
default: {
"amount":0,
"goods_data":[],
}
}, },
}) })
const countDown = ref(30)//
let timer = ref(null)
onMounted(async (res) => {
setCountDown()
})
onBeforeUnmount(() => {
clearInterval(timer)
timer = null
})
onUnmounted(() => {
clearInterval(timer)
timer = null
})
function setCountDown() {
clearInterval(timer)
timer = null
timer = setInterval(() => {
countDown.value--
if (countDown.value <= 1) {
clearInterval(timer)
timer = null
util.routeTo(`/pages/index/standby`, 'rL');
}
}, 1000)
}
const handle_clickToIndex = () => { const handle_clickToIndex = () => {
emits("clickToIndex", "") emits("clickToIndex", "")
util.routeTo(`/pages/index/index`, 'rL');
util.routeTo(`/pages/index/standby`, 'rL');
} }
</script> </script>

0
uniapp_project_code/src/pages/index/standby.nvue → uniapp_project_code/src/pages/index/-standby.nvue

132
uniapp_project_code/src/pages/index/index.vue

@ -87,6 +87,7 @@
computed: { computed: {
shopListTotalPrice() { shopListTotalPrice() {
let _total = 0 let _total = 0
if (!this.shopList||this.shopList.length<1) return 0
this.shopList.forEach(item => { this.shopList.forEach(item => {
_total += item.shopCountPrice _total += item.shopCountPrice
}) })
@ -94,6 +95,7 @@
}, },
shopListTotalCount() { shopListTotalCount() {
let _total = 0 let _total = 0
if (!this.shopList||this.shopList.length<1) return 0
this.shopList.forEach(item => { this.shopList.forEach(item => {
_total += item.shopCount _total += item.shopCount
}) })
@ -121,30 +123,38 @@
async onLoad(res) { async onLoad(res) {
console.log("onload:", res) console.log("onload:", res)
// this.test()
if(res.skulist){
this.acceptSKUList(res.skulist)
}
// this.showPageStandby = true
}, },
async onReady() { async onReady() {
this.screenHeight = await util.getPageHeight() this.screenHeight = await util.getPageHeight()
// this.globalData = app.globalData
console.log(`the index page onReady----` + this.screenHeight) console.log(`the index page onReady----` + this.screenHeight)
app = getApp(); app = getApp();
setTimeout(async () => { setTimeout(async () => {
await this.updateGoodsList().then(async () => { await this.updateGoodsList().then(async () => {
console.log("skulist:", this.shopList)
// console.log("skulist:", this.shopList)
}) })
this.setFooterHeight() this.setFooterHeight()
console.log("test set SKU 10000012")
// let skulist = await this.searchGoodBySku("10000012")
// this.shopList = this.shopList.concat(skulist)
}, 1000) }, 1000)
}, },
methods: { methods: {
acceptSKUList(skulist){
skulist = JSON.parse(decodeURIComponent(skulist));
console.log("acceptSKUList:",skulist)
if(skulist&&skulist.length>0)this.shopList = this.combinedList(this.shopList, skulist)
},
acceptSKUListFromGlobalData(){
let skulist = app.globalData.skulist
console.log("acceptSKUListFromGlobalData:",skulist)
this.shopList = this.combinedList(this.shopList, skulist)
},
async setTestSku() {
console.log("Test set SKU 10000012")
let skulist = await this.searchGoodBySku("10000012")
this.shopList = this.shopList.concat(skulist)
},
clickToPay() { clickToPay() {
// shopList { // shopList {
// "id": 57, // "id": 57,
@ -173,7 +183,7 @@
if(this.shopListTotalPrice<=0){ if(this.shopListTotalPrice<=0){
return util.showNone("请先添加商品") return util.showNone("请先添加商品")
} }
util.routeTo(`/pages/pay/index?query=${JSON.stringify(_query)}`, 'nT');
util.routeTo(`/pages/pay/index?query=${JSON.stringify(_query)}`, 'rL');
}, },
clickToUse() { clickToUse() {
util.routeTo(`/pages/login/success`, 'nT'); util.routeTo(`/pages/login/success`, 'nT');
@ -199,88 +209,88 @@
console.log(JSON.stringify(res.goods)) console.log(JSON.stringify(res.goods))
// util.showNone(""+res.inputCode+"-"+res.goods.length) // util.showNone(""+res.inputCode+"-"+res.goods.length)
util.showNone("添加商品成功,数量:" + res.goods.length + "个"); util.showNone("添加商品成功,数量:" + res.goods.length + "个");
this.shopList = this.shopList.concat(res.goods)
if(res.goods&&res.goods.length>0)this.shopList = this.combinedList(this.shopList, res.goods)
// this.shopList = this.shopList.concat(res.goods)
this.showQRInputBox = !this.showQRInputBox this.showQRInputBox = !this.showQRInputBox
}, },
handle_clickVIP() { handle_clickVIP() {
util.showNone("会员登录") util.showNone("会员登录")
this.showEndPhoneBox = !this.showEndPhoneBox this.showEndPhoneBox = !this.showEndPhoneBox
}, },
combinedList(list1, list2) {
console.log("combinedList", list1, list2)
if(!list2)return util.showNone("未找到商品")
let _list = list1
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)
}
})
return _list
},
async setFooterHeight() { async setFooterHeight() {
console.log("Auto setFooterHeight")
// #ifdef APP-NVUE // #ifdef APP-NVUE
console.log("APP-NVUE setFooterHeight") console.log("APP-NVUE setFooterHeight")
let size1 = await util.getNvueRefSize(this, dom, "mfooter");
this.footerHeight = size1.height.toFixed(2)
let size_app = await util.getNvueRefSize(this, dom, "mfooter");
this.footerHeight = size_app.height.toFixed(2)
// #endif // #endif
// #ifdef H5 // #ifdef H5
console.log("H5 setFooterHeight")
let size2 = await util.getH5RefSize(this, "mfooter");
console.log("H5 setFooterHeight size2:", size2)
this.footerHeight = size2.height.toFixed(2)
let size_web = await util.getH5RefSize(this, "mfooter");
this.footerHeight = size_web.height.toFixed(2)
// #endif // #endif
}, },
// //
async onKeyup(event) { async onKeyup(event) {
console.log("按键松开事件: ", event)
// console.log(": ", event)
// decryptList, strResult
let res = dictKeyboard.dict[event.keyCode]; let res = dictKeyboard.dict[event.keyCode];
console.log("未转换:", res);
console.log("this.decryptList0: " + this.decryptList)
// console.log("keyCode from keyboard:", res);
this.decryptList.push(res); this.decryptList.push(res);
console.log("this.decryptList0: ", this.decryptList)
if (event.keyCode != 13) { if (event.keyCode != 13) {
return console.log("this.decryptList1: ", this.decryptList)
console.log("继续接收:", this.decryptList)
return
}; };
this.decryptList.pop(); this.decryptList.pop();
this.strResult = await dictKeyboard.resultScan(this.decryptList); this.strResult = await dictKeyboard.resultScan(this.decryptList);
console.log("扫码结果strResult--22:", this.strResult)
// console.log("-step-1:", this.strResult)
this.orderQrcode = this.strResult this.orderQrcode = this.strResult
console.log("扫码结果--11:", this.decryptList)
console.log("扫码结果--33:", this.strResult)
// console.log("decryptList-before-splice: ", this.decryptList)
this.decryptList.splice(0); this.decryptList.splice(0);
console.log("this.decryptList2: " + this.decryptList)
// console.log("decryptList-after-splice: " + this.decryptList)
//down_arrow //down_arrow
if (this.strResult.indexOf("down_arrow") != -1) { if (this.strResult.indexOf("down_arrow") != -1) {
this.strResult = this.strResult.replace("down_arrow", "") this.strResult = this.strResult.replace("down_arrow", "")
} }
console.log("扫码结果--44:", this.strResult)
let skulist = await this.searchGoodBySku(this.strResult)
console.log("扫码结果-step-2:", this.strResult)
let skulist = await this.searchGoodBySku(this.strResult).then(res => {
console.log("searchGoodBySku suc: ", res)
return res
}).catch(err => {
console.log("searchGoodBySku err: ", err)
util.showNone("未找到商品")
})
//skulistshopList //skulistshopList
this.shopList = this.shopList.concat(skulist)
if(skulist&&skulist.length>0)this.shopList = this.combinedList(this.shopList, skulist)
// this.shopList = this.shopList.concat(skulist)
console.log("skulist:", this.shopList) console.log("skulist:", this.shopList)
// let info = await this.getOrderInfo(this.strResult)
// console.log("---111", info)
// this.clearTimer()
// this.isShowPage = 1
// this.setTimerCountdown();
// if(info.status == true){
// this.bindOrderInfo = info.order
// this.bindOrderInfo.order_type = info.order_type || ''
// return this.issueBtn(); //
// }else{
// return this.tipsTxt = "\n";
// }
}, },
// //
onKeydown(event) { onKeydown(event) {
console.log("监听按键按下事件: ", event)
// console.log(": ", event)
}, },
handle_add(i) { handle_add(i) {
console.log("handle_add", i) console.log("handle_add", i)
@ -353,7 +363,6 @@
.then(res => { .then(res => {
util.hideLoad(); util.hideLoad();
// console.log(" suc: ",res)
if (res.data.code == 0) {} if (res.data.code == 0) {}
return res return res
@ -374,7 +383,7 @@
let url = 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"; "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); let urlParams = util.getUrlParams(url);
console.log("需要适配urlParams:", urlParams)
console.log("getGoodsList需要适配urlParams:", urlParams)
return ox.get({ return ox.get({
url: API.getGoodsList, url: API.getGoodsList,
@ -396,7 +405,6 @@
}) })
}, },
searchGoodBySku(sku) { searchGoodBySku(sku) {
console.log("apppp", app)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let _list = app.globalData.goodsList.list let _list = app.globalData.goodsList.list
// let _good = _list.find(item=>item.erp_goods.erp_goods_sku == sku) // let _good = _list.find(item=>item.erp_goods.erp_goods_sku == sku)
@ -406,7 +414,7 @@
if (_goods.length) { if (_goods.length) {
resolve(_goods) resolve(_goods)
} else { } else {
reject("未找到商品")
reject(false)
} }
}) })
}, },

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

@ -0,0 +1,244 @@
<template>
<view>
<page-standby></page-standby>
<keyboard-listener style="height: 1px;" @keyup="onKeyup" @keydown="onKeydown"></keyboard-listener>
</view>
</template>
<script>
import pageStandby from '@/components/index/page_standby.vue';//
import keyboardListener from '@/components/index/keyboard/keyboard_listener.vue'; //
import util from "@/utils/util.js"
import dictKeyboard from '@/utils/dictOfKeyboard'
import {
API
} from "@/utils/api";
import {
ox
} from "@/utils/server";
let app = getApp();
export default {
components: {
'page-standby': pageStandby,
'keyboard-listener': keyboardListener,
},
watch: {
//standby, nvue
// showPageStandby(ov,nv){
// if(nv){
// // #ifdef APP-NVUE
// setTimeout(async()=>{
// dom = weex.requireModule("dom");
// let size = await util.getNvueRefSize(this,dom,"mfooter");
// this.footerHeight = size.height.toFixed(2)
// },200)
// // #endif
// }
// }
},
computed: {
shopListTotalPrice() {
let _total = 0
if (!this.shopList || this.shopList.length < 1) return 0
this.shopList.forEach(item => {
_total += item.shopCountPrice
})
return _total
},
shopListTotalCount() {
let _total = 0
if (!this.shopList || this.shopList.length < 1) return 0
this.shopList.forEach(item => {
_total += item.shopCount
})
return _total
},
//standby, nvue
// footerHeight(){
// return this.screenHeight - 100
// }
},
data() {
return {
// showPageStandby: false,
showQRInputBox: false,
showEndPhoneBox: false,
screenHeight: '',
footerHeight: '',
// globalData: app.globalData,
globalData: "",
shopList: [],
decryptList: [],
strResult: "",
}
},
async onLoad(res) {
console.log("onload:", res)
// this.test()
// this.showPageStandby = true
},
async onReady() {
// this.screenHeight = await util.getPageHeight()
console.log(`the index page onReady----` + this.screenHeight)
app = getApp();
setTimeout(async () => {
await this.updateGoodsList().then(async () => {
// console.log("skulist:", this.shopList)
})
}, 100)
},
methods: {
async setTestSku() {
console.log("Test set SKU 10000012")
let skulist = await this.searchGoodBySku("10000012")
this.shopList = this.shopList.concat(skulist)
},
combinedList(list1, list2) {
console.log("combinedList", list1, list2)
if (!list2) return util.showNone("未找到商品")
let _list = list1
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)
}
})
return _list
},
//
async onKeyup(event) {
console.log("按键松开: ", event)
// decryptList, strResult
let res = dictKeyboard.dict[event.keyCode];
console.log("keyCode from keyboard:", res);
this.decryptList.push(res);
if (event.keyCode != 13) {
return console.log("继续接收:", this.decryptList)
};
this.decryptList.pop();
this.strResult = await dictKeyboard.resultScan(this.decryptList);
console.log("扫码结果-step-1:", this.strResult)
this.orderQrcode = this.strResult
console.log("decryptList-before-splice: ", this.decryptList)
this.decryptList.splice(0);
console.log("decryptList-after-splice: " + this.decryptList)
//down_arrow
if (this.strResult.indexOf("down_arrow") != -1) {
this.strResult = this.strResult.replace("down_arrow", "")
}
console.log("扫码结果-step-2:", this.strResult)
let skulist = await this.searchGoodBySku(this.strResult).then(res => {
console.log("searchGoodBySku suc: ", res)
return res
}).then(skulist => {
this.addSkuListToShopList(skulist);
// return skulist
}).catch(err => {
console.log("searchGoodBySku err: ", err)
util.showNone("未找到商品")
})
//skulistshopList
// this.shopList = this.combinedList(this.shopList, skulist)
// this.shopList = this.shopList.concat(skulist)
},
//index,
addSkuListToShopList(skulist) {
console.log("addSkuListToShopList", skulist)
skulist = encodeURIComponent(JSON.stringify(skulist))
uni.reLaunch({
url: `/pages/index/index?skulist=${skulist}`,
animationType: 'zoom-fade-out',
animationDuration: 300
});
},
//
onKeydown(event) {
// console.log(": ", event)
},
//
getGoodFromPad(sku, brand_id) {
return ox.get({
url: API.getGoodFromPad,
data: {
sku,
brand_id
},
isDefaultGet: true
})
.then(res => {
util.hideLoad();
if (res.data.code == 0) { }
return res
})
},
//
async updateGoodsList() {
let _list = await this.getGoodsList()
//
console.log("app.globaldata: ", app.globalData)
app.globalData.goodsList = _list
},
//
updateShopList() {
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)
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
})
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)
}
})
},
}
}
</script>
<style lang="scss" scoped></style>

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

@ -44,7 +44,6 @@
import md5 from '@/utils/md5.js' import md5 from '@/utils/md5.js'
onReady(async () => { onReady(async () => {
testmd5()
autoLogin() autoLogin()
}); });
@ -98,15 +97,15 @@
if(autoLogin&&stadiumInfo){ if(autoLogin&&stadiumInfo){
getApp().globalData.autoLogin = false getApp().globalData.autoLogin = false
setTimeout(()=>{ setTimeout(()=>{
util.routeTo(`/pages/index/index`, 'nT');
util.routeTo(`/pages/index/standby`, 'nT');
},1000) },1000)
return util.showNone("自动登录成功")
return util.showNone("登录成功")
}else{ }else{
getApp().globalData.autoLogin = false getApp().globalData.autoLogin = false
setTimeout(()=>{ setTimeout(()=>{
util.routeTo(`/pages/login/success`, 'nT'); util.routeTo(`/pages/login/success`, 'nT');
},1000) },1000)
return util.showNone("自动登录成功,请先选择门店")
return util.showNone("登录成功,请先选择门店")
} }

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

@ -3,7 +3,7 @@
<view class="login-success"> <view class="login-success">
<logo-vue></logo-vue> <logo-vue></logo-vue>
<view class="ls-desc"> <view class="ls-desc">
<view class="ld-line">尊敬的欧轩智能24小时零售永泰店</view>
<view class="ld-line">尊敬的{{stadiumName||'用户'}}</view>
<view class="ld-line">欢迎登录欧轩智能场馆平板端系统</view> <view class="ld-line">欢迎登录欧轩智能场馆平板端系统</view>
</view> </view>
<view class="ls-pads"> <view class="ls-pads">
@ -29,7 +29,7 @@ import padsPicker from '@/components/login/pads_picker.vue';
import loginButton from '@/components/login/button.vue'; import loginButton from '@/components/login/button.vue';
import settingMask from '@/components/login/setting_mask.vue'; import settingMask from '@/components/login/setting_mask.vue';
import { ref } from 'vue'
import { ref,computed } from 'vue'
import { onReady } from '@dcloudio/uni-app'; import { onReady } from '@dcloudio/uni-app';
import util from "@/utils/util.js" import util from "@/utils/util.js"
import {API} from "@/utils/api"; import {API} from "@/utils/api";
@ -45,6 +45,35 @@ onReady(async () => {
updatePadList() updatePadList()
}); });
// let stadiumName = getApp().globalData.stadiumInfo.venue_name||getApp().globalData.accountInfo.username||""
var stadiumName = computed(() => {
let {accountInfo,stadiumInfo} = getApp().globalData
let stadiumName = accountInfo.username || "用户"
if(uni.getStorageSync('stadiumInfo')){
console.log("stadiumInfo: ",uni.getStorageSync('stadiumInfo'))
stadiumInfo = uni.getStorageSync('stadiumInfo')
}
if(stadiumInfo)stadiumName = stadiumInfo.venue_name
return stadiumName
})
var isStadiumAutoShowBack = computed(() => {
let stadiumInfo = uni.getStorageSync("stadiumInfo")
if(stadiumInfo){
let index = padListOrigin.value.findIndex((e)=>{
return e.id == stadiumInfo.id
})
if(index != -1){
selectIndex.value = index
console.log("autoShowBackStadium set index: ",index)
return true
}else{
return false
}
}
return false
})
function handle_closeSetting(val){ function handle_closeSetting(val){
console.log("handle_closeSetting",val) console.log("handle_closeSetting",val)
showSettingMask.value = !showSettingMask.value showSettingMask.value = !showSettingMask.value
@ -56,7 +85,11 @@ function handle_pickerChange(val){
} }
function clickJumpIndex(){ function clickJumpIndex(){
util.routeTo(`/pages/index/index`, 'nT');
if(!isStadiumAutoShowBack.value){
util.showNone("请选择门店")
return
}
util.routeTo(`/pages/index/standby`, 'nT');
} }
function clickSetting(){ function clickSetting(){
showSettingMask.value = !showSettingMask.value showSettingMask.value = !showSettingMask.value

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

@ -1,12 +1,12 @@
<template> <template>
<view class="pay-page"> <view class="pay-page">
<keyboard-listener @keyup="onKeyup" @keydown="onKeydown" ></keyboard-listener>
<keyboard-listener style="width: 1rpx;" @keyup="onKeyup" @keydown="onKeydown" ></keyboard-listener>
<view v-if="paySuccessStatus==0"> <view v-if="paySuccessStatus==0">
<view-header class="mheader" :backgroundCustom="('none')" :needBorder="(false)" <view-header class="mheader" :backgroundCustom="('none')" :needBorder="(false)"
@closeUse=""></view-header> @closeUse=""></view-header>
<paying v-if="true" :payTotal="payTotal" @clickVipCard="handle_clickVipCard"></paying> <paying v-if="true" :payTotal="payTotal" @clickVipCard="handle_clickVipCard"></paying>
</view> </view>
<pay-success v-else></pay-success>
<pay-success :paySuccessInfo="dataQuery" v-else></pay-success>
<!-- 手机尾号后4位数验证 --> <!-- 手机尾号后4位数验证 -->
<input-box-end-phone v-if="showEndPhoneBox" :maskHeight="screenHeight" :maxInput="4" <input-box-end-phone v-if="showEndPhoneBox" :maskHeight="screenHeight" :maxInput="4"
@ -124,10 +124,21 @@
let {payRes,checkRes} = checkInfo let {payRes,checkRes} = checkInfo
// util.showNone(payRes.res.respMsg+"-"+payRes.res.respCode) // util.showNone(payRes.res.respMsg+"-"+payRes.res.respCode)
if(checkRes.pay_order.status == "1"){ if(checkRes.pay_order.status == "1"){
util.showNone(checkRes.res.respMsg+"-"+checkRes.res.respCode)
util.showNone(checkRes.res.respMsg)
this.paySuccessStatus = 1 this.paySuccessStatus = 1
}else{ }else{
util.showNone(checkRes.res.respMsg+"-"+checkRes.res.respCode)
// util.showNone(checkRes.res.respMsg+"-"+checkRes.res.respCode)
uni.showModal({
title: '支付失败',
content: checkRes.res.respMsg+"-"+checkRes.res.respCode,
showCancel: false,
confirmText: '确定',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
}
}
});
} }
}).finally(()=>{ }).finally(()=>{
util.hideLoad() util.hideLoad()
@ -285,7 +296,8 @@
.pay-page { .pay-page {
width: 750rpx; width: 750rpx;
.mheader{ .mheader{
width: 750rpx;
// width: 750rpx;
width:100%;
} }
} }
</style> </style>

BIN
uniapp_project_code/src/static/index/camera_icon2.png

After

Width: 112  |  Height: 111  |  Size: 3.7 KiB

8
uniapp_project_code/src/utils/util.js

@ -483,14 +483,14 @@ function getH5RefSize(that,refName){
query.select('.'+refName).boundingClientRect(); query.select('.'+refName).boundingClientRect();
// 执行查询 // 执行查询
query.exec((res) => { query.exec((res) => {
console.log(res);
// console.log(res);
if (res[0]) { if (res[0]) {
// res[0] 是包含节点信息的对象,其中 height 属性是元素的高度 // res[0] 是包含节点信息的对象,其中 height 属性是元素的高度
const height = res[0].height; const height = res[0].height;
console.log('元素的高度为:', height);
// console.log('元素的高度为:', height);
rs(res[0]) rs(res[0])
} else { } else {
console.log('未找到指定元素');
console.warn('未找到指定元素');
rj(false) rj(false)
} }
}); });
@ -525,8 +525,6 @@ function encrypt(config) {
} }
let b = config.url + '?' + qs.stringify(config.params) let b = config.url + '?' + qs.stringify(config.params)
console.warn(b)
let t = parseInt(new Date().getTime() / 1000 - config.timeDifference); let t = parseInt(new Date().getTime() / 1000 - config.timeDifference);
let s = a + '|1ba2212f78610369467de90fb1e3d345|' + b + '|4e68cd333457cb297a05ec7f77a9ad978b56cf57|' + t; let s = a + '|1ba2212f78610369467de90fb1e3d345|' + b + '|4e68cd333457cb297a05ec7f77a9ad978b56cf57|' + t;
let md5_str = md5.hex_md5(s) let md5_str = md5.hex_md5(s)

Loading…
Cancel
Save