edit.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  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 key = ['costPrice','dictLabel','dictValue','goodPicFileList','indexntifuCode','origin','stockStatus']
  490. key.forEach(item => {
  491. this.formData[item] = res.data[item]
  492. })
  493. this.recycleTime = this.$dayjs(res.data.recycleTime).format('YYYY-MM-DD') || ''
  494. this.echoInfoType = res.data.type || '1'
  495. });
  496. }
  497. })
  498. },
  499. methods: {
  500. getTypeList() {
  501. this.$getDicts("crm_form_category").then(res => {
  502. this.typeList = res
  503. })
  504. },
  505. // 提交表单
  506. submitForm(submitType) {
  507. this.$refs.addForm.validate().then((valid) => {
  508. if (valid) {
  509. if (this.formData.title == '') {
  510. this.formData.title = this.formData.desc.substring(0, 50);
  511. }
  512. this.formData.recycleTime = this.$dayjs(this.formData.recycleTime).format('YYYY-MM-DD')
  513. const data = {
  514. ...this.formData,
  515. submitType: submitType, //提交类型 onlyIn:仅入库/暂存入库 inAndUp:入库并上架
  516. continuousWarehousing: this.continuousWarehousing[0] || '0',//是否连续入库 1:是 0:否
  517. }
  518. uni.$u.api.wareHouseAdd(data).then(res => {
  519. if (res.code === 200) {
  520. uni.$u.toast('新增成功');
  521. if (data.continuousWarehousing == '0') {
  522. setTimeout(() => {
  523. uni.navigateBack({
  524. delta: 1
  525. });
  526. }, 1000);
  527. } else {
  528. this.clearForm();
  529. }
  530. } else {
  531. uni.$u.toast(res.msg);
  532. }
  533. })
  534. } else {
  535. console.log('表单校验不通过');
  536. }
  537. });
  538. },
  539. clearForm() {
  540. this.formData = {
  541. goodPicFileList: [],//商品图片
  542. desc: '',
  543. origin: '',
  544. type: '1',
  545. dictLabel: '艾美',
  546. dictValue: '88',
  547. series: '',
  548. model: '',
  549. dialType: '',
  550. caseMaterial: '',
  551. dialDiameter: '',
  552. material: '',
  553. size: '',
  554. yardage: '',
  555. price: '',
  556. productCondition: '1',
  557. detailPicFileList: [],//细节图片
  558. // detailVideoFileList:[],
  559. productNo: '',
  560. productAttribute: '1',
  561. stock: 1,
  562. costPrice: '',
  563. samePrice: '',
  564. agentPrice: '',
  565. salePrice: '',
  566. productPosition: '',
  567. watchYear: '',
  568. identifyingPerson: '',
  569. identifyingPersonId: '',
  570. stockStatus: '0',
  571. recycleType: '',
  572. label: '',
  573. recyclePerson: '',
  574. recyclePersonId: '',
  575. recycleBottomDesc: '',
  576. recycleBottomFileList: [],//回收留底图
  577. recycleTime: this.$dayjs().format('YYYY-MM-DD'),
  578. indentifyCode: '',
  579. targetAudience: '',
  580. productCard: '',
  581. cardYear: '',
  582. productCardPicFileList: [],//商品保卡图片或独立编码照片留底
  583. productTag: '',
  584. productAttachment: '',
  585. productDesc: '',
  586. productDescPicFileList: [],//商品备注图片
  587. payType: '',
  588. }
  589. this.recycleTypeIsClear = true;
  590. this.payTypeIsClear = true;
  591. this.labelIsClear = true;
  592. this.echoInfoType = '1';//类型默认第一项
  593. this.echoInfoProductCondition = '1';//商品成色默认第一项
  594. this.echoInfoProductAttribute = '1';//商品属性默认第一项
  595. this.echoInfoStockStatus = '0';//是否入库默认第一项
  596. this.continuousWarehousing = [];
  597. this.$nextTick(()=>{
  598. this.$refs.addForm.resetFields();
  599. })
  600. },
  601. // 选择品牌
  602. handleSelectedBrand(info) {
  603. this.formData.dictLabel = info.dictLabel;
  604. this.formData.dictValue = info.dictValue;
  605. this.$refs.addForm.validateField('dictLabel');
  606. },
  607. // 显示品牌列表
  608. showBrandList() {
  609. this.$refs.brandListRef.showBrandList();
  610. },
  611. // 清空输入框
  612. clear(key) {
  613. // 品牌
  614. if (key == 'dictLabel') {
  615. this.formData.dictLabel = '';
  616. this.formData.dictValue = '';
  617. return;
  618. }
  619. // 鉴定人
  620. if (key == 'identifyingPerson') {
  621. this.formData.identifyingPerson = '';
  622. this.formData.identifyingPersonId = '';
  623. return;
  624. }
  625. // 回收人
  626. if (key == 'recyclePerson') {
  627. this.formData.recyclePerson = '';
  628. this.formData.recyclePersonId = '';
  629. return;
  630. }
  631. this.formData[key] = '';
  632. },
  633. // 商品分类
  634. handleTabChangeType(e) {
  635. this.formData.type = e;
  636. this.$refs.addForm.validateField('type')
  637. },
  638. // 商品成色
  639. handleTabChangeProductCondition(e) {
  640. this.formData.productCondition = e;
  641. this.$refs.addForm.validateField('productCondition')
  642. },
  643. // 商品属性
  644. handleTabChangeProductAttribute(e) {
  645. this.formData.productAttribute = e;
  646. this.$refs.addForm.validateField('productAttribute')
  647. },
  648. // 是否入库
  649. handleTabChangeStockStatus(e) {
  650. this.formData.stockStatus = e;
  651. },
  652. // 回收类型
  653. handleTabChangeRecycleType(e) {
  654. this.formData.recycleType = e;
  655. },
  656. // 商品标签
  657. handleTabChangeLabel(e) {
  658. this.formData.label = e;
  659. },
  660. // 付款方式
  661. handlePayTypeTabChange(e) {
  662. this.formData.payType = e;
  663. },
  664. // 打开回收时间选择器
  665. clickRecycleTimeRow() {
  666. this.recycleTimeShow = true;
  667. },
  668. // 确认回收时间
  669. confirmRecycleTime(val) {
  670. this.$nextTick(() => {
  671. this.formData.recycleTime = this.$dayjs(val.value).format('YYYY-MM-DD');
  672. this.recycleTimeShow = false;
  673. })
  674. },
  675. // 关闭回收时间选择器
  676. closeRecycleTimePicker(val) {
  677. this.recycleTimeShow = false;
  678. },
  679. // 打开鉴定人选择器
  680. identifyingPersonClick() {
  681. this.$refs.identifyingPersonPickerRef.open();
  682. },
  683. // 选择鉴定人
  684. handleSelectIdentifyingPerson(info) {
  685. this.formData.identifyingPerson = info.label;
  686. this.formData.identifyingPersonId = info.id;
  687. },
  688. // 打开回收人选择器
  689. recyclePersonClick() {
  690. this.$refs.recyclePersonPickerRef.open();
  691. },
  692. // 选择回收人
  693. handleSelectRecyclePerson(info) {
  694. this.formData.recyclePerson = info.label;
  695. this.formData.recyclePersonId = info.id;
  696. },
  697. // 新增商品图片
  698. async afterReadGoodPic(event) {
  699. event.file.forEach(item => {
  700. uni.$u.api.uploadFile(item.url).then((res) => {
  701. this.formData.goodPicFileList.push(res.data.url);
  702. uni.$u.toast("文件上传成功");
  703. }).catch(() => {
  704. uni.$u.toast("上传文件失败");
  705. })
  706. })
  707. },
  708. // 获取删除商品图片信息
  709. getDeleteGoodPicInfo(info) {
  710. this.formData.goodPicFileList = info.newImages
  711. },
  712. // 获取删除细节图片信息
  713. getDeleteDetailPicInfo(info) {
  714. this.formData.detailPicFileList = info.newImages
  715. },
  716. // 新增细节图片
  717. async afterReadDetailPic(event) {
  718. event.file.forEach(item => {
  719. uni.$u.api.uploadFile(item.url).then((res) => {
  720. this.formData.detailPicFileList.push(res.data.url);
  721. uni.$u.toast("文件上传成功");
  722. }).catch(() => {
  723. uni.$u.toast("上传文件失败");
  724. })
  725. })
  726. },
  727. // 获取删除回收留底图信息
  728. getDeleteRecycleBottomPicInfo(info) {
  729. this.formData.recycleBottomFileList = info.newImages
  730. },
  731. // 新增回收留底图
  732. async afterReadRecycleBottom(event) {
  733. event.file.forEach(item => {
  734. uni.$u.api.uploadFile(item.url).then((res) => {
  735. this.formData.recycleBottomFileList.push(res.data.url);
  736. uni.$u.toast("文件上传成功");
  737. }).catch(() => {
  738. uni.$u.toast("上传文件失败");
  739. })
  740. })
  741. },
  742. // 删除商品保卡图片或独立编码照片留底
  743. getDeleteProductCardPicInfo(info) {
  744. this.formData.productCardPicFileList = info.newImages
  745. },
  746. // 新增商品保卡图片或独立编码照片留底
  747. async afterReadProductCardPic(event) {
  748. event.file.forEach(item => {
  749. uni.$u.api.uploadFile(item.url).then((res) => {
  750. this.formData.productCardPicFileList.push(res.data.url);
  751. uni.$u.toast("文件上传成功");
  752. }).catch(() => {
  753. uni.$u.toast("上传文件失败");
  754. })
  755. })
  756. },
  757. // 获取删除商品备注图片信息
  758. getDeleteProductDescPicInfo(info) {
  759. this.formData.productDescPicFileList = info.newImages
  760. },
  761. // 新增商品备注图片
  762. async afterReadProductDescPic(event) {
  763. event.file.forEach(item => {
  764. uni.$u.api.uploadFile(item.url).then((res) => {
  765. this.formData.productDescPicFileList.push(res.data.url);
  766. uni.$u.toast("文件上传成功");
  767. }).catch(() => {
  768. uni.$u.toast("上传文件失败");
  769. })
  770. })
  771. },
  772. async handlePasteRecognition(text) {
  773. // 品牌:浪琴
  774. // 来源:【麒麟】私信-杰3-3
  775. // 实价:6500
  776. // 型号:L2.257.5.89.7
  777. // 编码:52356065
  778. // 日期:2021-11-09
  779. // 备注:全套
  780. // 付款方式:微信
  781. if (!text) {
  782. return;
  783. }
  784. try {
  785. if (!text) return {};
  786. const result = {};
  787. // 支持中文冒号和英文冒号
  788. const lines = text.split(/[\n\r]+/);
  789. lines.forEach(line => {
  790. const lineStr = line.trim();
  791. if (!lineStr) return;
  792. // 尝试中文冒号
  793. let separatorIndex = lineStr.indexOf(':');
  794. // 如果没有中文冒号,尝试英文冒号
  795. if (separatorIndex === -1) {
  796. separatorIndex = lineStr.indexOf(':');
  797. }
  798. if (separatorIndex > 0) {
  799. const key = lineStr.substring(0, separatorIndex).trim();
  800. const value = lineStr.substring(separatorIndex + 1).trim();
  801. result[key] = value;
  802. }
  803. });
  804. if (result['品牌']) {
  805. this.formData.dictLabel = result['品牌'];
  806. }
  807. if (result['来源']) {
  808. this.formData.origin = result['来源'];
  809. }
  810. if (result['实价']) {
  811. this.formData.costPrice = result['实价'];
  812. }
  813. if (result['型号']) {
  814. this.formData.model = result['型号'];
  815. }
  816. if (result['编码']) {
  817. this.formData.indentifyCode = result['编码'];
  818. }
  819. if (result['日期']) {
  820. this.formData.recycleTime = result['日期'];
  821. }
  822. if (result['备注']) {
  823. this.formData.productDesc = result['备注'];
  824. }
  825. if (result['付款方式']) {
  826. this.getPaymentType(result['付款方式'])
  827. this.formData.payType = result['付款方式'];
  828. }
  829. // return result;
  830. } catch (e) {
  831. uni.$u.toast("文本识别异常");
  832. }
  833. },
  834. // 清空识别内容
  835. clearRecognitionContent() {
  836. this.recognitionContent = '';
  837. },
  838. // 识别内容 回显付款方式
  839. getPaymentType(val) {
  840. let arr = []
  841. this.paymentTabList.filter(item => {
  842. if (item.name == val) arr.push(item.value)
  843. })
  844. if (arr.length > 0) {
  845. this.payTypeEcho = arr[0]
  846. }
  847. }
  848. }
  849. }
  850. </script>
  851. <style lang="scss" scoped>
  852. @import '../styles/edit.scss';
  853. </style>