123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <template>
- <view class="goods-page">
- <u-navbar
- height="40px"
- title="新增录入"
- bgColor="rgba(2, 86, 255, 1)"
- autoBack
- placeholder
- titleStyle="color:#fff"
- leftIconColor="#fff"
- >
- <view class="u-nav-slot depot-label" slot="right">
- <view class="name" style="color: #fff">{{ curDepotName }}</view>
- </view>
- </u-navbar>
- <view class="container_main">
- <u--form
- labelPosition="left"
- :model="form"
- :rules="rules"
- labelWidth="90"
- >
- <u-form-item
- label="货物条码"
- prop="barCode"
- borderBottom
- customStyle="padding: 30rpx 0"
- >
- <u-input v-model="form.barCode" border="none" placeholder="请输入">
- <u-image
- slot="suffix"
- src="@/static/image/scan-icon-2.png"
- width="40rpx"
- height="40rpx"
- @click="scanCode"
- ></u-image>
- </u-input>
- </u-form-item>
- <u-form-item
- label="货物名称"
- prop="materialName"
- borderBottom
- customStyle="padding: 30rpx 0"
- >
- <u-input
- v-model="form.materialName"
- border="none"
- placeholder="请输入"
- ></u-input>
- </u-form-item>
- <u-form-item
- label="规格"
- prop="materialStandard"
- borderBottom
- customStyle="padding: 30rpx 0"
- >
- <u-input
- v-model="form.materialStandard"
- border="none"
- placeholder="请输入"
- ></u-input>
- </u-form-item>
- <u-form-item
- label="生产日期"
- prop="productionDate"
- borderBottom
- customStyle="padding: 30rpx 0"
- >
- <view
- :class="['date-val', { grey: !form.productionDate }]"
- @click="showDatePicker = true"
- >{{ form.productionDate ? form.productionDate : "请输入" }}</view
- >
- </u-form-item>
- <u-form-item
- label="上传图片"
- prop="img"
- borderBottom
- customStyle="padding: 30rpx 0"
- >
- <u-upload
- :fileList="fileList"
- @afterRead="afterRead"
- @delete="deletePic"
- name="file"
- width="120rpx"
- height="120rpx"
- :maxCount="2"
- >
- <u-image
- src="@/static/image/upload-img.png"
- width="120rpx"
- height="120rpx"
- ></u-image>
- </u-upload>
- </u-form-item>
- <u-form-item
- label="库位"
- prop="position"
- borderBottom
- customStyle="padding: 30rpx 0"
- >
- <u-input
- v-model="form.position"
- border="none"
- placeholder="请输入"
- ></u-input>
- </u-form-item>
- </u--form>
- </view>
- <u-datetime-picker
- :show="showDatePicker"
- @cancel="showDatePicker = false"
- @confirm="confirmDate"
- v-model="dateVal"
- mode="date"
- ></u-datetime-picker>
- <!-- 新增录入-->
- <view class="footer">
- <u-button class="add-btn" type="primary" plain @click="save">
- 保存
- </u-button>
- </view>
- </view>
- </template>
- <script>
- import { mapGetters } from "vuex";
- export default {
- data() {
- return {
- form: {
- materialName: "",
- barCode: "",
- productionDate: "",
- unit: "",
- },
- rules: {},
- showDatePicker: false,
- dateVal: "",
- fileList: [],
- };
- },
- computed: {
- ...mapGetters(["depotInfo"]),
- curDepotId() {
- return this.depotInfo ? this.depotInfo.id : "";
- },
- curDepotName() {
- return this.depotInfo ? this.depotInfo.depotName : "";
- },
- },
- onHide() {
- uni.$off("scanFinish");
- },
- onShow() {
- uni.$on("scanFinish", (data) => {
- this.form.barCode = data;
- });
- },
- methods: {
- scanCode() {
- this.$scan.scanCode();
- },
- confirmDate(e) {
- console.log("confirmDate====", e);
- const { value } = e;
- this.form.productionDate = this.$u.date(value, "yyyy-mm-dd");
- console.log("form====", this.form);
- this.showDatePicker = false;
- },
- deletePic(e) {
- console.log("deletePic====", e);
- this.fileList.splice(e.index, 1);
- },
- afterRead(e) {
- console.log("afterRead====", e);
- const { file } = e;
- this.fileList.push(file);
- },
- save() {},
- },
- };
- </script>
- <style lang="scss" scoped>
- .goods-page {
- min-height: 100vh;
- background-color: #f0f6fb;
- .container_main {
- margin: 24rpx;
- background-color: #fff;
- border-radius: 16rpx;
- padding: 24rpx;
- }
- }
- .footer {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- height: 144rpx;
- background-color: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- .add-btn {
- width: 700rpx;
- height: 88rpx;
- border-radius: 16rpx;
- font-size: 36rpx;
- font-weight: bold;
- color: #fff;
- background-color: #0256ff;
- line-height: 88rpx;
- text-align: center;
- }
- }
- .date-val {
- width: 100%;
- font-size: 28rpx;
- }
- .grey {
- color: #999;
- }
- </style>
|