edit.vue 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  1. <template>
  2. <view>
  3. <view class="add_page">
  4. <u-navbar class="nav-bar" title="商品入库" :autoBack="true" :placeholder="true" v-hideNav>
  5. <view class="u-nav-slot" slot="right">
  6. <u-checkbox-group v-model="continuousWarehousing" placement="column">
  7. <u-checkbox label="连续入库" name="1"></u-checkbox>
  8. </u-checkbox-group>
  9. </view>
  10. </u-navbar>
  11. <view class="form_list">
  12. <u--form labelPosition="top" :model="formData" :rules="rules" ref="addForm" labelWidth="100%">
  13. <u-form-item borderBottom class="u-form-item-col">
  14. <u--textarea v-model="recognitionContent" placeholder='品牌:-
  15. 来源:-
  16. 实价:-
  17. 型号:-
  18. 编码:-
  19. 日期:-
  20. 备注:-
  21. 付款方式:-' confirmType="done" height="170" :maxlength="-1">
  22. </u--textarea>
  23. <view class="btn_group_recognition">
  24. <u-button text="清除" @click="clearRecognitionContent()"></u-button>
  25. <u-button text="粘贴识别" type="primary"
  26. @click="handlePasteRecognition(recognitionContent)"></u-button>
  27. </view>
  28. </u-form-item>
  29. <u-form-item label="商品图片" required prop="goodPicFileList" borderBottom>
  30. <view class="imgs_scroll">
  31. <ImgsRowScroll v-if="formData.goodPicFileList.length > 0" :isShowDeleteIcon="true"
  32. @deleteImgInfo="getDeleteGoodPicInfo" imgMode="aspectFill" :totalWidth="400"
  33. :images="formData.goodPicFileList" :previewEnabled="true" :imageWidth="150"
  34. :imageHeight="150"></ImgsRowScroll>
  35. <u-upload @afterRead="afterReadGoodPic" name="3" multiple :maxCount="9"
  36. :previewFullImage="true"></u-upload>
  37. </view>
  38. </u-form-item>
  39. <u-form-item label="商品描述(详细的描述让用户更好的了解您的产品)" required prop="desc" borderBottom>
  40. <u--textarea v-model="formData.desc" clearable placeholder="95新 WHZ19219H CHANEL香奈儿链条单肩包
  41. 21开 牛皮 尺寸25 4 15
  42. 配件中溯卡" count autoHeight maxlength="250" :height="150" confirmType="done"></u--textarea>
  43. </u-form-item>
  44. <u-form-item label="来源" prop="origin" borderBottom>
  45. <u--textarea v-model="formData.origin" clearable placeholder="请输入来源" count autoHeight maxlength="250" height="100" confirmType="done"></u--textarea>
  46. </u-form-item>
  47. <u-form-item label="商品分类" required prop="type" borderBottom>
  48. <TabSelect :tabList="typeList" :isClear="typeIsClear" @tabChange="handleTabChangeType"
  49. labelKey="dictLabel" valueKey="dictValue" :colNum="4" mode="single" :echoInfo="echoInfoType">
  50. </TabSelect>
  51. </u-form-item>
  52. <u-form-item label="品牌" required prop="dictLabel" class="u-form-item-row" borderBottom
  53. @click="showBrandList">
  54. <Cell :val="formData.dictLabel"></Cell>
  55. <BrandList ref="brandListRef" @selectedBrand="handleSelectedBrand"></BrandList>
  56. </u-form-item>
  57. <u-form-item label="系列" class="u-form-item-row" borderBottom>
  58. <u--input v-model="formData.series" placeholder="请输入" clearable border="none"></u--input>
  59. </u-form-item>
  60. <u-form-item label="型号" class="u-form-item-row" borderBottom>
  61. <u--input v-model="formData.model" placeholder="请输入" clearable border="none"></u--input>
  62. </u-form-item>
  63. <u-form-item label="机芯类型" class="u-form-item-row" borderBottom>
  64. <u--input v-model="formData.dialType" placeholder="请输入" clearable border="none"></u--input>
  65. </u-form-item>
  66. <u-form-item label="表壳材质" class="u-form-item-row" borderBottom>
  67. <u--input v-model="formData.caseMaterial" placeholder="请输入" clearable border="none"></u--input>
  68. </u-form-item>
  69. <u-form-item label="表盘直径" class="u-form-item-row" borderBottom>
  70. <u--input v-model="formData.dialDiameter" placeholder="请输入" clearable border="none"></u--input>
  71. </u-form-item>
  72. <u-form-item label="材质" class="u-form-item-row" borderBottom>
  73. <u--input v-model="formData.material" placeholder="请输入" clearable border="none"></u--input>
  74. </u-form-item>
  75. <u-form-item label="尺寸" class="u-form-item-row" borderBottom>
  76. <u--input v-model="formData.size" placeholder="请输入" clearable border="none"></u--input>
  77. </u-form-item>
  78. <u-form-item label="尺码" class="u-form-item-row" borderBottom>
  79. <u--input v-model="formData.yardage" placeholder="请输入" clearable border="none"></u--input>
  80. </u-form-item>
  81. <u-form-item label="官方指导价" class="u-form-item-row" borderBottom>
  82. <u--input v-model="formData.price" placeholder="请输入" clearable border="none"></u--input>
  83. </u-form-item>
  84. <u-form-item label="商品成色" required prop="productCondition" borderBottom>
  85. <TabSelect :tabList="productConditionList" :isClear="productConditionIsClear"
  86. @tabChange="handleTabChangeProductCondition" :colNum="2" mode="single" :echoInfo="echoInfoProductCondition">
  87. </TabSelect>
  88. </u-form-item>
  89. <u-form-item label="细节图" borderBottom>
  90. <!-- <view class="detail_pic_container"> -->
  91. <!-- <view>
  92. <text class="tip">视频:</text>
  93. <ImgsRowScroll v-if="formData.detailVideoFileList.length > 0" :isShowDeleteIcon="true"
  94. @deleteVideoInfo="getDeleteDetailVideoInfo" imgMode="aspectFill" :totalWidth="400"
  95. :videos="formData.detailVideoFileList" :previewEnabled="true" :imageWidth="150"
  96. :imageHeight="150" accept="video"></ImgsRowScroll>
  97. <u-upload @afterRead="afterReadDeatilVideo" name="2" multiple :maxCount="10" accept="video"></u-upload>
  98. </view> -->
  99. <!-- <view> -->
  100. <!-- <text class="tip">图片:</text> -->
  101. <view class="imgs_scroll">
  102. <ImgsRowScroll v-if="formData.detailPicFileList.length > 0" :isShowDeleteIcon="true"
  103. @deleteImgInfo="getDeleteDetailPicInfo" imgMode="aspectFill" :totalWidth="400"
  104. :images="formData.detailPicFileList" :previewEnabled="true" :imageWidth="150"
  105. :imageHeight="150"></ImgsRowScroll>
  106. <u-upload @afterRead="afterReadDetailPic" name="1" multiple :maxCount="10"></u-upload>
  107. </view>
  108. <!-- </view> -->
  109. <!-- </view> -->
  110. </u-form-item>
  111. <u-form-item label="商品标题" borderBottom>
  112. <u--textarea v-model="formData.title" clearable :placeholder="titlePlaceholder" count autoHeight
  113. maxlength="50" height="100" confirmType="done"></u--textarea>
  114. </u-form-item>
  115. <u-form-item label="商品货号" class="u-form-item-row" borderBottom>
  116. <u--input v-model="formData.productNo" placeholder="请输入" clearable border="none"></u--input>
  117. </u-form-item>
  118. <u-form-item label="商品属性" required prop="productAttribute" borderBottom>
  119. <TabSelect :tabList="productAttributeList" :colNum="4" mode="single"
  120. :isClear="productAttributeIsClear" @tabChange="handleTabChangeProductAttribute"
  121. :echoInfo="echoInfoProductAttribute">
  122. </TabSelect>
  123. </u-form-item>
  124. <u-form-item label="库存数量" required prop="stock" class="u-form-item-row" borderBottom>
  125. <u--input v-model="formData.stock" placeholder="请输入" clearable border="none"
  126. type="number"></u--input>
  127. </u-form-item>
  128. <u-form-item label="总成本价" class="u-form-item-row" borderBottom v-if="isWareHouser">
  129. <u--input v-model="formData.costPrice" placeholder="请输入" clearable border="none"></u--input>
  130. </u-form-item>
  131. <u-form-item label="同行价格" class="u-form-item-row" borderBottom v-if="isWareHouser">
  132. <u--input v-model="formData.peerPrice" placeholder="请输入" clearable border="none"></u--input>
  133. </u-form-item>
  134. <u-form-item label="代理价格" class="u-form-item-row" borderBottom>
  135. <u--input v-model="formData.agentPrice" placeholder="请输入" clearable border="none"></u--input>
  136. </u-form-item>
  137. <u-form-item label="销售价格" class="u-form-item-row" borderBottom v-if="isWareHouser">
  138. <u--input v-model="formData.salePrice" placeholder="请输入" clearable border="none"></u--input>
  139. </u-form-item>
  140. <u-form-item label="商品位置" class="u-form-item-row" borderBottom>
  141. <u--input v-model="formData.productPosition" placeholder="请输入" clearable
  142. border="none"></u--input>
  143. </u-form-item>
  144. <u-form-item label="手表年份" class="u-form-item-row" borderBottom>
  145. <u--input v-model="formData.watchYear" placeholder="请输入" clearable border="none"></u--input>
  146. </u-form-item>
  147. <u-form-item label="鉴定人员" class="u-form-item-row" borderBottom @click="identifyingPersonClick">
  148. <Cell :val="formData.identifyingPerson" :isDelete="true"
  149. @handleClear="clear('identifyingPerson')"></Cell>
  150. <PersonPicker ref="identifyingPersonPickerRef" title="请选择鉴定人员"
  151. @selectPerson="handleSelectIdentifyingPerson"></PersonPicker>
  152. </u-form-item>
  153. <u-form-item label="是否入库" borderBottom required prop="stockStatus">
  154. <TabSelect :tabList="stockStatusList" :colNum="2" mode="single" :isClear="stockStatusIsClear" :echoInfo="echoInfoStockStatus"
  155. @tabChange="handleTabChangeStockStatus"></TabSelect>
  156. </u-form-item>
  157. <u-form-item label="回收类型" borderBottom>
  158. <TabSelect :tabList="recycleTypeList" :colNum="4" mode="single" :isClear="recycleTypeIsClear" :echoInfo="echoInfoRecycleType"
  159. @tabChange="handleTabChangeRecycleType">
  160. </TabSelect>
  161. </u-form-item>
  162. <u-form-item label="标签" borderBottom>
  163. <TabSelect :tabList="labelList" :colNum="5" mode="single" :isClear="labelIsClear" :echoInfo="echoInfoLabel"
  164. @tabChange="handleTabChangeLabel">
  165. </TabSelect>
  166. </u-form-item>
  167. <u-form-item label="回收人员" class="u-form-item-row" borderBottom @click="recyclePersonClick">
  168. <!-- <u--input v-model="formData.recyclePerson" disabledColor="#fff" disabled clearable
  169. border="none"></u--input> -->
  170. <Cell :val="formData.recyclePerson" :isDelete="true" @handleClear="clear('recyclePerson')">
  171. </Cell>
  172. <PersonPicker ref="recyclePersonPickerRef" title="请选择回收人员"
  173. @selectPerson="handleSelectRecyclePerson"></PersonPicker>
  174. </u-form-item>
  175. <u-form-item label="回收留底图" borderBottom>
  176. <view class="recycle_bottom_desc">
  177. <u--textarea v-model="formData.recycleBottomDesc" clearable count autoHeight maxlength="250"
  178. height="100" confirmType="done"></u--textarea>
  179. <view class="imgs_scroll">
  180. <ImgsRowScroll v-if="formData.recycleBottomFileList.length > 0" :isShowDeleteIcon="true"
  181. @deleteImgInfo="getDeleteRecycleBottomPicInfo" imgMode="aspectFill"
  182. :totalWidth="400" :images="formData.recycleBottomFileList" :previewEnabled="true"
  183. :imageWidth="150" :imageHeight="150"></ImgsRowScroll>
  184. <u-upload @afterRead="afterReadRecycleBottom" name="1" multiple :maxCount="1"
  185. accept="image"></u-upload>
  186. </view>
  187. </view>
  188. </u-form-item>
  189. <u-form-item label="回收时间" required prop="recycleTime" class="u-form-item-row" borderBottom
  190. @click="clickRecycleTimeRow">
  191. <Cell :val="formData.recycleTime"></Cell>
  192. <u-datetime-picker @confirm="confirmRecycleTime" @close="closeRecycleTimePicker"
  193. @cancel="closeRecycleTimePicker" :show="recycleTimeShow" v-model="formData.recycleTime"
  194. mode="date"></u-datetime-picker>
  195. </u-form-item>
  196. <u-form-item label="独立编码" class="u-form-item-row" borderBottom>
  197. <u--input v-model="formData.indentifyCode" placeholder="请输入" clearable border="none"></u--input>
  198. </u-form-item>
  199. <u-form-item label="适用人群" class="u-form-item-row" borderBottom>
  200. <u-radio-group v-model="formData.targetAudience" placement="row">
  201. <u-radio activeColor="#3c9cff" name="general" label="通用"></u-radio>
  202. <u-radio activeColor="#3c9cff" name="man" label="男"></u-radio>
  203. <u-radio activeColor="#3c9cff" name="woman" label="女"></u-radio>
  204. </u-radio-group>
  205. </u-form-item>
  206. <u-form-item label="商品保卡" class="u-form-item-row" borderBottom>
  207. <u-radio-group v-model="formData.productCard" placement="row">
  208. <u-radio activeColor="#3c9cff" name="has" label="有保卡"></u-radio>
  209. <u-radio activeColor="#3c9cff" name="no" label="无保卡"></u-radio>
  210. </u-radio-group>
  211. </u-form-item>
  212. <u-form-item label="保卡年份" class="u-form-item-row" borderBottom
  213. v-if="formData.productCard === 'has'">
  214. <u--input v-model="formData.cardYear" placeholder="不填写默认空白保卡" clearable
  215. border="none"></u--input>
  216. </u-form-item>
  217. <u-form-item label="保卡图片或独立编码照片留底(仅内部人员可见)" borderBottom>
  218. <view class="imgs_scroll">
  219. <ImgsRowScroll v-if="formData.productCardPicFileList.length > 0" :isShowDeleteIcon="true"
  220. @deleteImgInfo="getDeleteProductCardPicInfo" imgMode="aspectFill" :totalWidth="400"
  221. :images="formData.productCardPicFileList" :previewEnabled="true" :imageWidth="150"
  222. :imageHeight="150"></ImgsRowScroll>
  223. <u-upload @afterRead="afterReadProductCardPic" name="3" multiple :maxCount="9"
  224. :previewFullImage="true"></u-upload>
  225. </view>
  226. </u-form-item>
  227. <u-form-item label="商品标签" class="u-form-item-row" borderBottom>
  228. <u--input v-model="formData.productTag" placeholder="请输入" clearable border="none"></u--input>
  229. </u-form-item>
  230. <u-form-item label="商品附件" class="u-form-item-row" borderBottom>
  231. <u--input v-model="formData.productAttachment" placeholder="请输入" clearable
  232. border="none"></u--input>
  233. </u-form-item>
  234. <u-form-item label="备注(仅内部人员可见)" borderBottom>
  235. <view class="recycle_bottom_desc">
  236. <u--textarea v-model="formData.productDesc" clearable count autoHeight maxlength="250"
  237. height="100" confirmType="done"></u--textarea>
  238. <view class="imgs_scroll">
  239. <ImgsRowScroll v-if="formData.productDescPicFileList.length > 0"
  240. :isShowDeleteIcon="true" @deleteImgInfo="getDeleteProductDescPicInfo"
  241. imgMode="aspectFill" :totalWidth="400" :images="formData.productDescPicFileList"
  242. :previewEnabled="true" :imageWidth="150" :imageHeight="150"></ImgsRowScroll>
  243. <u-upload @afterRead="afterReadProductDescPic" name="1" multiple :maxCount="1"
  244. accept="image"></u-upload>
  245. </view>
  246. </view>
  247. </u-form-item>
  248. <u-form-item label="付款方式">
  249. <TabSelect :tabList="paymentTabList" :echoInfo="echoInfoPayType" :colNum="4" mode="single"
  250. :isClear="payTypeIsClear" @tabChange="handlePayTypeTabChange">
  251. </TabSelect>
  252. </u-form-item>
  253. </u--form>
  254. </view>
  255. </view>
  256. <view :class="['btn_group', {'col-2': formData.stockStatus == '1'}]">
  257. <u-button plain type="primary" @click="submitForm('onlyIn')">保存</u-button>
  258. <u-button type="primary" @click="submitForm('inAndUp')" v-if="formData.stockStatus == '1'">入库并上架</u-button>
  259. </view>
  260. </view>
  261. </template>
  262. <script>
  263. import TabSelect from '@/components/custom-tab-select/index.vue'
  264. import Cell from '@/components/custom-cell/index.vue'
  265. import BrandList from '@/components/brand-list/index.vue'
  266. import ImgsRowScroll from '@/components/imgs-row-scroll/index.vue'
  267. import PersonPicker from '@/components/person-picker/index.vue'
  268. import { permissionCheck } from '@/utils/util.js'
  269. export default {
  270. components: {
  271. TabSelect,
  272. Cell,
  273. BrandList,
  274. ImgsRowScroll,
  275. PersonPicker
  276. },
  277. data() {
  278. return {
  279. checkboxValue: [''],
  280. recognitionContent: '',
  281. formData: {
  282. goodPicFileList: [],//商品图片
  283. desc: '',
  284. origin: '',
  285. type: '1',
  286. dictLabel: '艾美',
  287. dictValue: '88',
  288. series: '',
  289. model: '',
  290. dialType: '',
  291. caseMaterial: '',
  292. dialDiameter: '',
  293. material: '',
  294. size: '',
  295. yardage: '',
  296. price: '',
  297. productCondition: '1',
  298. detailPicFileList: [],//细节图片
  299. // detailVideoFileList:[],
  300. title:'',
  301. productNo: '',
  302. productAttribute: '1',
  303. stock: 1,
  304. costPrice: '',
  305. samePrice: '',
  306. agentPrice: '',
  307. salePrice: '',
  308. productPosition: '',
  309. watchYear: '',
  310. identifyingPerson: '',
  311. identifyingPersonId: '',
  312. stockStatus: '0',
  313. recycleType: '',
  314. recyclePerson: '',
  315. recyclePersonId: '',
  316. recycleBottomDesc: '',
  317. recycleBottomFileList: [],//回收留底图
  318. recycleTime: this.$dayjs().format('YYYY-MM-DD'),
  319. indentifyCode: '',
  320. targetAudience: '',
  321. productCard: '',
  322. cardYear: '',
  323. productCardPicFileList: [],//商品保卡图片或独立编码照片留底
  324. productTag: '',
  325. productAttachment: '',
  326. productDesc: '',
  327. productDescPicFileList: [],//商品备注图片
  328. payType: '',
  329. },
  330. continuousWarehousing: [],//是否连续入库 1:是 0:否
  331. rules: {
  332. goodPicFileList: [
  333. { required: true, message: '请上传商品图片' },
  334. ],
  335. desc: [
  336. { required: true, message: '请输入商品描述', trigger: ['blur', 'change'] },
  337. ],
  338. type: [
  339. { required: true, message: '请选择商品分类', trigger: ['blur', 'change'] },
  340. ],
  341. dictLabel: [
  342. { required: true, message: '请选择品牌', trigger: ['blur', 'change'] },
  343. ],
  344. productCondition: [
  345. { required: true, message: '请选择商品成色', trigger: ['blur', 'change'] },
  346. ],
  347. productAttribute: [
  348. { required: true, message: '请选择商品属性', trigger: ['blur', 'change'] },
  349. ],
  350. stock: [
  351. { required: true, message: '请输入库存数量' },
  352. ],
  353. stockStatus: [
  354. { required: true, message: '请选择是否入库', trigger: [ 'change'] },
  355. ],
  356. recycleTime: [
  357. { required: true, message: '请选择回收时间', trigger: ['blur', 'change'] },
  358. ],
  359. },
  360. recycleTimeShow: false,
  361. titlePlaceholder: '如不填,自动截取商品描述前50字',
  362. typeList: [],
  363. productConditionList: [
  364. {
  365. name: '闲置未使用',
  366. value: '1',
  367. },
  368. {
  369. name: '二手',
  370. value: '2',
  371. },
  372. ],
  373. productAttributeList: [
  374. {
  375. name: '自有商品',
  376. value: '1',
  377. },
  378. {
  379. name: '寄卖商品',
  380. value: '2',
  381. },
  382. {
  383. name: '质押商品',
  384. value: '3',
  385. },
  386. {
  387. name: '其它',
  388. value: '4',
  389. },
  390. ],
  391. stockStatusList: [
  392. {
  393. name: '待入库',
  394. value: '0',
  395. },
  396. {
  397. name: '已入库',
  398. value: '1',
  399. },
  400. ],
  401. recycleTypeList: [
  402. {
  403. name: '线上',
  404. value: '1',
  405. },
  406. {
  407. name: '同行',
  408. value: '2',
  409. },
  410. {
  411. name: '门店',
  412. value: '3',
  413. },
  414. {
  415. name: '其它',
  416. value: '4',
  417. },
  418. ],
  419. labelList: [
  420. {
  421. name: '完美',
  422. value: '1',
  423. },
  424. {
  425. name: '普通',
  426. value: '2',
  427. },
  428. {
  429. name: '瑕疵',
  430. value: '3',
  431. },
  432. {
  433. name: '假货',
  434. value: '4',
  435. },
  436. {
  437. name: '亏损',
  438. value: '5',
  439. },
  440. ],
  441. paymentTabList: [
  442. {
  443. name: '微信',
  444. value: "1",
  445. },
  446. {
  447. name: '支付宝',
  448. value: "2",
  449. },
  450. {
  451. name: '银行卡',
  452. value: "3",
  453. },
  454. {
  455. name: '现金',
  456. value: "4",
  457. },
  458. {
  459. name: '数字货币',
  460. value: "5",
  461. },
  462. {
  463. name: '挂账',
  464. value: "6",
  465. },
  466. ],
  467. typeIsClear: false,//商品分类是否清空
  468. productConditionIsClear: false,//商品成色是否清空
  469. productAttributeIsClear: false,//商品属性是否清空
  470. recycleTypeIsClear: false,//回收类型是否清空
  471. stockStatusIsClear: false,//是否入库是否清空
  472. labelIsClear: false,//商品标签是否清空
  473. payTypeIsClear: false,//付款方式是否清空
  474. echoInfoPayType: '',//付款方式识别回显
  475. echoInfoRecycleType:'',//入库回显的时候 回收类型回显
  476. echoInfoLabel:'',//入库回显的时候 商品标签回显
  477. echoInfoType:'',//入库回显的时候 类型回显
  478. echoInfoProductAttribute:'',//入库回显的时候 商品属性回显
  479. echoInfoProductCondition:'',//入库回显的时候 商品成色回显
  480. echoInfoStockStatus:'',//入库回显的时候 是否入库回显
  481. isWareHouser: permissionCheck('WAREHOUSER',false),
  482. formType: '',//表单类型 add:新增 edit:编辑
  483. }
  484. },
  485. onLoad(options) {
  486. this.getTypeList();
  487. this.$nextTick(async()=>{
  488. this.formType = options.formType
  489. if(options.formType == 'add'){
  490. this.clearForm()
  491. }else if(options.formType == 'edit'){
  492. const res = await uni.$u.api.wareHouseDetail({
  493. id: options.id,
  494. userId: this.$store.state.user.userInfo.userId,
  495. })
  496. this.formData = res.data
  497. this.formData.recycleTime = this.$dayjs(res.data.recycleTime).format('YYYY-MM-DD') || ''
  498. this.echoInfoType = res.data.type || '1'//商品分类回显
  499. this.formData.type = res.data.type || '1'//商品分类校验
  500. this.echoInfoProductAttribute = res.data.productAttribute || '1'//商品属性回显
  501. this.formData.productAttribute = res.data.productAttribute || '1'//商品属性校验
  502. this.echoInfoProductCondition = res.data.productCondition || '1'//商品成色回显
  503. this.formData.productCondition = res.data.productCondition || '1'//商品成色校验
  504. this.echoInfoStockStatus = res.data.stockStatus || '0'//是否入库回显
  505. this.formData.stockStatus = res.data.stockStatus || '0'//是否入库校验
  506. this.formData.stock = res.data.stock ? res.data.stock : 1//入库数量校验
  507. this.echoInfoPayType = res.data.payType//付款方式回显
  508. this.echoInfoRecycleType = res.data.recycleType//回收类型回显
  509. this.echoInfoLabel = res.data.label//商品标签回显
  510. this.recognitionContent = `品牌:${res.data.dictLabel || '-'}
  511. 来源:${res.data.origin || '-'}
  512. 实价:${res.data.costPrice || '-'}
  513. 型号:${res.data.model || '-'}
  514. 编码:${res.data.indentifyCode || '-'}
  515. 日期:${res.data.recycleTime || '-'}
  516. 备注:${res.data.productDesc || '-'}
  517. 付款方式:${this.paymentTabList.find(item => item.value == res.data.payType)?.name || '-'}
  518. `
  519. }
  520. })
  521. },
  522. methods: {
  523. getTypeList() {
  524. this.$getDicts("crm_form_category").then(res => {
  525. this.typeList = res
  526. })
  527. },
  528. // 提交表单
  529. submitForm(submitType) {
  530. if(!permissionCheck('WAREHOUSER')) return false
  531. this.$refs.addForm.validate().then((valid) => {
  532. if (valid) {
  533. if (this.formData.title == '') {
  534. this.formData.title = this.formData.desc.substring(0, 50);
  535. }
  536. this.formData.recycleTime = this.$dayjs(this.formData.recycleTime).format('YYYY-MM-DD')
  537. const data = {
  538. ...this.formData,
  539. submitType: submitType, //提交类型 onlyIn:仅入库/暂存入库 inAndUp:入库并上架
  540. continuousWarehousing: this.continuousWarehousing[0] || '0',//是否连续入库 1:是 0:否
  541. }
  542. if(this.formType == 'add'){
  543. uni.$u.api.wareHouseAdd(data).then(res => {
  544. uni.$u.toast('操作成功');
  545. if (data.continuousWarehousing == '0') {
  546. setTimeout(() => {
  547. uni.navigateBack({
  548. delta: 1
  549. });
  550. }, 1000);
  551. } else {
  552. this.clearForm();
  553. }
  554. }).catch(err => {
  555. uni.$u.toast(err);
  556. })
  557. }else if(this.formType == 'edit'){
  558. uni.$u.api.wareHouseUpdate(data).then(res => {
  559. uni.$u.toast('操作成功');
  560. if (data.continuousWarehousing == '0') {
  561. setTimeout(() => {
  562. uni.navigateBack({
  563. delta: 1
  564. });
  565. }, 1000);
  566. } else {
  567. this.clearForm();
  568. }
  569. }).catch(err => {
  570. uni.$u.toast(err);
  571. })
  572. }
  573. } else {
  574. console.log('表单校验不通过');
  575. }
  576. });
  577. },
  578. clearForm() {
  579. this.formData = {
  580. goodPicFileList: [],//商品图片
  581. desc: '',
  582. origin: '',
  583. type: '1',
  584. dictLabel: '艾美',
  585. dictValue: '88',
  586. series: '',
  587. model: '',
  588. dialType: '',
  589. caseMaterial: '',
  590. dialDiameter: '',
  591. material: '',
  592. size: '',
  593. yardage: '',
  594. price: '',
  595. productCondition: '1',
  596. detailPicFileList: [],//细节图片
  597. // detailVideoFileList:[],
  598. productNo: '',
  599. productAttribute: '1',
  600. stock: 1,
  601. costPrice: '',
  602. samePrice: '',
  603. agentPrice: '',
  604. salePrice: '',
  605. productPosition: '',
  606. watchYear: '',
  607. identifyingPerson: '',
  608. identifyingPersonId: '',
  609. stockStatus: '0',
  610. recycleType: '',
  611. label: '',
  612. recyclePerson: '',
  613. recyclePersonId: '',
  614. recycleBottomDesc: '',
  615. recycleBottomFileList: [],//回收留底图
  616. recycleTime: this.$dayjs().format('YYYY-MM-DD'),
  617. indentifyCode: '',
  618. targetAudience: '',
  619. productCard: '',
  620. cardYear: '',
  621. productCardPicFileList: [],//商品保卡图片或独立编码照片留底
  622. productTag: '',
  623. productAttachment: '',
  624. productDesc: '',
  625. productDescPicFileList: [],//商品备注图片
  626. payType: '',
  627. }
  628. this.recycleTypeIsClear = true;
  629. this.payTypeIsClear = true;
  630. this.labelIsClear = true;
  631. this.echoInfoType = '1';//类型默认第一项
  632. this.echoInfoProductCondition = '1';//商品成色默认第一项
  633. this.echoInfoProductAttribute = '1';//商品属性默认第一项
  634. this.echoInfoStockStatus = '0';//是否入库默认第一项
  635. this.continuousWarehousing = [];
  636. this.$nextTick(()=>{
  637. this.$refs.addForm.resetFields();
  638. })
  639. },
  640. // 选择品牌
  641. handleSelectedBrand(info) {
  642. this.formData.dictLabel = info.dictLabel;
  643. this.formData.dictValue = info.dictValue;
  644. this.$refs.addForm.validateField('dictLabel');
  645. },
  646. // 显示品牌列表
  647. showBrandList() {
  648. this.$refs.brandListRef.showBrandList();
  649. },
  650. // 清空输入框
  651. clear(key) {
  652. // 品牌
  653. if (key == 'dictLabel') {
  654. this.formData.dictLabel = '';
  655. this.formData.dictValue = '';
  656. return;
  657. }
  658. // 鉴定人
  659. if (key == 'identifyingPerson') {
  660. this.formData.identifyingPerson = '';
  661. this.formData.identifyingPersonId = '';
  662. return;
  663. }
  664. // 回收人
  665. if (key == 'recyclePerson') {
  666. this.formData.recyclePerson = '';
  667. this.formData.recyclePersonId = '';
  668. return;
  669. }
  670. this.formData[key] = '';
  671. },
  672. // 商品分类
  673. handleTabChangeType(e) {
  674. this.formData.type = e;
  675. this.$refs.addForm.validateField('type')
  676. },
  677. // 商品成色
  678. handleTabChangeProductCondition(e) {
  679. this.formData.productCondition = e;
  680. this.$refs.addForm.validateField('productCondition')
  681. },
  682. // 商品属性
  683. handleTabChangeProductAttribute(e) {
  684. this.formData.productAttribute = e;
  685. this.$refs.addForm.validateField('productAttribute')
  686. },
  687. // 是否入库
  688. handleTabChangeStockStatus(e) {
  689. this.formData.stockStatus = e;
  690. },
  691. // 回收类型
  692. handleTabChangeRecycleType(e) {
  693. this.formData.recycleType = e;
  694. },
  695. // 商品标签
  696. handleTabChangeLabel(e) {
  697. this.formData.label = e;
  698. },
  699. // 付款方式
  700. handlePayTypeTabChange(e) {
  701. this.formData.payType = e;
  702. },
  703. // 打开回收时间选择器
  704. clickRecycleTimeRow() {
  705. this.recycleTimeShow = true;
  706. },
  707. // 确认回收时间
  708. confirmRecycleTime(val) {
  709. this.$nextTick(() => {
  710. this.formData.recycleTime = this.$dayjs(val.value).format('YYYY-MM-DD');
  711. this.recycleTimeShow = false;
  712. })
  713. },
  714. // 关闭回收时间选择器
  715. closeRecycleTimePicker(val) {
  716. this.recycleTimeShow = false;
  717. },
  718. // 打开鉴定人选择器
  719. identifyingPersonClick() {
  720. this.$refs.identifyingPersonPickerRef.open();
  721. },
  722. // 选择鉴定人
  723. handleSelectIdentifyingPerson(info) {
  724. this.formData.identifyingPerson = info.label;
  725. this.formData.identifyingPersonId = info.id;
  726. },
  727. // 打开回收人选择器
  728. recyclePersonClick() {
  729. this.$refs.recyclePersonPickerRef.open();
  730. },
  731. // 选择回收人
  732. handleSelectRecyclePerson(info) {
  733. this.formData.recyclePerson = info.label;
  734. this.formData.recyclePersonId = info.id;
  735. },
  736. // 新增商品图片
  737. async afterReadGoodPic(event) {
  738. event.file.forEach(item => {
  739. uni.$u.api.uploadFile(item.url).then((res) => {
  740. this.formData.goodPicFileList.push(res.data.url);
  741. uni.$u.toast("文件上传成功");
  742. }).catch(() => {
  743. uni.$u.toast("上传文件失败");
  744. })
  745. })
  746. },
  747. // 获取删除商品图片信息
  748. getDeleteGoodPicInfo(info) {
  749. this.formData.goodPicFileList = info.newImages
  750. },
  751. // 获取删除细节图片信息
  752. getDeleteDetailPicInfo(info) {
  753. this.formData.detailPicFileList = info.newImages
  754. },
  755. // 新增细节图片
  756. async afterReadDetailPic(event) {
  757. event.file.forEach(item => {
  758. uni.$u.api.uploadFile(item.url).then((res) => {
  759. this.formData.detailPicFileList.push(res.data.url);
  760. uni.$u.toast("文件上传成功");
  761. }).catch(() => {
  762. uni.$u.toast("上传文件失败");
  763. })
  764. })
  765. },
  766. // 获取删除回收留底图信息
  767. getDeleteRecycleBottomPicInfo(info) {
  768. this.formData.recycleBottomFileList = info.newImages
  769. },
  770. // 新增回收留底图
  771. async afterReadRecycleBottom(event) {
  772. event.file.forEach(item => {
  773. uni.$u.api.uploadFile(item.url).then((res) => {
  774. this.formData.recycleBottomFileList.push(res.data.url);
  775. uni.$u.toast("文件上传成功");
  776. }).catch(() => {
  777. uni.$u.toast("上传文件失败");
  778. })
  779. })
  780. },
  781. // 删除商品保卡图片或独立编码照片留底
  782. getDeleteProductCardPicInfo(info) {
  783. this.formData.productCardPicFileList = info.newImages
  784. },
  785. // 新增商品保卡图片或独立编码照片留底
  786. async afterReadProductCardPic(event) {
  787. event.file.forEach(item => {
  788. uni.$u.api.uploadFile(item.url).then((res) => {
  789. this.formData.productCardPicFileList.push(res.data.url);
  790. uni.$u.toast("文件上传成功");
  791. }).catch(() => {
  792. uni.$u.toast("上传文件失败");
  793. })
  794. })
  795. },
  796. // 获取删除商品备注图片信息
  797. getDeleteProductDescPicInfo(info) {
  798. this.formData.productDescPicFileList = info.newImages
  799. },
  800. // 新增商品备注图片
  801. async afterReadProductDescPic(event) {
  802. event.file.forEach(item => {
  803. uni.$u.api.uploadFile(item.url).then((res) => {
  804. this.formData.productDescPicFileList.push(res.data.url);
  805. uni.$u.toast("文件上传成功");
  806. }).catch(() => {
  807. uni.$u.toast("上传文件失败");
  808. })
  809. })
  810. },
  811. async handlePasteRecognition(text) {
  812. // 品牌:浪琴
  813. // 来源:【麒麟】私信-杰3-3
  814. // 实价:6500
  815. // 型号:L2.257.5.89.7
  816. // 编码:52356065
  817. // 日期:2021-11-09
  818. // 备注:全套
  819. // 付款方式:微信
  820. if (!text) {
  821. return;
  822. }
  823. try {
  824. if (!text) return {};
  825. const result = {};
  826. // 支持中文冒号和英文冒号
  827. const lines = text.split(/[\n\r]+/);
  828. lines.forEach(line => {
  829. const lineStr = line.trim();
  830. if (!lineStr) return;
  831. // 尝试中文冒号
  832. let separatorIndex = lineStr.indexOf(':');
  833. // 如果没有中文冒号,尝试英文冒号
  834. if (separatorIndex === -1) {
  835. separatorIndex = lineStr.indexOf(':');
  836. }
  837. if (separatorIndex > 0) {
  838. const key = lineStr.substring(0, separatorIndex).trim();
  839. const value = lineStr.substring(separatorIndex + 1).trim();
  840. result[key] = value;
  841. }
  842. });
  843. if (result['品牌']) {
  844. this.formData.dictLabel = result['品牌'];
  845. }
  846. if (result['来源']) {
  847. this.formData.origin = result['来源'];
  848. }
  849. if (result['实价']) {
  850. this.formData.costPrice = result['实价'];
  851. }
  852. if (result['型号']) {
  853. this.formData.model = result['型号'];
  854. }
  855. if (result['编码']) {
  856. this.formData.indentifyCode = result['编码'];
  857. }
  858. if (result['日期']) {
  859. this.formData.recycleTime = result['日期'];
  860. }
  861. if (result['备注']) {
  862. this.formData.productDesc = result['备注'];
  863. }
  864. if (result['付款方式']) {
  865. this.getPaymentType(result['付款方式'])
  866. this.formData.payType = result['付款方式'];
  867. }
  868. // return result;
  869. } catch (e) {
  870. uni.$u.toast("文本识别异常");
  871. }
  872. },
  873. // 清空识别内容
  874. clearRecognitionContent() {
  875. this.recognitionContent = '';
  876. },
  877. // 识别内容 回显付款方式
  878. getPaymentType(val) {
  879. let arr = []
  880. this.paymentTabList.filter(item => {
  881. if (item.name == val) arr.push(item.value)
  882. })
  883. if (arr.length > 0) {
  884. this.echoInfoPayType = arr[0]
  885. }
  886. }
  887. }
  888. }
  889. </script>
  890. <style lang="scss" scoped>
  891. @import '../styles/edit.scss';
  892. </style>