edit.vue 45 KB

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