123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- <template>
- <view>
- <view class="box">
- <view class="top">
- <text class="title">申报单录入</text>
- </view>
- <view class="item">
- <view class="l"><text style="color: red;">*</text>申报人:</view>
- <view class="r">
- <u-input placeholder="申报人" @input="handler()" v-model="form.declarePeople">
- </u-input>
- </view>
- </view>
- <view class="item">
- <view class="l"><text style="color: red;">*</text>申报电话:</view>
- <view class="r">
- <u-input placeholder="申报电话" @input="handler()" v-model="form.declarePhone">
- </u-input>
- </view>
- </view>
- <view class="item">
- <view class="l"><text style="color: red;">*</text>产品学名:</view>
- <view class="r">
- <u-input placeholder="输入产品学名" @input="handler()" v-model="form.goodsName">
- </u-input>
- </view>
- </view>
- <view class="item">
- <view class="l"><text style="color: red;">*</text>生产批号:</view>
- <view class="r">
- <u-input placeholder="生产批号" @input="handler()" v-model="form.productionCode" />
- </view>
- </view>
- <view class="item">
- <view class="l"><text style="color: red;">*</text>毛重:</view>
- <view class="r">
- <u-input type="number" placeholder="输入毛重" @input="handler()" v-model="form.grossWeight">
- <text slot="suffix">吨</text>
- </u-input>
- </view>
- </view>
- <view class="item">
- <view class="l">数量:</view>
- <view class="r">
- <u-input type="number" placeholder="输入数量" @input="handler()" v-model="form.num">
- </u-input>
- </view>
- </view>
- <view class="item">
- <view class="l">生产日期:</view>
- <view class="r">
- <view class="r">
- <uni-datetime-picker placeholder="请选择" @input="handler()" :clear-icon="false" type="date"
- v-model="form.productionDate" />
- </view>
- </view>
- </view>
- <view class="item">
- <view class="l">保质期(天):</view>
- <view class="r">
- <view class="r">
- <u-input placeholder="输入保质期" type="number" @input="handler()" v-model="form.expirationDate" />
- </view>
- </view>
- </view>
- <view class="item">
- <view class="l">储存条件:</view>
- <view class="r">
- <u-input placeholder="储存条件" @input="handler()" v-model="form.storageMode" />
- </view>
- </view>
- <view class="item">
- <view class="l">生产方式:</view>
- <view class="r">
- <u-input placeholder="生产方式" @input="handler()" v-model="form.productionMode" />
- </view>
- </view>
- <view class="item">
- <view class="l">原产国:</view>
- <view class="r">
- <u-input placeholder="原产国" @input="handler()" v-model="form.origin" />
- </view>
- </view>
- <view class="item">
- <view class="l">货主单位:</view>
- <view class="r">
- <u-input placeholder="货主单位" @input="handler()" v-model="form.sendUnit" />
- </view>
- </view>
- <view class="item">
- <view class="l">注册商号:</view>
- <view class="r">
- <u-input placeholder="注册商号" @input="handler()" v-model="form.producerCode" />
- </view>
- </view>
- <view class="item">
- <view class="l">收货单位:</view>
- <view class="r">
- <u-input placeholder="收货单位" @input="handler()" v-model="form.receiveUnit" />
- </view>
- </view>
- <view class="item">
- <view class="l">货物流向:</view>
- <view class="r">
- <u-input placeholder="货物流向" @input="handler()" v-model="form.route" />
- </view>
- </view>
- <view class="item">
- <view class="l">司机姓名:</view>
- <view class="r">
- <u--textarea @input="handler()" v-model="form.driverName" placeholder="司机姓名,多个请用逗号隔开"></u--textarea>
- </view>
- </view>
- <view class="item">
- <view class="l">司机电话:</view>
- <view class="r">
- <u--textarea @input="handler()" v-model="form.driverPhone" placeholder="司机电话,多个请用逗号隔开">
- </u--textarea>
- </view>
- </view>
- <view class="item">
- <view class="l">代理商:</view>
- <view class="r">
- <u-input placeholder="代理商" @input="handler()" v-model="form.agent" />
- </view>
- </view>
- <view class="item">
- <view class="l" style="flex: 6;">代理商电话:</view>
- <view class="r">
- <u-input placeholder="代理商电话" @input="handler()" v-model="form.agentPhone" />
- </view>
- </view>
- <view class="item">
- <view class="l" style="flex: 6;">运输车车牌:</view>
- <view class="r">
- <u-input placeholder="运输车车牌" @input="handler()" v-model="form.chinaCarNo" />
- </view>
- </view>
- <view class="item">
- <view class="l">越南车牌:</view>
- <view class="r">
- <u-input placeholder="越南车牌" @input="handler()" v-model="form.carNo" />
- </view>
- </view>
- <view class="item">
- <view class="l" style="flex: 6;">海关报关单据:</view>
- <view class="r">
- <u-input placeholder="海关报关单据" @input="handler()" v-model="form.customProof" />
- </view>
- </view>
- <view class="item">
- <view class="l" style="flex: 6;">检验检疫证:</view>
- <view class="r">
- <u-input placeholder="检验检疫证" @input="handler()" v-model="form.quarantineProof" />
- </view>
- </view>
- <view class="item">
- <view class="l">商铺:</view>
- <view class="r">
- <u-input placeholder="商铺" @input="handler()" v-model="form.shop" />
- </view>
- </view>
- <view class="item">
- <view class="l">柜号:</view>
- <view class="r">
- <u-input placeholder="柜号" @input="handler()" v-model="form.containerCode" />
- </view>
- </view>
- </view>
- <u-button type="primary" text="确定" @click="saveFn"></u-button>
- <u-button type="info" text="重置" @click="cleanFn" style="margin-top: 20rpx;"></u-button>
- <!-- ---------------------------------------------------------- -->
- <view class="bottom-safety"></view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- form: {
- declarePeople: '',
- declarePhone: '',
- goodsName: '',
- grossWeight: 0,
- num: 0,
- productionDate: '',
- expirationDate: '',
- productionMode: '',
- origin: '',
- sendUnit: '',
- producerCode: '',
- receiveUnit: '',
- route: '',
- storageMode: '',
- driverName: '',
- driverPhone: '',
- agent: '',
- chinaCarNo: '',
- carNo: '',
- customProof: '',
- quarantineProof: '',
- shop: '',
- productionCode: '',
- containerCode: ''
- },
- }
- },
- onShow() {},
- mounted() {
- this.checkStore();
- },
- methods: {
- createModal() {
- return {
- declarePeople: '',
- declarePhone: '',
- goodsName: '',
- grossWeight: 0,
- num: 0,
- productionDate: '',
- expirationDate: '',
- productionMode: '',
- origin: '',
- sendUnit: '',
- producerCode: '',
- receiveUnit: '',
- route: '',
- storageMode: '',
- driverName: '',
- driverPhone: '',
- agent: '',
- chinaCarNo: '',
- carNo: '',
- customProof: '',
- quarantineProof: '',
- shop: '',
- productionCode: '',
- containerCode: ''
- }
- },
- cleanFn() {
- this.form = this.createModal();
- this.cleanStore();
- },
- cleanStore() {
- uni.removeStorageSync('declare')
- },
- handler() {
- uni.setStorageSync('declare', this.form);
- },
- checkStore() {
- let store = uni.getStorageSync('declare');
- if (store && JSON.stringify(store) !== JSON.stringify(this.createModal())) {
- let that = this;
- uni.showModal({
- title: '提示',
- content: '检测到您有未完成表单,是否继续?',
- success(resp) {
- if (resp.confirm) {
- that.form = store
- } else {
- that.cleanFn();
- }
- }
- })
- }
- },
- saveFn() {
- if (!this.form.declarePeople) {
- this.$common.toast('请填写申报人');
- return;
- }
- if (!this.form.declarePhone) {
- this.$common.toast('请填写申报电话');
- return;
- }
- if (!this.form.goodsName) {
- this.$common.toast('请填写产品');
- return;
- }
- if (!this.form.productionCode) {
- this.$common.toast('请填写生产批号');
- return;
- }
- if (!this.form.grossWeight || this.form.grossWeight <= 0) {
- this.$common.toast('请填写毛重');
- return;
- }
- this.$api.addDeclare(this.$common.removeNull(this.form)).then(resp => {
- this.cleanStore();
- this.$common.to('/pages/declare/addDeclareSuccess')
- })
- }
- },
- }
- </script>
- <style lang="scss">
- page {
- background-color: #fff;
- }
- .hs-item {
- text-align: center;
- }
- .item-line {
- color: #a2a2a2;
- padding: 5px 0 10px 29px;
- border-bottom: 1px solid #E5E5E5;
- }
- .hj {
- padding: 50rpx;
- font-size: 40rpx;
- color: red;
- font-weight: bold;
- }
- .save-btn {
- background-color: #ff4200;
- height: 88rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- margin: 60rpx;
- color: #fff;
- font-size: 30rpx;
- font-weight: bold;
- border-radius: 10rpx;
- }
- @import '@/common/common.scss'
- </style>
|