edit.vue 43 KB

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