// packageA/mycomponent/sweep_buy_goods/sweep_buy_goods.js const app = getApp(); let _this = null; Component({ /** * 组件的属性列表 */ properties: { prop_goods_info: { type: null, //父组件的商品详情数据 }, goodsId: { type: Number, }, goodsType: { type: String, }, hoet: { type: null, }, }, /** * 组件的初始数据 */ data: { money: 0, numberKeyBoardClose:()=> { _this.confirmPay(); return false; }, keyBoardShow: false, passValueArr: [], titleBgMode: "hide", cservice: {}, details: {}, showServicePopup: false, cursorIndex: 0 }, /** * 组件的方法列表 */ lifetimes: { attached() { _this = this; wx.setNavigationBarTitle({ title: '扫码下单', }); this.getDetails(); } }, methods: { openService() { this.setData({ showServicePopup: !this.data.showServicePopup }); }, confirmPay() { if (this.data.details.status != 1) { return app.tips("当前收款码已关闭,请联系客服!"); } if(Number(this.data.money) == 0){ return app.tips("付款金额必须大于0"); } if(this.data.passValueArr && this.data.passValueArr[this.data.passValueArr.length-1]=="."){ return app.tips("请输入完整数字"); } wx.navigateTo({ url: '/packageC/cashier/cashier_pay/cashier_pay?cashier_type=scanning_payment&price=' + this.data.money + '&goods_id=' + this.data.goodsId, }); }, handkeyboardinput(evt) { let passValueArr = evt.detail.passValueArr; this.setData({ passValueArr, cursorIndex: passValueArr.length, money: passValueArr.length == 0 ? '0' : passValueArr.join("") }); }, setTopping() { wx.pageScrollTo({ scrollTop: 0 }); }, getDetails() { this.setData({ details: this.data.prop_goods_info.get_goods, cservice: this.data.prop_goods_info.customer_service, keyBoardShow: true }); }, } });