| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864 |
- <template>
- <view>
- <view class="add_page">
- <u-navbar class="nav-bar" title="商品入库" :autoBack="true" :placeholder="true" v-hideNav>
- <view class="u-nav-slot" slot="right">
- <u-checkbox-group v-model="continuousWarehousing" placement="column">
- <u-checkbox label="连续入库" name="1"></u-checkbox>
- </u-checkbox-group>
- </view>
- </u-navbar>
- <view class="form_list">
- <u--form labelPosition="top" :model="formData" :rules="rules" ref="addForm" labelWidth="100%">
- <u-form-item borderBottom class="u-form-item-col">
- <u--textarea v-model="recognitionContent" placeholder='品牌:浪琴
- 来源:【麒麟】私信-杰3-3
- 实价:6500
- 型号:L2.257.5.89.7
- 编码:52356065
- 日期:2021-11-09
- 备注:全套
- 付款方式:微信/支付宝/银行卡/现金/数字货币/挂账' confirmType="done" height="170" :maxlength="-1">
- </u--textarea>
- <view class="btn_group_recognition">
- <u-button text="清除" @click="clearRecognitionContent()"></u-button>
- <u-button text="粘贴识别" type="primary"
- @click="handlePasteRecognition(recognitionContent)"></u-button>
- </view>
- </u-form-item>
- <u-form-item label="商品图片" required prop="goodPicFileList" borderBottom>
- <view class="imgs_scroll">
- <ImgsRowScroll v-if="formData.goodPicFileList.length > 0" :isShowDeleteIcon="true"
- @deleteImgInfo="getDeleteGoodPicInfo" imgMode="aspectFill" :totalWidth="400"
- :images="formData.goodPicFileList" :previewEnabled="true" :imageWidth="150"
- :imageHeight="150"></ImgsRowScroll>
- <u-upload @afterRead="afterReadGoodPic" name="3" multiple :maxCount="9"
- :previewFullImage="true"></u-upload>
- </view>
- </u-form-item>
- <u-form-item label="商品描述(详细的描述让用户更好的了解您的产品)" required prop="desc" borderBottom>
- <u--textarea v-model="formData.desc" clearable placeholder="95新 WHZ19219H CHANEL香奈儿链条单肩包
- 21开 牛皮 尺寸25 4 15
- 配件中溯卡" count autoHeight maxlength="250" :height="150" confirmType="done"></u--textarea>
- </u-form-item>
- <u-form-item label="来源" prop="origin" borderBottom>
- <u--textarea v-model="formData.origin" clearable placeholder="请输入来源" count autoHeight maxlength="250" height="100" confirmType="done"></u--textarea>
- </u-form-item>
- <u-form-item label="商品分类" required prop="type" borderBottom>
- <TabSelect :tabList="typeList" :isClear="typeIsClear" @tabChange="handleTabChangeType"
- labelKey="dictLabel" valueKey="dictValue" :colNum="4" mode="single" :echoInfo="echoInfoType">
- </TabSelect>
- </u-form-item>
- <u-form-item label="品牌" required prop="dictLabel" class="u-form-item-row" borderBottom
- @click="showBrandList">
- <Cell :val="formData.dictLabel"></Cell>
- <BrandList ref="brandListRef" @selectedBrand="handleSelectedBrand"></BrandList>
- </u-form-item>
- <u-form-item label="系列" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.series" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="型号" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.model" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="机芯类型" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.dialType" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="表壳材质" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.caseMaterial" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="表盘直径" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.dialDiameter" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="材质" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.material" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="尺寸" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.size" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="尺码" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.yardage" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="官方指导价" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.price" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="商品成色" required prop="productCondition" borderBottom>
- <TabSelect :tabList="productConditionList" :isClear="productConditionIsClear"
- @tabChange="handleTabChangeProductCondition" :colNum="2" mode="single" :echoInfo="echoInfoProductCondition">
- </TabSelect>
- </u-form-item>
- <u-form-item label="细节图" borderBottom>
- <!-- <view class="detail_pic_container"> -->
- <!-- <view>
- <text class="tip">视频:</text>
- <ImgsRowScroll v-if="formData.detailVideoFileList.length > 0" :isShowDeleteIcon="true"
- @deleteVideoInfo="getDeleteDetailVideoInfo" imgMode="aspectFill" :totalWidth="400"
- :videos="formData.detailVideoFileList" :previewEnabled="true" :imageWidth="150"
- :imageHeight="150" accept="video"></ImgsRowScroll>
- <u-upload @afterRead="afterReadDeatilVideo" name="2" multiple :maxCount="10" accept="video"></u-upload>
- </view> -->
- <!-- <view> -->
- <!-- <text class="tip">图片:</text> -->
- <view class="imgs_scroll">
- <ImgsRowScroll v-if="formData.detailPicFileList.length > 0" :isShowDeleteIcon="true"
- @deleteImgInfo="getDeleteDetailPicInfo" imgMode="aspectFill" :totalWidth="400"
- :images="formData.detailPicFileList" :previewEnabled="true" :imageWidth="150"
- :imageHeight="150"></ImgsRowScroll>
- <u-upload @afterRead="afterReadDetailPic" name="1" multiple :maxCount="10"></u-upload>
- </view>
- <!-- </view> -->
- <!-- </view> -->
- </u-form-item>
- <u-form-item label="商品标题" borderBottom>
- <u--textarea v-model="formData.title" clearable :placeholder="titlePlaceholder" count autoHeight
- maxlength="50" height="100" confirmType="done"></u--textarea>
- </u-form-item>
- <u-form-item label="商品货号" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.productNo" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="商品属性" required prop="productAttribute" borderBottom>
- <TabSelect :tabList="productAttributeList" :colNum="4" mode="single"
- :isClear="productAttributeIsClear" @tabChange="handleTabChangeProductAttribute"
- :echoInfo="echoInfoProductAttribute">
- </TabSelect>
- </u-form-item>
- <u-form-item label="库存数量" required prop="stock" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.stock" placeholder="请输入" clearable border="none"
- type="number"></u--input>
- </u-form-item>
- <u-form-item label="总成本价" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.costPrice" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="同行价格" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.peerPrice" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="代理价格" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.agentPrice" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="销售价格" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.salePrice" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="商品位置" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.productPosition" placeholder="请输入" clearable
- border="none"></u--input>
- </u-form-item>
- <u-form-item label="手表年份" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.watchYear" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="鉴定人员" class="u-form-item-row" borderBottom @click="identifyingPersonClick">
- <Cell :val="formData.identifyingPerson" :isDelete="true"
- @handleClear="clear('identifyingPerson')"></Cell>
- <PersonPicker ref="identifyingPersonPickerRef" title="请选择鉴定人员"
- @selectPerson="handleSelectIdentifyingPerson"></PersonPicker>
- </u-form-item>
- <u-form-item label="是否入库" borderBottom required prop="stockStatus">
- <TabSelect :tabList="stockStatusList" :colNum="2" mode="single" :isClear="stockStatusIsClear" :echoInfo="echoInfoStockStatus"
- @tabChange="handleTabChangeStockStatus"></TabSelect>
- </u-form-item>
- <u-form-item label="回收类型" borderBottom>
- <TabSelect :tabList="recycleTypeList" :colNum="4" mode="single" :isClear="recycleTypeIsClear"
- @tabChange="handleTabChangeRecycleType">
- </TabSelect>
- </u-form-item>
- <u-form-item label="标签" borderBottom>
- <TabSelect :tabList="labelList" :colNum="5" mode="single" :isClear="labelIsClear"
- @tabChange="handleTabChangeLabel">
- </TabSelect>
- </u-form-item>
- <u-form-item label="回收人员" class="u-form-item-row" borderBottom @click="recyclePersonClick">
- <!-- <u--input v-model="formData.recyclePerson" disabledColor="#fff" disabled clearable
- border="none"></u--input> -->
- <Cell :val="formData.recyclePerson" :isDelete="true" @handleClear="clear('recyclePerson')">
- </Cell>
- <PersonPicker ref="recyclePersonPickerRef" title="请选择回收人员"
- @selectPerson="handleSelectRecyclePerson"></PersonPicker>
- </u-form-item>
- <u-form-item label="回收留底图" borderBottom>
- <view class="recycle_bottom_desc">
- <u--textarea v-model="formData.recycleBottomDesc" clearable count autoHeight maxlength="250"
- height="100" confirmType="done"></u--textarea>
- <view class="imgs_scroll">
- <ImgsRowScroll v-if="formData.recycleBottomFileList.length > 0" :isShowDeleteIcon="true"
- @deleteImgInfo="getDeleteRecycleBottomPicInfo" imgMode="aspectFill"
- :totalWidth="400" :images="formData.recycleBottomFileList" :previewEnabled="true"
- :imageWidth="150" :imageHeight="150"></ImgsRowScroll>
- <u-upload @afterRead="afterReadRecycleBottom" name="1" multiple :maxCount="1"
- accept="image"></u-upload>
- </view>
- </view>
- </u-form-item>
- <u-form-item label="回收时间" required prop="recycleTime" class="u-form-item-row" borderBottom
- @click="clickRecycleTimeRow">
- <Cell :val="formData.recycleTime"></Cell>
- <u-datetime-picker @confirm="confirmRecycleTime" @close="closeRecycleTimePicker"
- @cancel="closeRecycleTimePicker" :show="recycleTimeShow" v-model="formData.recycleTime"
- mode="date"></u-datetime-picker>
- </u-form-item>
- <u-form-item label="独立编码" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.indentifyCode" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="适用人群" class="u-form-item-row" borderBottom>
- <u-radio-group v-model="formData.targetAudience" placement="row">
- <u-radio activeColor="#3c9cff" name="general" label="通用"></u-radio>
- <u-radio activeColor="#3c9cff" name="man" label="男"></u-radio>
- <u-radio activeColor="#3c9cff" name="woman" label="女"></u-radio>
- </u-radio-group>
- </u-form-item>
- <u-form-item label="商品保卡" class="u-form-item-row" borderBottom>
- <u-radio-group v-model="formData.productCard" placement="row">
- <u-radio activeColor="#3c9cff" name="has" label="有保卡"></u-radio>
- <u-radio activeColor="#3c9cff" name="no" label="无保卡"></u-radio>
- </u-radio-group>
- </u-form-item>
- <u-form-item label="保卡年份" class="u-form-item-row" borderBottom
- v-if="formData.productCard === 'has'">
- <u--input v-model="formData.cardYear" placeholder="不填写默认空白保卡" clearable
- border="none"></u--input>
- </u-form-item>
- <u-form-item label="保卡图片或独立编码照片留底(仅内部人员可见)" borderBottom>
- <view class="imgs_scroll">
- <ImgsRowScroll v-if="formData.productCardPicFileList.length > 0" :isShowDeleteIcon="true"
- @deleteImgInfo="getDeleteProductCardPicInfo" imgMode="aspectFill" :totalWidth="400"
- :images="formData.productCardPicFileList" :previewEnabled="true" :imageWidth="150"
- :imageHeight="150"></ImgsRowScroll>
- <u-upload @afterRead="afterReadProductCardPic" name="3" multiple :maxCount="9"
- :previewFullImage="true"></u-upload>
- </view>
- </u-form-item>
- <u-form-item label="商品标签" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.productTag" placeholder="请输入" clearable border="none"></u--input>
- </u-form-item>
- <u-form-item label="商品附件" class="u-form-item-row" borderBottom>
- <u--input v-model="formData.productAttachment" placeholder="请输入" clearable
- border="none"></u--input>
- </u-form-item>
- <u-form-item label="备注(仅内部人员可见)" borderBottom>
- <view class="recycle_bottom_desc">
- <u--textarea v-model="formData.productDesc" clearable count autoHeight maxlength="250"
- height="100" confirmType="done"></u--textarea>
- <view class="imgs_scroll">
- <ImgsRowScroll v-if="formData.productDescPicFileList.length > 0"
- :isShowDeleteIcon="true" @deleteImgInfo="getDeleteProductDescPicInfo"
- imgMode="aspectFill" :totalWidth="400" :images="formData.productDescPicFileList"
- :previewEnabled="true" :imageWidth="150" :imageHeight="150"></ImgsRowScroll>
- <u-upload @afterRead="afterReadProductDescPic" name="1" multiple :maxCount="1"
- accept="image"></u-upload>
- </view>
- </view>
- </u-form-item>
- <u-form-item label="付款方式">
- <TabSelect :tabList="paymentTabList" :echoInfo="payTypeEcho" :colNum="4" mode="single"
- :isClear="payTypeIsClear" @tabChange="handlePayTypeTabChange">
- </TabSelect>
- </u-form-item>
- </u--form>
- </view>
- </view>
- <view :class="['btn_group', {'col-2': formData.stockStatus == '1'}]">
- <u-button plain type="primary" @click="submitForm('onlyIn')">保存</u-button>
- <u-button type="primary" @click="submitForm('inAndUp')" v-if="formData.stockStatus == '1'">入库并上架</u-button>
- </view>
- </view>
- </template>
- <script>
- import TabSelect from '@/components/custom-tab-select/index.vue'
- import Cell from '@/components/custom-cell/index.vue'
- import BrandList from '@/components/brand-list/index.vue'
- import ImgsRowScroll from '@/components/imgs-row-scroll/index.vue'
- import PersonPicker from '@/components/person-picker/index.vue'
- export default {
- components: {
- TabSelect,
- Cell,
- BrandList,
- ImgsRowScroll,
- PersonPicker
- },
- data() {
- return {
- checkboxValue: [''],
- recognitionContent: '',
- formData: {
- goodPicFileList: [],//商品图片
- desc: '',
- origin: '',
- type: '1',
- dictLabel: '艾美',
- dictValue: '88',
- series: '',
- model: '',
- dialType: '',
- caseMaterial: '',
- dialDiameter: '',
- material: '',
- size: '',
- yardage: '',
- price: '',
- productCondition: '1',
- detailPicFileList: [],//细节图片
- // detailVideoFileList:[],
- title:'',
- productNo: '',
- productAttribute: '1',
- stock: 1,
- costPrice: '',
- samePrice: '',
- agentPrice: '',
- salePrice: '',
- productPosition: '',
- watchYear: '',
- identifyingPerson: '',
- identifyingPersonId: '',
- stockStatus: '0',
- recycleType: '',
- recyclePerson: '',
- recyclePersonId: '',
- recycleBottomDesc: '',
- recycleBottomFileList: [],//回收留底图
- recycleTime: this.$dayjs().format('YYYY-MM-DD'),
- indentifyCode: '',
- targetAudience: '',
- productCard: '',
- cardYear: '',
- productCardPicFileList: [],//商品保卡图片或独立编码照片留底
- productTag: '',
- productAttachment: '',
- productDesc: '',
- productDescPicFileList: [],//商品备注图片
- payType: '',
- },
- continuousWarehousing: [],//是否连续入库 1:是 0:否
- rules: {
- goodPicFileList: [
- { required: true, message: '请上传商品图片' },
- ],
- desc: [
- { required: true, message: '请输入商品描述', trigger: ['blur', 'change'] },
- ],
- type: [
- { required: true, message: '请选择商品分类', trigger: ['blur', 'change'] },
- ],
- dictLabel: [
- { required: true, message: '请选择品牌', trigger: ['blur', 'change'] },
- ],
- productCondition: [
- { required: true, message: '请选择商品成色', trigger: ['blur', 'change'] },
- ],
- productAttribute: [
- { required: true, message: '请选择商品属性', trigger: ['blur', 'change'] },
- ],
- stock: [
- { required: true, message: '请输入库存数量' },
- ],
- stockStatus: [
- { required: true, message: '请选择是否入库', trigger: [ 'change'] },
- ],
- recycleTime: [
- { required: true, message: '请选择回收时间', trigger: ['blur', 'change'] },
- ],
- },
- recycleTimeShow: false,
- titlePlaceholder: '如不填,自动截取商品描述前50字',
- typeList: [],
- productConditionList: [
- {
- name: '闲置未使用',
- value: '1',
- },
- {
- name: '二手',
- value: '2',
- },
- ],
- productAttributeList: [
- {
- name: '自有商品',
- value: '1',
- },
- {
- name: '寄卖商品',
- value: '2',
- },
- {
- name: '质押商品',
- value: '3',
- },
- {
- name: '其它',
- value: '4',
- },
- ],
- stockStatusList: [
- {
- name: '待入库',
- value: '0',
- },
- {
- name: '已入库',
- value: '1',
- },
- ],
- recycleTypeList: [
- {
- name: '线上',
- value: '1',
- },
- {
- name: '同行',
- value: '2',
- },
- {
- name: '门店',
- value: '3',
- },
- {
- name: '其它',
- value: '4',
- },
- ],
- labelList: [
- {
- name: '完美',
- value: '1',
- },
- {
- name: '普通',
- value: '2',
- },
- {
- name: '瑕疵',
- value: '3',
- },
- {
- name: '假货',
- value: '4',
- },
- {
- name: '亏损',
- value: '5',
- },
- ],
- paymentTabList: [
- {
- name: '微信',
- value: 1,
- },
- {
- name: '支付宝',
- value: 2,
- },
- {
- name: '银行卡',
- value: 3,
- },
- {
- name: '现金',
- value: 4,
- },
- {
- name: '数字货币',
- value: 5,
- },
- {
- name: '挂账',
- value: 6,
- },
- ],
- typeIsClear: false,//商品分类是否清空
- productConditionIsClear: false,//商品成色是否清空
- productAttributeIsClear: false,//商品属性是否清空
- recycleTypeIsClear: false,//回收类型是否清空
- stockStatusIsClear: false,//是否入库是否清空
- labelIsClear: false,//商品标签是否清空
- payTypeIsClear: false,//付款方式是否清空
- payTypeEcho: '',//付款方式识别回显
- echoInfoType:'',//入库回显的时候 类型回显
- echoInfoProductAttribute:'',//入库回显的时候 商品属性回显
- echoInfoProductCondition:'',//入库回显的时候 商品成色回显
- echoInfoStockStatus:'',//入库回显的时候 是否入库回显
- }
- },
- onLoad(options) {
- this.getTypeList();
- this.$nextTick(async()=>{
- if(options.formType == 'add'){
- this.clearForm()
- }else if(options.formType == 'edit'){
- const res = await uni.$u.api.wareHouseDetail({
- id: options.id,
- userId: this.$store.state.user.userInfo.userId,
- })
- this.formData = res.data
- this.formData.recycleTime = this.$dayjs(res.data.recycleTime).format('YYYY-MM-DD') || ''
- this.echoInfoType = res.data.type || '1'
- this.formData.type = res.data.type || '1'
- this.echoInfoProductAttribute = res.data.productAttribute || '1'
- this.formData.productAttribute = res.data.productAttribute || '1'
- this.echoInfoProductCondition = res.data.productCondition || '1'
- this.formData.productCondition = res.data.productCondition || '1'
- this.echoInfoStockStatus = res.data.stockStatus || '0'
- this.formData.stockStatus = res.data.stockStatus || '0'
- this.formData.stock = res.data.stock ? res.data.stock : 1
-
- }
- })
- },
- methods: {
- getTypeList() {
- this.$getDicts("crm_form_category").then(res => {
- this.typeList = res
- })
- },
- // 提交表单
- submitForm(submitType) {
- this.$refs.addForm.validate().then((valid) => {
- if (valid) {
- if (this.formData.title == '') {
- this.formData.title = this.formData.desc.substring(0, 50);
- }
- this.formData.recycleTime = this.$dayjs(this.formData.recycleTime).format('YYYY-MM-DD')
- const data = {
- ...this.formData,
- submitType: submitType, //提交类型 onlyIn:仅入库/暂存入库 inAndUp:入库并上架
- continuousWarehousing: this.continuousWarehousing[0] || '0',//是否连续入库 1:是 0:否
- }
- uni.$u.api.wareHouseAdd(data).then(res => {
- uni.$u.toast('操作成功');
- if (data.continuousWarehousing == '0') {
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- });
- }, 1000);
- } else {
- this.clearForm();
- }
- }).catch(err => {
- uni.$u.toast(err);
- })
- } else {
- console.log('表单校验不通过');
- }
- });
- },
- clearForm() {
- this.formData = {
- goodPicFileList: [],//商品图片
- desc: '',
- origin: '',
- type: '1',
- dictLabel: '艾美',
- dictValue: '88',
- series: '',
- model: '',
- dialType: '',
- caseMaterial: '',
- dialDiameter: '',
- material: '',
- size: '',
- yardage: '',
- price: '',
- productCondition: '1',
- detailPicFileList: [],//细节图片
- // detailVideoFileList:[],
- productNo: '',
- productAttribute: '1',
- stock: 1,
- costPrice: '',
- samePrice: '',
- agentPrice: '',
- salePrice: '',
- productPosition: '',
- watchYear: '',
- identifyingPerson: '',
- identifyingPersonId: '',
- stockStatus: '0',
- recycleType: '',
- label: '',
- recyclePerson: '',
- recyclePersonId: '',
- recycleBottomDesc: '',
- recycleBottomFileList: [],//回收留底图
- recycleTime: this.$dayjs().format('YYYY-MM-DD'),
- indentifyCode: '',
- targetAudience: '',
- productCard: '',
- cardYear: '',
- productCardPicFileList: [],//商品保卡图片或独立编码照片留底
- productTag: '',
- productAttachment: '',
- productDesc: '',
- productDescPicFileList: [],//商品备注图片
- payType: '',
- }
- this.recycleTypeIsClear = true;
- this.payTypeIsClear = true;
- this.labelIsClear = true;
- this.echoInfoType = '1';//类型默认第一项
- this.echoInfoProductCondition = '1';//商品成色默认第一项
- this.echoInfoProductAttribute = '1';//商品属性默认第一项
- this.echoInfoStockStatus = '0';//是否入库默认第一项
- this.continuousWarehousing = [];
- this.$nextTick(()=>{
- this.$refs.addForm.resetFields();
- })
- },
- // 选择品牌
- handleSelectedBrand(info) {
- this.formData.dictLabel = info.dictLabel;
- this.formData.dictValue = info.dictValue;
- this.$refs.addForm.validateField('dictLabel');
- },
- // 显示品牌列表
- showBrandList() {
- this.$refs.brandListRef.showBrandList();
- },
- // 清空输入框
- clear(key) {
- // 品牌
- if (key == 'dictLabel') {
- this.formData.dictLabel = '';
- this.formData.dictValue = '';
- return;
- }
- // 鉴定人
- if (key == 'identifyingPerson') {
- this.formData.identifyingPerson = '';
- this.formData.identifyingPersonId = '';
- return;
- }
- // 回收人
- if (key == 'recyclePerson') {
- this.formData.recyclePerson = '';
- this.formData.recyclePersonId = '';
- return;
- }
- this.formData[key] = '';
- },
- // 商品分类
- handleTabChangeType(e) {
- this.formData.type = e;
- this.$refs.addForm.validateField('type')
- },
- // 商品成色
- handleTabChangeProductCondition(e) {
- this.formData.productCondition = e;
- this.$refs.addForm.validateField('productCondition')
- },
- // 商品属性
- handleTabChangeProductAttribute(e) {
- this.formData.productAttribute = e;
- this.$refs.addForm.validateField('productAttribute')
- },
- // 是否入库
- handleTabChangeStockStatus(e) {
- this.formData.stockStatus = e;
- },
- // 回收类型
- handleTabChangeRecycleType(e) {
- this.formData.recycleType = e;
- },
- // 商品标签
- handleTabChangeLabel(e) {
- this.formData.label = e;
- },
- // 付款方式
- handlePayTypeTabChange(e) {
- this.formData.payType = e;
- },
- // 打开回收时间选择器
- clickRecycleTimeRow() {
- this.recycleTimeShow = true;
- },
- // 确认回收时间
- confirmRecycleTime(val) {
- this.$nextTick(() => {
- this.formData.recycleTime = this.$dayjs(val.value).format('YYYY-MM-DD');
- this.recycleTimeShow = false;
- })
- },
- // 关闭回收时间选择器
- closeRecycleTimePicker(val) {
- this.recycleTimeShow = false;
- },
- // 打开鉴定人选择器
- identifyingPersonClick() {
- this.$refs.identifyingPersonPickerRef.open();
- },
- // 选择鉴定人
- handleSelectIdentifyingPerson(info) {
- this.formData.identifyingPerson = info.label;
- this.formData.identifyingPersonId = info.id;
- },
- // 打开回收人选择器
- recyclePersonClick() {
- this.$refs.recyclePersonPickerRef.open();
- },
- // 选择回收人
- handleSelectRecyclePerson(info) {
- this.formData.recyclePerson = info.label;
- this.formData.recyclePersonId = info.id;
- },
- // 新增商品图片
- async afterReadGoodPic(event) {
- event.file.forEach(item => {
- uni.$u.api.uploadFile(item.url).then((res) => {
- this.formData.goodPicFileList.push(res.data.url);
- uni.$u.toast("文件上传成功");
- }).catch(() => {
- uni.$u.toast("上传文件失败");
- })
- })
- },
- // 获取删除商品图片信息
- getDeleteGoodPicInfo(info) {
- this.formData.goodPicFileList = info.newImages
- },
- // 获取删除细节图片信息
- getDeleteDetailPicInfo(info) {
- this.formData.detailPicFileList = info.newImages
- },
- // 新增细节图片
- async afterReadDetailPic(event) {
- event.file.forEach(item => {
- uni.$u.api.uploadFile(item.url).then((res) => {
- this.formData.detailPicFileList.push(res.data.url);
- uni.$u.toast("文件上传成功");
- }).catch(() => {
- uni.$u.toast("上传文件失败");
- })
- })
- },
- // 获取删除回收留底图信息
- getDeleteRecycleBottomPicInfo(info) {
- this.formData.recycleBottomFileList = info.newImages
- },
- // 新增回收留底图
- async afterReadRecycleBottom(event) {
- event.file.forEach(item => {
- uni.$u.api.uploadFile(item.url).then((res) => {
- this.formData.recycleBottomFileList.push(res.data.url);
- uni.$u.toast("文件上传成功");
- }).catch(() => {
- uni.$u.toast("上传文件失败");
- })
- })
- },
- // 删除商品保卡图片或独立编码照片留底
- getDeleteProductCardPicInfo(info) {
- this.formData.productCardPicFileList = info.newImages
- },
- // 新增商品保卡图片或独立编码照片留底
- async afterReadProductCardPic(event) {
- event.file.forEach(item => {
- uni.$u.api.uploadFile(item.url).then((res) => {
- this.formData.productCardPicFileList.push(res.data.url);
- uni.$u.toast("文件上传成功");
- }).catch(() => {
- uni.$u.toast("上传文件失败");
- })
- })
- },
- // 获取删除商品备注图片信息
- getDeleteProductDescPicInfo(info) {
- this.formData.productDescPicFileList = info.newImages
- },
- // 新增商品备注图片
- async afterReadProductDescPic(event) {
- event.file.forEach(item => {
- uni.$u.api.uploadFile(item.url).then((res) => {
- this.formData.productDescPicFileList.push(res.data.url);
- uni.$u.toast("文件上传成功");
- }).catch(() => {
- uni.$u.toast("上传文件失败");
- })
- })
- },
- async handlePasteRecognition(text) {
- // 品牌:浪琴
- // 来源:【麒麟】私信-杰3-3
- // 实价:6500
- // 型号:L2.257.5.89.7
- // 编码:52356065
- // 日期:2021-11-09
- // 备注:全套
- // 付款方式:微信
- if (!text) {
- return;
- }
- try {
- if (!text) return {};
- const result = {};
- // 支持中文冒号和英文冒号
- const lines = text.split(/[\n\r]+/);
- lines.forEach(line => {
- const lineStr = line.trim();
- if (!lineStr) return;
- // 尝试中文冒号
- let separatorIndex = lineStr.indexOf(':');
- // 如果没有中文冒号,尝试英文冒号
- if (separatorIndex === -1) {
- separatorIndex = lineStr.indexOf(':');
- }
- if (separatorIndex > 0) {
- const key = lineStr.substring(0, separatorIndex).trim();
- const value = lineStr.substring(separatorIndex + 1).trim();
- result[key] = value;
- }
- });
- if (result['品牌']) {
- this.formData.dictLabel = result['品牌'];
- }
- if (result['来源']) {
- this.formData.origin = result['来源'];
- }
- if (result['实价']) {
- this.formData.costPrice = result['实价'];
- }
- if (result['型号']) {
- this.formData.model = result['型号'];
- }
- if (result['编码']) {
- this.formData.indentifyCode = result['编码'];
- }
- if (result['日期']) {
- this.formData.recycleTime = result['日期'];
- }
- if (result['备注']) {
- this.formData.productDesc = result['备注'];
- }
- if (result['付款方式']) {
- this.getPaymentType(result['付款方式'])
- this.formData.payType = result['付款方式'];
- }
- // return result;
- } catch (e) {
- uni.$u.toast("文本识别异常");
- }
- },
- // 清空识别内容
- clearRecognitionContent() {
- this.recognitionContent = '';
- },
- // 识别内容 回显付款方式
- getPaymentType(val) {
- let arr = []
- this.paymentTabList.filter(item => {
- if (item.name == val) arr.push(item.value)
- })
- if (arr.length > 0) {
- this.payTypeEcho = arr[0]
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '../styles/edit.scss';
- </style>
|