Commit afece349 by zeven

外卖

parent a03c010a
code-push release-react ZmFaceCounter-android android -t '1.0.0' --des '1.3.22' && code-push promote ZmFaceCounter-android Staging Production --des '1.3.22'
# 热更新请直接执行./hotupdate.sh
# code-push rollback ZmFaceCounter-android Production --targetRelease v107
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -27,7 +27,6 @@
"react-native-code-push": "^6.3.0",
"react-native-keyevent": "0.2.8",
"react-native-qrcode-svg": "6.0.6",
"react-native-sound": "^0.11.2",
"react-native-svg": "12.1.0",
"react-native-swiper": "1.6.0",
"react-native-vector-icons": "6.6.0",
......
......@@ -35,6 +35,8 @@ axios.interceptors.request.use(config => {
// 门店Token
config.headers.common.Authorization = `Bearer ${window.auth.token}`;
// console.log("Token", `Bearer ${window.auth.token}`)
} else if (config.headers.Authorization) {
config.headers.common.Authorization = config.headers.Authorization;
}
return config;
});
......
......@@ -53,8 +53,17 @@ export default {
? yield call(api.token, action)
: yield call(api.refreshToken);
if (data && data.code === 1) {
if (data.data && data.data.jdkMerchantId && data.data.jdkShopId) {
yield call(AsyncStorage.setItem, 'isTakeaway', '1');
yield call(AsyncStorage.setItem, 'shopId', `${data.data.jdkShopId}`);
} else {
yield call(AsyncStorage.setItem, 'isTakeaway', '0');
yield call(AsyncStorage.removeItem, 'shopId');
}
if (data.data && data.data.closeNoBarcode) {
yield call(AsyncStorage.setItem, 'closeNoBarcode', '1');
} else {
yield call(AsyncStorage.setItem, 'closeNoBarcode', '0');
}
if (data.data && data.data.type) {
// 设备类型
......
......@@ -155,6 +155,9 @@ export default {
*noBuyGoGoGo(action, {call}) {
return yield call(api.noBuyGoGoGo, action);
},
*orderList(action, {call}) {
return yield call(api.orderList, action);
},
},
};
......
......@@ -13,7 +13,7 @@ import ModalStyles from '../components/Modal/styles';
import Speech from '../utils/Speech';
import Toast from '../components/Toast';
import NP from '../utils/np';
import {total} from '../utils/validity';
import {total, phone} from '../utils/validity';
import RedPacketModal from '../components/RedPacketModal';
import {width, height, scaleSize} from '../utils/screen';
import EnterEvent from '../utils/EnterEvent';
......@@ -76,7 +76,8 @@ const CounterMixins = ComposeComponent => {
numberValue: '',
human: false,
totalNum: 0,
hasCard: false,
hasCard: 0,
isCard: 0,
};
componentWillMount = async () => {
......@@ -190,7 +191,12 @@ const CounterMixins = ComposeComponent => {
// 是否支持刷卡
// state.isCard = true;
// window.cardCounter = data.data.cardCounter;
state.hasCard = true;
this.hasCardCounter = data.data.cardCounter;
state.hasCard = 1;
state.isCard = Number((await AsyncStorage.getItem('isCard')) || 0);
if (state.isCard) {
window.cardCounter = this.hasCardCounter;
}
}
if (data.data.logo) state.logo = `${ossLink}/${data.data.logo}`;
this.setState(state);
......@@ -252,6 +258,7 @@ const CounterMixins = ComposeComponent => {
if (Printer) {
const isConnected = await Printer.isConnected();
if (!isConnected) await Printer.usbConnect(); // 尝试连接打印机模块
//Printer.printSendOrder().then();
}
};
......@@ -737,6 +744,16 @@ const CounterMixins = ComposeComponent => {
this.modalResult();
};
handleTakeaway = () => {
this.handleScan = this.submitTakeaway;
this.setState({
modalS: true,
title: '请输入手机号码',
dot: false,
});
this.modalResult();
};
numChange = index => {
this.handleScan = this.submitGoodNum;
this.numIndex = index;
......@@ -861,14 +878,14 @@ const CounterMixins = ComposeComponent => {
}
}
if (data.data.category && data.data.category.search('烟') !== -1) {
if (this.state.banSmoke) {
if (this.state.banSmoke && !this.state.human) {
const msg = '云值守模式下不允许售卖香烟,请把香烟放回原位';
this.setState({voiceModal: true, voiceTitle: msg});
Speech.speak(msg);
clearTimeout(this.noAuthTimeout);
this.noAuthTimeout = setTimeout(() => {
this.setState({voiceModal: false});
}, 3000);
}, 6000);
return;
}
}
......@@ -949,6 +966,28 @@ const CounterMixins = ComposeComponent => {
}
};
submitTakeaway = async p => {
if (!phone.test(p)) {
Toast.info('请输入正确的手机号码', 2);
} else {
let shopId = await AsyncStorage.getItem('shopId');
const {data} = await this.props.dispatch({
type: 'store/orderList',
// phone: p,
shopId,
});
if (data.code === 1) {
if (data.data.length === 0) {
Toast.info('您在当前门店没有可核销的订单!', 3);
} else {
console.warn(JSON.stringify(data));
}
} else {
Toast.info('订单查询失败,请稍后再试!', 3);
}
}
};
goodsChangeSpeak = goodsArr => {
let totalNum = 0;
goodsArr.map(v => {
......@@ -1479,6 +1518,7 @@ const CounterMixins = ComposeComponent => {
handleBarcode={this.handleBarcode}
barcodepay={this.barcodepay}
handleCodeless={this.handleCodeless}
handleTakeaway={this.handleTakeaway}
clearList={this.clearList}
numAdd={this.numAdd}
numRemove={this.numRemove}
......
......@@ -14,6 +14,7 @@ import counterText from '../assets/Vertical/counterText.png';
import img24h from '../assets/Vertical/24h.png';
import phone from '../assets/Vertical/phone.png';
import guide from '../assets/Vertical/guide.jpg';
import takeaway from '../assets/Vertical/takeaway.png';
import {login} from '../utils/config';
import {colors} from '../utils/common';
import WxFacepay from '../utils/WxFacepay';
......@@ -56,17 +57,24 @@ class VerticalPage extends Component {
isCard: 0,
cardVisible: false,
noBuyModal: false,
hasCard: false,
hasCard: 0,
closeNoBarcode: 0,
isTakeaway: 0,
};
async componentWillMount() {
let stype = await AsyncStorage.getItem('STYPE');
let contact = await AsyncStorage.getItem('CONTACT');
let closeNoBarcode = await AsyncStorage.getItem('closeNoBarcode');
let isTakeaway = await AsyncStorage.getItem('isTakeaway');
// let lock = await AsyncStorage.getItem('settingLock');
// if (lock) this.props.dispatch({ type: 'app/lock', lock });
this.setState({stype, contact, closeNoBarcode: Number(closeNoBarcode)});
this.setState({
stype,
contact,
closeNoBarcode: Number(closeNoBarcode),
isTakeaway: Number(isTakeaway),
});
this.storeKey = await AsyncStorage.getItem('KEY');
if (!this.init) {
this.init = await WxFacepay.initialize(10000);
......@@ -162,7 +170,7 @@ class VerticalPage extends Component {
// state.isCard = true;
// window.cardCounter = data.data.cardCounter;
this.hasCardCounter = data.data.cardCounter;
state.hasCard = true;
state.hasCard = 1;
state.isCard = Number((await AsyncStorage.getItem('isCard')) || 0);
if (state.isCard) {
window.cardCounter = this.hasCardCounter;
......@@ -648,6 +656,7 @@ class VerticalPage extends Component {
isCard,
noBuyModal,
closeNoBarcode,
isTakeaway,
} = this.state;
pageSize =
goods && goods.bags.length > 0
......@@ -734,6 +743,16 @@ class VerticalPage extends Component {
<View style={styles.main}>
{goodsArr.length === 0 && stype === 'guard' ? (
<View style={styles.guardModal}>
{isTakeaway && (
<View style={styles.takeaway}>
<Touch onPress={() => this.props.handleTakeaway()}>
<View style={styles.takeaway_content}>
<Image style={styles.takeaway_image} source={takeaway} />
<Text style={styles.takeaway_text}>我是骑手</Text>
</View>
</Touch>
</View>
)}
<View style={styles.guardModal_image}>
<Image style={styles.cImage} source={guide} />
</View>
......@@ -1057,7 +1076,7 @@ class VerticalPage extends Component {
style={{backgroundColor: '#fc4000', marginRight: 50}}>
<Text style={styles.btnText}>输入条码</Text>
</Touch>
{priceVisible && !closeNoBarcode && (
{priceVisible && !closeNoBarcode ? (
<Touch
onPress={() => this.props.handleCodeless()}
style={{
......@@ -1067,6 +1086,10 @@ class VerticalPage extends Component {
}}>
<Text style={styles.btnText}>输入价格</Text>
</Touch>
) : (
<View style={{marginRight: 50, marginLeft: 50, opacity: 0}}>
<Text style={styles.btnText}>输入价格</Text>
</View>
)}
<Touch
onPress={this.props.clearList}
......@@ -1838,6 +1861,37 @@ const styles = {
height: '100%',
backgroundColor: '#0C0C0C',
},
takeaway: {
width: '100%',
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'center',
},
takeaway_content: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
borderTopWidth: 2,
borderBottomWidth: 2,
borderLeftWidth: 2,
borderTopLeftRadius: 100,
borderBottomLeftRadius: 100,
borderColor: '#fff',
backgroundColor: '#2B2B2B',
padding: 10,
opacity: 0.3,
},
takeaway_image: {
width: scaleSize(70),
height: scaleSize(70),
resizeMode: 'contain',
marginLeft: 10,
marginRight: 5,
},
takeaway_text: {
fontSize: scaleSize(40),
color: '#fff',
},
guardModal_image: {
width: '100%',
height: '60%',
......
......@@ -100,3 +100,8 @@ export function findModuleSetting({group}) {
export function noBuyGoGoGo() {
return axios.post('/store/counter/nobuy');
}
export function orderList({phone, shopId}) {
console.warn(phone, shopId);
return axios.post('/common/judanke/orderList', qs.stringify({phone, shopId}));
}
......@@ -157,6 +157,116 @@ if (_Printer) {
await Printer.halfCut(); // 半切
// await Printer.allCut(); // 全切
},
printSendOrder: async () => {
await Printer.initPrinter(); // 初始化配置
await Printer.printText('---------------------');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.setPrinter(Command.ALIGN, Command.ALIGN_CENTER); // 设置居中对齐
await Printer.setFont(0, 1, 1, 1, 0); // 字体加粗加大
await Printer.printText('-#**美团外卖-');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.setPrinter(Command.ALIGN, Command.ALIGN_CENTER); // 设置居中对齐
await Printer.setFont(0, 0, 0, 0, 0); // 默认字体
await Printer.printText('测试门店12345678');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.setPrinter(Command.ALIGN, Command.ALIGN_LEFT); // 还原左对齐
await Printer.setFont(0, 0, 0, 0, 0); // 默认字体
await Printer.printText('预计');
await Printer.setFont(0, 1, 1, 0, 0); // 大字体
await Printer.printText('今日 25:61');
await Printer.setFont(0, 0, 0, 0, 0); // 恢复默认字体
await Printer.printText('送达');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('---------------------');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('下单时间:yyyy-mm-dd HH:mm:ss');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('---------------------');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.setFont(0, 1, 1, 0, 0); // 大字体
await Printer.printText('备注:不要备注不要备注');
await Printer.setFont(0, 0, 0, 0, 0); // 恢复默认字体
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('*********************');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('-------1号口袋-------');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
const row = ['可乐,2,3.5,7.0', '怡宝,4,2.0,8.0'];
await Printer.printTable('商品,数量,单价,金额', ',', 384, row);
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('*********************');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('---------其他--------');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
const rowTemp = ['打包费,2', '配送费,2'];
await Printer.printTable(' , ', ',', 384, rowTemp);
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('*********************');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 2); // 换行
await Printer.setPrinter(Command.ALIGN, Command.ALIGN_RIGHT); // 右对齐
await Printer.printText('原价:88.88元');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('(用户在线支付)');
await Printer.setFont(0, 1, 1, 0, 0); // 大字体
await Printer.printText('88.00元');
await Printer.setFont(0, 0, 0, 0, 0); // 恢复默认字体
await Printer.setPrinter(Command.ALIGN, Command.ALIGN_LEFT); // 恢复左对齐
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('---------------------');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.setFont(0, 1, 1, 0, 0); // 大字体
await Printer.printText('XXX');
await Printer.setFont(0, 0, 0, 0, 0); // 恢复默认字体
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('XXX');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.setFont(0, 1, 1, 0, 0); // 大字体
await Printer.printText('顾客号码:手机尾号8888');
await Printer.setFont(0, 0, 0, 0, 0); // 恢复默认字体
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('xxxxxxxxxxxxxx');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.printText('xxxxxxxxxxxxxx');
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.setFont(0, 1, 1, 0, 0); // 大字体
await Printer.printText('顾客地址:xxxxxxxxxxxxxxxx');
await Printer.setFont(0, 0, 0, 0, 0); // 恢复默认字体
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.setPrinter(Command.ALIGN, Command.ALIGN_CENTER); // 设置居中对齐
await Printer.setFont(0, 1, 1, 1, 0); // 字体加粗加大
await Printer.printText('-#**美团外卖-');
await Printer.setFont(0, 0, 0, 0, 0); // 恢复默认字体
await Printer.setPrinter(Command.ALIGN, Command.ALIGN_LEFT); // 恢复左对齐
await Printer.setPrinter(Command.PRINT_AND_WAKE_PAPER_BY_LINE, 1); // 换行
await Printer.sendBytesData([28, 33, 0]);
await Printer.allCut(); // 半切
},
printNote: async (row, params) => {
let now = new Date();
await Printer.initPrinter(); // 初始化配置
......
const app = ''; // eg: .25h/.eg
export const isProd = process.env.NODE_ENV === 'production';
// export const host = isProd
// ? `https://api${app}.vs-u.com`
// : 'http://192.168.88.34:7001';
export const host = isProd
? `https://api${app}.vs-u.com`
: `https://api${app}.vs-u.com`;
: 'http://192.168.88.34:7001';
// export const host = isProd
// ? `https://api${app}.vs-u.com`
// : `https://api${app}.vs-u.com`;
export const login = `https://m${app}.vs-u.com`;
export const qrHost = login;
export const imgUrl = 'http://barcod.oss-cn-shenzhen.aliyuncs.com/images/';
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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