This commit is contained in:
魏啾
2024-05-22 14:31:07 +08:00
parent 7cd5649764
commit f832e312bf
7 changed files with 178 additions and 42 deletions

View File

@@ -4,17 +4,17 @@
<view class="Box_box flex-between" @click="showpopupclick">
<view>*项目名称</view>
<view class=""
style="width: 60%; overflow:hidden; font-size:32rpx;color:grey;text-overflow: ellipsis;white-space: nowrap; "
v-model="form.article">{{ form.article || '选择项目名称' }}
style="width: 60%; overflow:hidden; font-size:32rpx;text-overflow: ellipsis;white-space: nowrap; "
v-model="form.article">{{ form.article}} <text v-if="!form.article"
style="color: #86909c;">选择项目名称</text>
</view>
</view>
<view class="Box_box flex-between">
<view>*金额</view>
<view><input type="digit" v-model="form.price" @input="handleInputChange" placeholder="请填写金额" /></view>
<view><input type="digit" v-model="form.price" @input="onInput" placeholder="请填写金额" /></view>
</view>
<view class="Box_box flex-between">
<view>*数量</view>
<view>*数量</view>
<view><input type="number" v-model="form.number" @input="handleInputChange" placeholder="请填写数量"
data-key="mobile" /></view>
</view>
@@ -25,15 +25,21 @@
</view>
</view>
<view class="Box_box flex-between">
<view>*税额</view>
<view>*税额</view>
<view><input type="text" disabled='false' v-model="form.tax_amount" placeholder="请填写税额"
data-key="mobile" /></view>
</view>
<view class="Box_box flex-between">
<view>*单价</view>
<view>*单价</view>
<view><input type="text" disabled='false' v-model="form.d_price" placeholder="请填写单价"
data-key="mobile" /></view>
</view>
<view class="Box_box flex-between" @click="Issuedbyshowpicker = true">
<view class="Box_boxlang Box_box_bouttme_item_O">*开票人</view>
<view class="Box_box_bouttme_item_T">
<text type="text" v-model="form.dlzhid">{{ form.dlzhid || '请选择开票人' }}</text>
</view>
</view>
<view class="Box_box flex-between">
<view>备注</view>
<u--textarea v-model="form.notes" placeholder="请输入内容"></u--textarea>
@@ -53,24 +59,28 @@
<view class="popupshowonebotton" @click="businesscategory">搜索其他项目名称</view>
</view>
</u-popup>
<u-picker :show="showpicker" @confirm="showpickerconfirm" :columns="columns"
@cancel="showpicker = false"></u-picker>
<u-picker :show="showpicker" @confirm="showpickerconfirm" :columns="columns" @cancel="showpicker = false"
:defaultIndex='[0,0]'></u-picker>
<u-picker :show="Issuedbyshowpicker" @confirm="Issuedbyconfirm" :columns="Issuedbycolumns"
@cancel="Issuedbyshowpicker = false" keyName='name'></u-picker>
</view>
</template>
<script>
export default {
data() {
return {
keyword: uni.getStorageSync('keyword'),
keyword: uni.getStorageSync('keyword').name,
showpopup: false,
showpicker: false,
Issuedbyshowpicker: false,
columns: [],
Issuedbycolumns: [],
Uploadurlnumber: '',
namelang: '',
merchantAuditStatus: '',
form: {
store_id: uni.getStorageSync('userId'),
article: '',
article: uni.cache.get('keyword').name,
type: '',
price: '',
se_amount: '',
@@ -78,51 +88,51 @@
tax_amount: '',
d_price: '',
notes: '',
// new: 'new'
mcc: uni.cache.get('keyword').code,
dlzh: '',
dlzhid: "",
is_new: 1
}
};
},
onNavigationBarButtonTap() {
uni.pro.navigateTo('index/order');
},
onLoad(e) {
async onLoad(e) {
// #ifdef APP-PLUS
let webView = this.$mp.page.$getAppWebview();
webView.setTitleNViewButtonStyle(0, {
width: '70px'
});
// #endif
uni.request({
url: uni.conf.baseUrl + 'store/digitalinvoice',
method: 'POST', //请求方式,必须为大写
success: res => {
console.log(res.data.data)
this.columns = res.data.data
}
});
let res = await this.api.storedigitalinvoice()
this.columns = res.data
let ress = await this.api.szzpyissuedby({
store_id: uni.getStorageSync('userId'),
})
this.Issuedbycolumns = [ress.data]
console.log(this.Issuedbycolumns)
},
onShow() {
uni.$on('businesscategorys', res => {
console.log(res);
this.form.mcc = res.code;
this.form.article = res.name;
this.keyword = uni.cache.get('keyword')
this.form.mcc = uni.cache.get('keyword').code
this.form.article = uni.cache.get('keyword').name
this.keyword = uni.cache.get('keyword').keyword
// this.form.contactLine = res.unionpayCode
// this.form.branchName = res.branchName
});
},
methods: {
showpopupclick() {
this.keyword = uni.getStorageSync('keyword')
this.keyword = uni.getStorageSync('keyword').name
this.showpopup = true
},
popupshowone_itemone() {
this.showpopup = false
this.form.article = this.keyword
},
handleInputChange() {
handleInputChange(e) {
if (this.form.price == null || this.form.price == '') {
return false;
}
@@ -132,9 +142,25 @@
if (this.form.type == null || this.form.type == '') {
return false;
}
uni.$u.debounce(this.showpickerconfirm(), 1000)
uni.$u.debounce(this.showpickerconfirm(), 500)
},
onInput(e) {
if (this.form.price == null || this.form.price == '') {
return false;
}
if (this.form.number == null || this.form.number == '') {
return false;
}
if (this.form.type == null || this.form.type == '') {
return false;
}
if (e.detail.value) {
uni.$u.debounce(this.showpickerconfirm(), 500)
} else {
this.subCategoryList = []
}
},
showpickerconfirm(e) {
if (this.form.price == null || this.form.price == '') {
uni.showToast({
@@ -177,6 +203,15 @@
}
});
},
Issuedbyconfirm(e) {
this.Issuedbyshowpicker = false
console.log(e)
if (e.value) {
this.form.dlzh = e.value[0].id
this.form.dlzhid = e.value[0].name
// this.form.dlzh = e.value.toString();
}
},
businesscategory() {
this.showpopup = false
uni.pro.navigateTo('index/businesscategory');
@@ -224,7 +259,13 @@
});
return false;
}
if (this.form.dlzh == null || this.form.dlzh == '') {
uni.showToast({
title: '请选择开票人',
icon: 'none'
});
return false;
}
uni.request({
url: uni.conf.baseUrl + 'store/subinvoicing',
data: this.form,
@@ -233,14 +274,16 @@
console.log(res)
this.form = {
store_id: uni.getStorageSync('userId'),
article: '',
article: uni.cache.get('keyword').name,
type: '',
price: '',
se_amount: '',
number: '',
tax_amount: '',
d_price: '',
notes: '',
se_amount: ''
mcc: uni.cache.get('keyword').code,
dlzh: ''
}
uni.showToast({
title: res.data.message || res.data.msg,