edit.vue 48 KB

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