Commit 07e4a344 authored by jiangjiantao's avatar jiangjiantao

页面串连起来

parent 8d5fddc2
...@@ -29,17 +29,17 @@ App({ ...@@ -29,17 +29,17 @@ App({
} }
}); });
//添加后屏小程序 //添加后屏小程序
my.ix.addExtensionApp({ // my.ix.addExtensionApp({
appId: "****************", // appId: "****************",
// 填入后屏小程序的 AppID // // 填入后屏小程序的 AppID
type: "screen", // type: "screen",
success: (res) => { // success: (res) => {
console.log("addExtensionApp success:", res) // console.log("addExtensionApp success:", res)
}, // },
fail: (res) => { // fail: (res) => {
console.log("addExtensionApp fail:", res) // console.log("addExtensionApp fail:", res)
}, // },
}) // })
}, },
onShow(options) { onShow(options) {
// 从后台被 scheme 重新打开 // 从后台被 scheme 重新打开
......
{ {
"pages": [ "pages": [
"pages/login/login",
"pages/paysuccess/paysuccess", "pages/paysuccess/paysuccess",
"pages/balance/balance", "pages/balance/balance",
"pages/scan/scan", "pages/scan/scan",
"pages/home/home", "pages/home/home",
"pages/login/login",
"pages/index/index" "pages/index/index"
], ],
"window": { "window": {
......
export const API_LOGIN = "store/cashier/login";
export const API_SCAN = "market/barcodeQuery";
Page({ Page({
data: { data: {
goodsNum:"--", goodsNum:0,
payPrice:"--", payPrice:0.00,
totalPrice:"--", totalPrice:0.00,
couponPrice:"--", couponPrice:0.00,
qrPayShow:false, qrPayShow:false,
}, },
onLoad() {}, onLoad(options) {
var totalQuantity = options.totalQuantity
var totalPrice = options.totalPrice
var totalDisc = options.totalDisc
if (totalQuantity != null) {
this.setData({
goodsNum: totalQuantity,
})
}
//暂时没有优惠
if (totalPrice != null) {
this.setData({
payPrice: totalPrice,
totalPrice: totalPrice,
})
}
},
facePay(){ facePay(){
......
{} {
\ No newline at end of file "transparentTitle": "always"
}
\ No newline at end of file
import { Page } from '../../utils/scan';
Page({ Page({
data: { data: {
...@@ -26,5 +28,18 @@ Page({ ...@@ -26,5 +28,18 @@ Page({
my.navigateTo({ my.navigateTo({
url: "/pages/balance/balance" url: "/pages/balance/balance"
}); });
} },
//外接扫码枪事件
onKeyPress(r) {
console.log("scan onKeyPress==>" + r);
// this.getGoodInfoByBarcode(r);
my.navigateTo({
url: "/pages/scan/scan?barcode=" + r,
});
},
}); });
{ {
"transparentTitle": "always",
"usingComponents":{ "usingComponents":{
"scandialog":"/custom_widgets/scandialog/scandialog" "scandialog":"/custom_widgets/scandialog/scandialog"
} }
......
<view class="pagex"> <view class="pagex">
<view slot="header" class="scan-header"> <view slot="header" class="scan-header">
<view> <view hidden="{{memberPhone == ''}}" >
欢迎您,130****6170 欢迎您,{{memberPhone}}
</view> </view>
<view> <view hidden="{{memberPoint == 0}}">
积分:130 积分:{{memberPoint}}
</view> </view>
</view> </view>
<scroll-view class="scan-good-body" scroll-y > <scroll-view class="scan-good-body" scroll-y >
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
<view slot="footer" class="scan-bottom"> <view slot="footer" class="scan-bottom" >
<view class="scan-bottom-item"> <view class="scan-bottom-item">
<view class="scan-price-total-propmt"> <view class="scan-price-total-propmt">
总额 总额
...@@ -33,6 +33,11 @@ ...@@ -33,6 +33,11 @@
<view class="scan-price-quantity-propmt"> <view class="scan-price-quantity-propmt">
(共{{totalQuantity}}件) (共{{totalQuantity}}件)
</view> </view>
<button style="margin-left:120rpx;padding-left:20rpx;padding-right:20rpx;" size="default" type="primary" onTap="goBalance">
去支付
</button>
</view> </view>
<!-- <view class="scan-bottom-item"> <!-- <view class="scan-bottom-item">
<view class="scan-price-total-propmt"> <view class="scan-price-total-propmt">
......
var api = require("../../utils/api.js"); var api = require("../../utils/api.js");
import { Page } from '../../utils/scan'; import { Page } from '../../utils/scan';
import {API_SCAN} from '../../const/apiurl'
Page({ Page({
data: { data: {
goods: [], goods: [],
totalPrice: 0.00, totalPrice: 0.00,
totalQuantity: 0 totalQuantity: 0,
totalDisc:0.00,
memberPhone:'',
memberPoint:0
},
onLoad: function (options) {
var barcode = options.barcode
if(barcode != null){
console.log("首页传递过来的商品条码是 " + barcode);
this.getGoodInfoByBarcode(barcode)
}
}, },
//外接扫码枪事件 //外接扫码枪事件
...@@ -16,10 +30,15 @@ Page({ ...@@ -16,10 +30,15 @@ Page({
//获取商品信息 //获取商品信息
getGoodInfoByBarcode(barcode) { getGoodInfoByBarcode(barcode) {
////根据条形码查询商品接口 ////根据条形码查询商品接口
var API_SCAN = "market/barcodeQuery";
my.showLoading({}); my.showLoading({});
var scanGoodRequest = api.createCommonRequest(); var scanGoodRequest = api.createCommonRequest();
scanGoodRequest.goodsId = barcode; scanGoodRequest.goodsId = barcode;
//管理员需要额外传一个storeid 但是目前这个设备是没有
// let storeId = getApp().globalData.localAccountInfo.storeId
// let actType = getApp().globalData.localAccountInfo.actType
// if (storeId != null && actType == 1) {
// scanGoodRequest = storeId
// }
console.log("扫商品的请求 ==>" + JSON.stringify(scanGoodRequest)); console.log("扫商品的请求 ==>" + JSON.stringify(scanGoodRequest));
my.request({ my.request({
url: getApp().globalData.BASE_URL + API_SCAN, url: getApp().globalData.BASE_URL + API_SCAN,
...@@ -118,8 +137,14 @@ Page({ ...@@ -118,8 +137,14 @@ Page({
this.setData({ totalQuantity: totalQuantityTemp, this.setData({ totalQuantity: totalQuantityTemp,
totalPrice: totalPriceTemp, totalPrice: totalPriceTemp,
}) })
//管理员需要额外传一个storeid
},
//跳转结算页面
goBalance() {
my.navigateTo({
url: "/pages/balance/balance?totalPrice=" + this.data.totalPrice+"&totalQuantity="+this.data.totalQuantity+"&totalDisc="+this.data.totalDisc,
});
} }
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment