add.vue 37 KB

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