edit.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  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="商品图片" 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="100" 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>
  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>
  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>
  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"
  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"
  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="payTypeEcho" :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')">{{ formData.stockStatus == '0' ? '待入库' : '仅入库' }}</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. export default {
  269. components: {
  270. TabSelect,
  271. Cell,
  272. BrandList,
  273. ImgsRowScroll,
  274. PersonPicker
  275. },
  276. data() {
  277. return {
  278. checkboxValue: [''],
  279. recognitionContent: '',
  280. formData: {
  281. goodPicFileList: [],//商品图片
  282. desc: '',
  283. origin: '',
  284. type: '1',
  285. dictLabel: '艾美',
  286. dictValue: '88',
  287. series: '',
  288. model: '',
  289. dialType: '',
  290. caseMaterial: '',
  291. dialDiameter: '',
  292. material: '',
  293. size: '',
  294. yardage: '',
  295. price: '',
  296. productCondition: '1',
  297. detailPicFileList: [],//细节图片
  298. // detailVideoFileList:[],
  299. productNo: '',
  300. productAttribute: '1',
  301. stock: 1,
  302. costPrice: '',
  303. samePrice: '',
  304. agentPrice: '',
  305. salePrice: '',
  306. productPosition: '',
  307. watchYear: '',
  308. identifyingPerson: '',
  309. identifyingPersonId: '',
  310. stockStatus: '0',
  311. recycleType: '',
  312. recyclePerson: '',
  313. recyclePersonId: '',
  314. recycleBottomDesc: '',
  315. recycleBottomFileList: [],//回收留底图
  316. recycleTime: this.$dayjs().format('YYYY-MM-DD'),
  317. indentifyCode: '',
  318. targetAudience: '',
  319. productCard: '',
  320. cardYear: '',
  321. productCardPicFileList: [],//商品保卡图片或独立编码照片留底
  322. productTag: '',
  323. productAttachment: '',
  324. productDesc: '',
  325. productDescPicFileList: [],//商品备注图片
  326. payType: '',
  327. },
  328. continuousWarehousing: [],//是否连续入库 1:是 0:否
  329. rules: {
  330. goodPicFileList: [
  331. { required: true, message: '请上传商品图片' },
  332. ],
  333. desc: [
  334. { required: true, message: '请输入商品描述', trigger: ['blur', 'change'] },
  335. ],
  336. type: [
  337. { required: true, message: '请选择商品分类', trigger: ['blur', 'change'] },
  338. ],
  339. dictLabel: [
  340. { required: true, message: '请选择品牌', trigger: ['blur', 'change'] },
  341. ],
  342. productCondition: [
  343. { required: true, message: '请选择商品成色', trigger: ['blur', 'change'] },
  344. ],
  345. productAttribute: [
  346. { required: true, message: '请选择商品属性', trigger: ['blur', 'change'] },
  347. ],
  348. stock: [
  349. { required: true, message: '请输入库存数量' },
  350. ],
  351. stockStatus: [
  352. { required: true, message: '请选择是否入库', trigger: [ 'change'] },
  353. ],
  354. recycleTime: [
  355. { required: true, message: '请选择回收时间', trigger: ['blur', 'change'] },
  356. ],
  357. },
  358. recycleTimeShow: false,
  359. titlePlaceholder: '如不填,自动截取商品描述前50字',
  360. typeList: [],
  361. productConditionList: [
  362. {
  363. name: '闲置未使用',
  364. value: '1',
  365. },
  366. {
  367. name: '二手',
  368. value: '2',
  369. },
  370. ],
  371. productAttributeList: [
  372. {
  373. name: '自有商品',
  374. value: '1',
  375. },
  376. {
  377. name: '寄卖商品',
  378. value: '2',
  379. },
  380. {
  381. name: '质押商品',
  382. value: '3',
  383. },
  384. {
  385. name: '其它',
  386. value: '4',
  387. },
  388. ],
  389. stockStatusList: [
  390. {
  391. name: '待入库',
  392. value: '0',
  393. },
  394. {
  395. name: '已入库',
  396. value: '1',
  397. },
  398. ],
  399. recycleTypeList: [
  400. {
  401. name: '线上',
  402. value: '1',
  403. },
  404. {
  405. name: '同行',
  406. value: '2',
  407. },
  408. {
  409. name: '门店',
  410. value: '3',
  411. },
  412. {
  413. name: '其它',
  414. value: '4',
  415. },
  416. ],
  417. labelList: [
  418. {
  419. name: '完美',
  420. value: '1',
  421. },
  422. {
  423. name: '普通',
  424. value: '2',
  425. },
  426. {
  427. name: '瑕疵',
  428. value: '3',
  429. },
  430. {
  431. name: '假货',
  432. value: '4',
  433. },
  434. {
  435. name: '亏损',
  436. value: '5',
  437. },
  438. ],
  439. paymentTabList: [
  440. {
  441. name: '微信',
  442. value: 1,
  443. },
  444. {
  445. name: '支付宝',
  446. value: 2,
  447. },
  448. {
  449. name: '银行卡',
  450. value: 3,
  451. },
  452. {
  453. name: '现金',
  454. value: 4,
  455. },
  456. {
  457. name: '数字货币',
  458. value: 5,
  459. },
  460. {
  461. name: '挂账',
  462. value: 6,
  463. },
  464. ],
  465. typeIsClear: false,//商品分类是否清空
  466. productConditionIsClear: false,//商品成色是否清空
  467. productAttributeIsClear: false,//商品属性是否清空
  468. recycleTypeIsClear: false,//回收类型是否清空
  469. stockStatusIsClear: false,//是否入库是否清空
  470. labelIsClear: false,//商品标签是否清空
  471. payTypeIsClear: false,//付款方式是否清空
  472. payTypeEcho: '',//付款方式识别回显
  473. echoInfoType:'',//入库回显的时候 类型回显
  474. echoInfoProductAttribute:'',//入库回显的时候 商品属性回显
  475. echoInfoProductCondition:'',//入库回显的时候 商品成色回显
  476. echoInfoStockStatus:'',//入库回显的时候 是否入库回显
  477. }
  478. },
  479. onLoad(options) {
  480. this.getTypeList();
  481. this.$nextTick(()=>{
  482. if(options.formType == 'add'){
  483. this.clearForm()
  484. }else if(options.formType == 'edit'){
  485. uni.$u.api.wareHouseDetail({
  486. id: options.id,
  487. userId: this.$store.state.user.userInfo.userId,
  488. }).then(res => {
  489. const keys = Object.keys(res.data)
  490. keys.forEach(item => {
  491. this.formData[item] = res.data[item]
  492. })
  493. this.formData.recycleTime = this.$dayjs(res.data.recycleTime).format('YYYY-MM-DD') || ''
  494. this.echoInfoType = res.data.type || '1'
  495. this.echoInfoProductAttribute = res.data.productAttribute || '1'
  496. this.echoInfoProductCondition = res.data.productCondition || '1'
  497. this.echoInfoStockStatus = res.data.stockStatus || '0'
  498. });
  499. }
  500. })
  501. },
  502. methods: {
  503. getTypeList() {
  504. this.$getDicts("crm_form_category").then(res => {
  505. this.typeList = res
  506. })
  507. },
  508. // 提交表单
  509. submitForm(submitType) {
  510. this.$refs.addForm.validate().then((valid) => {
  511. if (valid) {
  512. if (this.formData.title == '') {
  513. this.formData.title = this.formData.desc.substring(0, 50);
  514. }
  515. this.formData.recycleTime = this.$dayjs(this.formData.recycleTime).format('YYYY-MM-DD')
  516. const data = {
  517. ...this.formData,
  518. submitType: submitType, //提交类型 onlyIn:仅入库/暂存入库 inAndUp:入库并上架
  519. continuousWarehousing: this.continuousWarehousing[0] || '0',//是否连续入库 1:是 0:否
  520. }
  521. uni.$u.api.wareHouseAdd(data).then(res => {
  522. uni.$u.toast('操作成功');
  523. if (data.continuousWarehousing == '0') {
  524. setTimeout(() => {
  525. uni.navigateBack({
  526. delta: 1
  527. });
  528. }, 1000);
  529. } else {
  530. this.clearForm();
  531. }
  532. }).catch(err => {
  533. uni.$u.toast(err);
  534. })
  535. } else {
  536. console.log('表单校验不通过');
  537. }
  538. });
  539. },
  540. clearForm() {
  541. this.formData = {
  542. goodPicFileList: [],//商品图片
  543. desc: '',
  544. origin: '',
  545. type: '1',
  546. dictLabel: '艾美',
  547. dictValue: '88',
  548. series: '',
  549. model: '',
  550. dialType: '',
  551. caseMaterial: '',
  552. dialDiameter: '',
  553. material: '',
  554. size: '',
  555. yardage: '',
  556. price: '',
  557. productCondition: '1',
  558. detailPicFileList: [],//细节图片
  559. // detailVideoFileList:[],
  560. productNo: '',
  561. productAttribute: '1',
  562. stock: 1,
  563. costPrice: '',
  564. samePrice: '',
  565. agentPrice: '',
  566. salePrice: '',
  567. productPosition: '',
  568. watchYear: '',
  569. identifyingPerson: '',
  570. identifyingPersonId: '',
  571. stockStatus: '0',
  572. recycleType: '',
  573. label: '',
  574. recyclePerson: '',
  575. recyclePersonId: '',
  576. recycleBottomDesc: '',
  577. recycleBottomFileList: [],//回收留底图
  578. recycleTime: this.$dayjs().format('YYYY-MM-DD'),
  579. indentifyCode: '',
  580. targetAudience: '',
  581. productCard: '',
  582. cardYear: '',
  583. productCardPicFileList: [],//商品保卡图片或独立编码照片留底
  584. productTag: '',
  585. productAttachment: '',
  586. productDesc: '',
  587. productDescPicFileList: [],//商品备注图片
  588. payType: '',
  589. }
  590. this.recycleTypeIsClear = true;
  591. this.payTypeIsClear = true;
  592. this.labelIsClear = true;
  593. this.echoInfoType = '1';//类型默认第一项
  594. this.echoInfoProductCondition = '1';//商品成色默认第一项
  595. this.echoInfoProductAttribute = '1';//商品属性默认第一项
  596. this.echoInfoStockStatus = '0';//是否入库默认第一项
  597. this.continuousWarehousing = [];
  598. this.$nextTick(()=>{
  599. this.$refs.addForm.resetFields();
  600. })
  601. },
  602. // 选择品牌
  603. handleSelectedBrand(info) {
  604. this.formData.dictLabel = info.dictLabel;
  605. this.formData.dictValue = info.dictValue;
  606. this.$refs.addForm.validateField('dictLabel');
  607. },
  608. // 显示品牌列表
  609. showBrandList() {
  610. this.$refs.brandListRef.showBrandList();
  611. },
  612. // 清空输入框
  613. clear(key) {
  614. // 品牌
  615. if (key == 'dictLabel') {
  616. this.formData.dictLabel = '';
  617. this.formData.dictValue = '';
  618. return;
  619. }
  620. // 鉴定人
  621. if (key == 'identifyingPerson') {
  622. this.formData.identifyingPerson = '';
  623. this.formData.identifyingPersonId = '';
  624. return;
  625. }
  626. // 回收人
  627. if (key == 'recyclePerson') {
  628. this.formData.recyclePerson = '';
  629. this.formData.recyclePersonId = '';
  630. return;
  631. }
  632. this.formData[key] = '';
  633. },
  634. // 商品分类
  635. handleTabChangeType(e) {
  636. this.formData.type = e;
  637. this.$refs.addForm.validateField('type')
  638. },
  639. // 商品成色
  640. handleTabChangeProductCondition(e) {
  641. this.formData.productCondition = e;
  642. this.$refs.addForm.validateField('productCondition')
  643. },
  644. // 商品属性
  645. handleTabChangeProductAttribute(e) {
  646. this.formData.productAttribute = e;
  647. this.$refs.addForm.validateField('productAttribute')
  648. },
  649. // 是否入库
  650. handleTabChangeStockStatus(e) {
  651. this.formData.stockStatus = e;
  652. },
  653. // 回收类型
  654. handleTabChangeRecycleType(e) {
  655. this.formData.recycleType = e;
  656. },
  657. // 商品标签
  658. handleTabChangeLabel(e) {
  659. this.formData.label = e;
  660. },
  661. // 付款方式
  662. handlePayTypeTabChange(e) {
  663. this.formData.payType = e;
  664. },
  665. // 打开回收时间选择器
  666. clickRecycleTimeRow() {
  667. this.recycleTimeShow = true;
  668. },
  669. // 确认回收时间
  670. confirmRecycleTime(val) {
  671. this.$nextTick(() => {
  672. this.formData.recycleTime = this.$dayjs(val.value).format('YYYY-MM-DD');
  673. this.recycleTimeShow = false;
  674. })
  675. },
  676. // 关闭回收时间选择器
  677. closeRecycleTimePicker(val) {
  678. this.recycleTimeShow = false;
  679. },
  680. // 打开鉴定人选择器
  681. identifyingPersonClick() {
  682. this.$refs.identifyingPersonPickerRef.open();
  683. },
  684. // 选择鉴定人
  685. handleSelectIdentifyingPerson(info) {
  686. this.formData.identifyingPerson = info.label;
  687. this.formData.identifyingPersonId = info.id;
  688. },
  689. // 打开回收人选择器
  690. recyclePersonClick() {
  691. this.$refs.recyclePersonPickerRef.open();
  692. },
  693. // 选择回收人
  694. handleSelectRecyclePerson(info) {
  695. this.formData.recyclePerson = info.label;
  696. this.formData.recyclePersonId = info.id;
  697. },
  698. // 新增商品图片
  699. async afterReadGoodPic(event) {
  700. event.file.forEach(item => {
  701. uni.$u.api.uploadFile(item.url).then((res) => {
  702. this.formData.goodPicFileList.push(res.data.url);
  703. uni.$u.toast("文件上传成功");
  704. }).catch(() => {
  705. uni.$u.toast("上传文件失败");
  706. })
  707. })
  708. },
  709. // 获取删除商品图片信息
  710. getDeleteGoodPicInfo(info) {
  711. this.formData.goodPicFileList = info.newImages
  712. },
  713. // 获取删除细节图片信息
  714. getDeleteDetailPicInfo(info) {
  715. this.formData.detailPicFileList = info.newImages
  716. },
  717. // 新增细节图片
  718. async afterReadDetailPic(event) {
  719. event.file.forEach(item => {
  720. uni.$u.api.uploadFile(item.url).then((res) => {
  721. this.formData.detailPicFileList.push(res.data.url);
  722. uni.$u.toast("文件上传成功");
  723. }).catch(() => {
  724. uni.$u.toast("上传文件失败");
  725. })
  726. })
  727. },
  728. // 获取删除回收留底图信息
  729. getDeleteRecycleBottomPicInfo(info) {
  730. this.formData.recycleBottomFileList = info.newImages
  731. },
  732. // 新增回收留底图
  733. async afterReadRecycleBottom(event) {
  734. event.file.forEach(item => {
  735. uni.$u.api.uploadFile(item.url).then((res) => {
  736. this.formData.recycleBottomFileList.push(res.data.url);
  737. uni.$u.toast("文件上传成功");
  738. }).catch(() => {
  739. uni.$u.toast("上传文件失败");
  740. })
  741. })
  742. },
  743. // 删除商品保卡图片或独立编码照片留底
  744. getDeleteProductCardPicInfo(info) {
  745. this.formData.productCardPicFileList = info.newImages
  746. },
  747. // 新增商品保卡图片或独立编码照片留底
  748. async afterReadProductCardPic(event) {
  749. event.file.forEach(item => {
  750. uni.$u.api.uploadFile(item.url).then((res) => {
  751. this.formData.productCardPicFileList.push(res.data.url);
  752. uni.$u.toast("文件上传成功");
  753. }).catch(() => {
  754. uni.$u.toast("上传文件失败");
  755. })
  756. })
  757. },
  758. // 获取删除商品备注图片信息
  759. getDeleteProductDescPicInfo(info) {
  760. this.formData.productDescPicFileList = info.newImages
  761. },
  762. // 新增商品备注图片
  763. async afterReadProductDescPic(event) {
  764. event.file.forEach(item => {
  765. uni.$u.api.uploadFile(item.url).then((res) => {
  766. this.formData.productDescPicFileList.push(res.data.url);
  767. uni.$u.toast("文件上传成功");
  768. }).catch(() => {
  769. uni.$u.toast("上传文件失败");
  770. })
  771. })
  772. },
  773. async handlePasteRecognition(text) {
  774. // 品牌:浪琴
  775. // 来源:【麒麟】私信-杰3-3
  776. // 实价:6500
  777. // 型号:L2.257.5.89.7
  778. // 编码:52356065
  779. // 日期:2021-11-09
  780. // 备注:全套
  781. // 付款方式:微信
  782. if (!text) {
  783. return;
  784. }
  785. try {
  786. if (!text) return {};
  787. const result = {};
  788. // 支持中文冒号和英文冒号
  789. const lines = text.split(/[\n\r]+/);
  790. lines.forEach(line => {
  791. const lineStr = line.trim();
  792. if (!lineStr) return;
  793. // 尝试中文冒号
  794. let separatorIndex = lineStr.indexOf(':');
  795. // 如果没有中文冒号,尝试英文冒号
  796. if (separatorIndex === -1) {
  797. separatorIndex = lineStr.indexOf(':');
  798. }
  799. if (separatorIndex > 0) {
  800. const key = lineStr.substring(0, separatorIndex).trim();
  801. const value = lineStr.substring(separatorIndex + 1).trim();
  802. result[key] = value;
  803. }
  804. });
  805. if (result['品牌']) {
  806. this.formData.dictLabel = result['品牌'];
  807. }
  808. if (result['来源']) {
  809. this.formData.origin = result['来源'];
  810. }
  811. if (result['实价']) {
  812. this.formData.costPrice = result['实价'];
  813. }
  814. if (result['型号']) {
  815. this.formData.model = result['型号'];
  816. }
  817. if (result['编码']) {
  818. this.formData.indentifyCode = result['编码'];
  819. }
  820. if (result['日期']) {
  821. this.formData.recycleTime = result['日期'];
  822. }
  823. if (result['备注']) {
  824. this.formData.productDesc = result['备注'];
  825. }
  826. if (result['付款方式']) {
  827. this.getPaymentType(result['付款方式'])
  828. this.formData.payType = result['付款方式'];
  829. }
  830. // return result;
  831. } catch (e) {
  832. uni.$u.toast("文本识别异常");
  833. }
  834. },
  835. // 清空识别内容
  836. clearRecognitionContent() {
  837. this.recognitionContent = '';
  838. },
  839. // 识别内容 回显付款方式
  840. getPaymentType(val) {
  841. let arr = []
  842. this.paymentTabList.filter(item => {
  843. if (item.name == val) arr.push(item.value)
  844. })
  845. if (arr.length > 0) {
  846. this.payTypeEcho = arr[0]
  847. }
  848. }
  849. }
  850. }
  851. </script>
  852. <style lang="scss" scoped>
  853. @import '../styles/edit.scss';
  854. </style>