平板端快衣店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

141 lines
3.6 KiB

<template>
<view>
<view style="height: 80rpx;line-height: 100rpx;padding-left: 20rpx;width: 95%;margin: 0 auto;">
打印设置
</view>
<view style="width: 95%;margin: 0 auto;background: #fff;border-radius: 10px;padding: 15rpx;">
<radio-group @change="radioChange" style="display: flex;">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items" :key="item.value" style="flex: 1;">
<view style="height: 100rpx;line-height: 100rpx;">
<view style="height: 80rpx;line-height: 80rpx;">
<radio :value="item.value" :checked="index === current" />
{{item.name}}
</view>
</view>
</label>
</radio-group>
<view style="display: flex;">
<view style="width: 20%;height: 80rpx;line-height: 80rpx;">打印份数:</view>
<input type="number" placeholder="请输入物流单打印份数" v-model="wlNum"
style="width: 80%;height: 80rpx;line-height: 80rpx;margin:0 10rpx;border: 1px solid #eee;padding-left: 20rpx;">
</view>
</view>
<view style="background: #fff;width: 100%;height: 120rpx;position: fixed;bottom: 0;">
<view @tap="editPrintWay" style="text-align: center;border-radius: 20rpx;font-size: 36rpx;width: 95%;margin: 15rpx auto 0;height: 90rpx;background: #088FEB;color: #fff;line-height: 90rpx;">
修改
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
items: [{
value: 'zwl',
name: '只打印物流单',
copies:1
},
{
value: 'wlhxp',
name: '打印物流单和小标签',
WLcopies:1,
XBQcopies:1,
}],
current: 0,
wlNum:uni.getStorageSync('wlNum')?uni.getStorageSync('wlNum'):1
}
},
onLoad(){
if(uni.getStorageSync('wlNum') > 0 && uni.getStorageSync('xbqNum') > 0){
//两个都打印
this.current = 1
}else{
this.current = 0
}
},
methods: {
radioChange(evt) {
for (let i = 0; i < this.items.length; i++) {
if (this.items[i].value === evt.detail.value) {
this.current = i;
break;
}
}
},
editPrintWay(){
console.log(this.wlNum)
let printMethod = {}
if(this.current == 0){
if(this.wlNum != '' && this.wlNum != 0){
printMethod = {
wlNum:this.wlNum
}
uni.setStorageSync('wlNum',this.wlNum)
uni.removeStorageSync('xbqNum')
}else{
uni.showToast({
title:'请输入打印份数'
})
return
}
}else{
if(this.wlNum != '' && this.wlNum != 0){
printMethod = {
wlNum:this.wlNum,
xbqNum:1
}
uni.setStorageSync('wlNum',this.wlNum)
uni.setStorageSync('xbqNum',1)
}else{
uni.showToast({
title:'请输入打印份数'
})
return
}
}
uni.request({
url: this.tui.interfaceUrl() + '/app/logitics/updateLogiticsCompany',
data: {
id:uni.getStorageSync('transCompany'),
printMethod:JSON.stringify(printMethod)
},
header: {
'content-type': 'application/json',
'appWLToken': this.tui.getToken()
},
method: 'POST', //'GET','POST'
dataType: 'json',
success: (res) => {
if (res.data.code == 401) {
uni.clearStorage()
uni.navigateTo({
url: '/pages/login/login'
})
}
if (res.data.code == 200) {
uni.showToast({
title:'修改成功'
})
setTimeout(res=>{
uni.navigateBack()
},1000)
}
},
fail: (res) => {
this.tui.toast("网络不给力,请稍后再试~")
}
})
}
}
}
</script>
<style lang="scss">
page,
.page1 {
width: 100%;
}
</style>