Commit 07e4a344 authored by jiangjiantao's avatar jiangjiantao

页面串连起来

parent 8d5fddc2
......@@ -29,17 +29,17 @@ App({
}
});
//添加后屏小程序
my.ix.addExtensionApp({
appId: "****************",
// 填入后屏小程序的 AppID
type: "screen",
success: (res) => {
console.log("addExtensionApp success:", res)
},
fail: (res) => {
console.log("addExtensionApp fail:", res)
},
})
// my.ix.addExtensionApp({
// appId: "****************",
// // 填入后屏小程序的 AppID
// type: "screen",
// success: (res) => {
// console.log("addExtensionApp success:", res)
// },
// fail: (res) => {
// console.log("addExtensionApp fail:", res)
// },
// })
},
onShow(options) {
// 从后台被 scheme 重新打开
......
{
"pages": [
"pages/login/login",
"pages/paysuccess/paysuccess",
"pages/balance/balance",
"pages/scan/scan",
"pages/home/home",
"pages/login/login",
"pages/index/index"
],
"window": {
......
export const API_LOGIN = "store/cashier/login";
export const API_SCAN = "market/barcodeQuery";
Page({
data: {
goodsNum:"--",
payPrice:"--",
totalPrice:"--",
couponPrice:"--",
goodsNum:0,
payPrice:0.00,
totalPrice:0.00,
couponPrice:0.00,
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(){
......
{}
\ No newline at end of file
{
"transparentTitle": "always"
}
\ No newline at end of file
import { Page } from '../../utils/scan';
Page({
data: {
......@@ -26,5 +28,18 @@ Page({
my.navigateTo({
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":{
"scandialog":"/custom_widgets/scandialog/scandialog"
}
......
<view class="pagex">
<view slot="header" class="scan-header">
<view>
欢迎您,130****6170
<view hidden="{{memberPhone == ''}}" >
欢迎您,{{memberPhone}}
</view>
<view>
积分:130
<view hidden="{{memberPoint == 0}}">
积分:{{memberPoint}}
</view>
</view>
<scroll-view class="scan-good-body" scroll-y >
......@@ -22,7 +22,7 @@
</view>
</block>
</scroll-view>
<view slot="footer" class="scan-bottom">
<view slot="footer" class="scan-bottom" >
<view class="scan-bottom-item">
<view class="scan-price-total-propmt">
总额
......@@ -33,6 +33,11 @@
<view class="scan-price-quantity-propmt">
(共{{totalQuantity}}件)
</view>
<button style="margin-left:120rpx;padding-left:20rpx;padding-right:20rpx;" size="default" type="primary" onTap="goBalance">
去支付
</button>
</view>
<!-- <view class="scan-bottom-item">
<view class="scan-price-total-propmt">
......
var api = require("../../utils/api.js");
import { Page } from '../../utils/scan';
import {API_SCAN} from '../../const/apiurl'
Page({
data: {
goods: [],
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({
//获取商品信息
getGoodInfoByBarcode(barcode) {
////根据条形码查询商品接口
var API_SCAN = "market/barcodeQuery";
my.showLoading({});
var scanGoodRequest = api.createCommonRequest();
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));
my.request({
url: getApp().globalData.BASE_URL + API_SCAN,
......@@ -118,8 +137,14 @@ Page({
this.setData({ totalQuantity: totalQuantityTemp,
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