qualifications-add.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <view class="container qualifications" :style="{paddingBottom :isIphoneX ? (218+68)+'rpx' : '218rpx'}">
  3. <view class="qualifications-title">
  4. 若发货商品内存在仪器类商品,建议填写下列商品信息再发货
  5. </view>
  6. <view class="qualifications-content">
  7. <view class="list" v-for="(item,index) in qualificationsList" :key="index">
  8. <view class="list-view-title">
  9. <view class="title-left">商品{{ index+1 }}</view>
  10. <view class="title-right" v-if="(index+1) > 1" @click="deleteLogistItemFn(item,index)">
  11. 删除商品
  12. </view>
  13. </view>
  14. <view class="list-view">
  15. <view class="list-view-label">商品</view>
  16. <view class="list-view-text">
  17. <picker @change="bindPickerChange(item,$event)" :value="index" :range="productActions" range-key="name">
  18. <input class="input" type="text" v-model="item.productName" placeholder="请选择商品" disabled="true">
  19. <text class="iconfont icon-xiayibu"></text>
  20. </picker>
  21. </view>
  22. </view>
  23. <view class="list-view">
  24. <view class="list-view-label">SN码</view>
  25. <view class="list-view-text">
  26. <input class="input" type="text" v-model="item.sn" placeholder="请输入商品SN码">
  27. </view>
  28. </view>
  29. <view class="list-view" v-for="(file,fileIndex) in item.fileList" :key="fileIndex">
  30. <view class="list-view-label">资质文件</view>
  31. <view class="list-view-text">
  32. <view class="input">{{ file.fileName }}</view>
  33. <text class="iconfont icon-iconfontguanbi" @click.stop="deleteFileFn(item.fileList,index)"></text>
  34. </view>
  35. </view>
  36. <view class="list-view" >
  37. <view class="list-view-label">资质文件</view>
  38. <view class="list-view-text">
  39. <view class="list-view-file" @click="uploadFile(item.fileList)">上传</view>
  40. </view>
  41. </view>
  42. <view class="list-view-title none">图片<text class="none">(若不方便上传文件,可用图片代替)</text></view>
  43. <view class="list-view-upload clearfix">
  44. <view class="photo-item" v-for="(image, imageIndex) in item.imageList" :key="index">
  45. <image :src="image" mode="aspectFill" @click.stop="previewImg(item.imageList,imageIndex)"></image>
  46. <text class="iconfont icon-iconfontguanbi" @click.stop="deletePhotoFn(item.imageList,imageIndex)"></text>
  47. </view>
  48. <view class="photo-item add" @click.stop="uploadPhotoFn(item.imageList)" v-if="item.imageList.length<10 || item.imageList.length == 0">
  49. <text class="iconfont icon-jiahao"></text>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="list-btn" v-if="qualificationsList.length < productActions.length">
  54. <view class="btn add-btn" @click="addListFn">
  55. <text class="iconfont icon-jiahao"></text>
  56. <text>添加商品</text>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="qualifications-btn" :style="{paddingBottom :isIphoneX ? '68rpx' : '0'}">
  61. <view class="edit-button-canel" @click="editButtonCanel">暂不填写</view>
  62. <view class="edit-button" @click="editButtonConfim">确定</view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import { mapState,mapMutations } from 'vuex'
  68. import authorize from '@/common/config/authorize.js'
  69. import { uploadFileImage , uploadFilePdf } from "@/services/public.js"
  70. var isPreviewImg;
  71. export default{
  72. data() {
  73. return{
  74. isIphoneX:this.$store.state.isIphoneX,
  75. shopOrderId:0,
  76. logisticsBatchId:0,
  77. productActions:[],
  78. qualificationsList:[
  79. {
  80. name:'',
  81. recordId:'',
  82. sn:'',
  83. fileList:[],
  84. imageList:[
  85. 'https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1194131577,2954769920&fm=26&gp=0.jpg',
  86. 'https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1194131577,2954769920&fm=26&gp=0.jpg'
  87. ]
  88. }
  89. ]
  90. }
  91. },
  92. onLoad(option) {
  93. console.log(option)
  94. if(option.type == 'add'){
  95. this.logisticsBatchId = option.logisticsBatchId
  96. this.shopOrderId = option.shopOrderId
  97. this.GetSupplierLogisticsRecord()
  98. }else{
  99. this.logisticsBatchId = option.logisticsBatchId
  100. this.shopOrderId = option.shopOrderId
  101. this.GetSupplierLogisticsRecord()
  102. this.GetSupplierQualificationData()
  103. }
  104. },
  105. methods:{
  106. ...mapMutations(['login']),
  107. GetSupplierQualificationData(){//编辑回显商品资质信息
  108. this.ShopService.GetSupplierQualificationData(
  109. {
  110. logisticsBatchId : this.logisticsBatchId ,
  111. }
  112. )
  113. .then(response =>{
  114. const data = response.data
  115. if(data && data.length > 0){
  116. this.qualificationsList = data
  117. this.isEmpty = false
  118. }else{
  119. this.isEmpty = true
  120. }
  121. })
  122. .catch(error =>{
  123. this.$util.msg(error.msg,2000);
  124. })
  125. },
  126. GetSupplierLogisticsRecord(){//添加商品资质初始化查询商品信息
  127. this.ShopService.GetSupplierLogisticsRecord(
  128. {
  129. logisticsBatchId : this.logisticsBatchId
  130. }
  131. )
  132. .then(response =>{
  133. const data = response.data
  134. data.forEach((el,index) => {
  135. let obj = {
  136. value : el.id,
  137. name : el.productName
  138. }
  139. this.productActions.push(obj)
  140. })
  141. })
  142. .catch(error =>{
  143. this.$util.msg(error.msg,2000);
  144. })
  145. },
  146. editButtonConfim(){//确定
  147. let params = [];
  148. this.qualificationsList.forEach((el,index) => {
  149. let obj = {
  150. recordId : el.recordId,
  151. sn : el.sn,
  152. files : el.fileList,
  153. images : el.imageList
  154. }
  155. params.push(obj)
  156. })
  157. this.ShopService.GetSupplierQualificationUpdata(
  158. {
  159. params:JSON.stringify(params)
  160. }
  161. )
  162. .then(response =>{
  163. this.$util.msg('保存成功',2000);
  164. setTimeout(()=>{
  165. this.$api.navigateTo(`/supplier/pages/deliver/deliver-record?shopOrderId=${this.shopOrderId}`)
  166. },2000)
  167. })
  168. .catch(error =>{
  169. this.$util.msg(error.msg,2000);
  170. })
  171. },
  172. bindPickerChange: function(item,e) {//选择筛选条件
  173. item.recordId = this.productActions[e.target.value].value
  174. item.productName = this.productActions[e.target.value].name
  175. },
  176. addListFn(){//添加
  177. let obj ={
  178. name:'',
  179. recordId:'',
  180. sn:'',
  181. files:[],
  182. images:[
  183. 'https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1194131577,2954769920&fm=26&gp=0.jpg',
  184. 'https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1194131577,2954769920&fm=26&gp=0.jpg'
  185. ]
  186. };
  187. this.qualificationsList.push(obj)
  188. },
  189. deleteLogistItemFn(item,index){
  190. this.$util.modal('提示','确认删除物流信息吗?','确定','取消',true,() =>{
  191. this.qualificationsList.splice(index, 1);
  192. })
  193. },
  194. uploadFile(array){//上传资质文件
  195. console.log(array)
  196. uploadFilePdf().then(res =>{
  197. let data = JSON.parse(res.data).data
  198. let obj = {
  199. fileName:uni.getStorageSync('fileName'),
  200. ossName:data.ossName
  201. }
  202. array.push(obj)
  203. console.log('array',array)
  204. })
  205. },
  206. uploadPhotoFn(array){//添加图片
  207. uploadFileImage().then(res =>{
  208. array.push(JSON.parse(res.data).data)
  209. })
  210. },
  211. deleteFileFn(array,index){//删除文件
  212. this.UploadService.PostFileDelete(
  213. {
  214. ossName:array[index].ossName,
  215. }
  216. )
  217. .then(res=>{
  218. array.splice(index, 1);
  219. })
  220. .catch(error =>{
  221. console.log('删除文件异常提示===>',error.msg)
  222. })
  223. },
  224. deletePhotoFn(array,index){//删除图片
  225. array.splice(index, 1);
  226. },
  227. previewImg (image,index) {//顶部商品图片预览
  228. isPreviewImg = true
  229. let previewUrls = image
  230. uni.previewImage({
  231. current: index, //图片索引
  232. urls: previewUrls, //必须是http图片,本地图片无效
  233. longPressActions:''
  234. })
  235. },
  236. editButtonCanel(){
  237. this.$api.navigateTo(`/supplier/pages/deliver/deliver-record?shopOrderId=${this.shopOrderId}`)
  238. },
  239. },
  240. onShow() {
  241. }
  242. }
  243. </script>
  244. <style lang="scss">
  245. page {
  246. height: auto;
  247. background:#F7F7F7;
  248. }
  249. .qualifications-title{
  250. width: 100%;
  251. height: 72rpx;
  252. line-height: 72rpx;
  253. font-size: $font-size-24;
  254. background-image: linear-gradient(270deg, #ffffff 0%, rgba(225,86,22,0.1) 51%, #ffffff 100%);
  255. color: $color-system;
  256. text-align: center;
  257. }
  258. .qualifications-content{
  259. width: 100%;
  260. height: auto;
  261. .list{
  262. width: 100%;
  263. height: auto;
  264. background-color: #FFFFFF;
  265. box-sizing: border-box;
  266. margin-bottom: 20rpx;
  267. padding: 0 24rpx;
  268. .list-view-title{
  269. width: 100%;
  270. height: 92rpx;
  271. border-bottom: 1px solid #E1E1E1;
  272. line-height: 92rpx;
  273. font-size: $font-size-30;
  274. color: #333333;
  275. text-align: left;
  276. .title-left{
  277. float: left;
  278. }
  279. .title-right{
  280. float: right;
  281. color: $color-system;
  282. font-size: $font-size-24;
  283. }
  284. &.none{
  285. border-bottom: none;
  286. }
  287. .none{
  288. color: #666666;
  289. }
  290. }
  291. .list-view{
  292. width: 100%;
  293. height: 92rpx;
  294. border-bottom: 1px solid #E1E1E1;
  295. line-height: 92rpx;
  296. font-size: $font-size-30;
  297. .list-view-label{
  298. width: 192rpx;
  299. color: #666666;
  300. float: left;
  301. }
  302. .list-view-text{
  303. width: 510rpx;
  304. float: right;
  305. position: relative;
  306. .input{
  307. width: 510rpx;
  308. height: 92rpx;
  309. box-sizing: border-box;
  310. line-height: 92rpx;
  311. color: #333333;
  312. text-overflow: ellipsis;
  313. overflow: hidden;
  314. display: -webkit-box;
  315. -webkit-line-clamp: 1;
  316. line-clamp: 1;
  317. -webkit-box-orient: vertical;
  318. padding-right: 40rpx;
  319. }
  320. .icon-xiayibu{
  321. width: 40rpx;
  322. height: 80rpx;
  323. display: block;
  324. position: absolute;
  325. right: 0;
  326. top: 0;
  327. font-size: $font-size-32;
  328. color: #B2B2B2;
  329. text-align: center;
  330. }
  331. .icon-iconfontguanbi{
  332. width: 40rpx;
  333. height: 40rpx;
  334. border-radius: 50%;
  335. background-color: #f94b4b;
  336. display: block;
  337. position: absolute;
  338. right: 0;
  339. top: 28rpx;
  340. font-size: $font-size-24;
  341. color: #FFFFFF;
  342. line-height: 40rpx;
  343. text-align: center;
  344. }
  345. .list-view-file{
  346. width: 88rpx;
  347. height: 44rpx;
  348. line-height: 44rpx;
  349. font-size: $font-size-20;
  350. text-align: center;
  351. color: #FFFFFF;
  352. background-color: $color-system;
  353. border-radius: 4rpx;
  354. position: absolute;
  355. right: 0;
  356. top: 25rpx;
  357. }
  358. }
  359. }
  360. .list-view-upload{
  361. width: 100%;
  362. height: auto;
  363. padding: 10rpx 0;
  364. .photo-item{
  365. display: inline-block;
  366. width: 112rpx;
  367. height: 112rpx;
  368. margin: 10rpx 0;
  369. margin-right: 25rpx;
  370. border-radius: 10rpx;
  371. border:1px solid #F5F5F5;
  372. position: relative;
  373. float: left;
  374. &.add{
  375. width: 112rpx;
  376. height: 112rpx;
  377. border-color: #b2b2b2;
  378. text-align: center;
  379. line-height: 112rpx;
  380. margin-right: 0rpx;
  381. .icon-jiahao{
  382. font-size: $font-size-44;
  383. color:#b2b2b2 ;
  384. font-weight: bold;
  385. }
  386. }
  387. .icon-iconfontguanbi{
  388. width: 30rpx;
  389. height: 30rpx;
  390. border-radius:50%;
  391. display: block;
  392. position: absolute;
  393. right: -10rpx;
  394. top: -10rpx;
  395. background: #f94b4b;
  396. text-align: center;
  397. line-height: 30rpx;
  398. color: #FFFFFF;
  399. font-size: $font-size-22;
  400. }
  401. image{
  402. width: 112rpx;
  403. height: 112rpx;
  404. border-radius: 10rpx;
  405. }
  406. }
  407. .photo-list{
  408. width: 100%;
  409. height: 116rpx;
  410. overflow: hidden;
  411. white-space: nowrap;
  412. display: flex;
  413. align-items: flex-start;
  414. }
  415. .scoll-wrapper{
  416. display:flex;
  417. align-items: flex-start;
  418. }
  419. }
  420. }
  421. .list-btn{
  422. width: 702rpx;
  423. height: 56rpx;
  424. margin: 0 auto;
  425. .btn{
  426. width: 236rpx;
  427. height: 56rpx;
  428. border-radius: 28rpx;
  429. border: 1px solid $color-system;
  430. line-height: 56rpx;
  431. text-align: center;
  432. color: $color-system;
  433. margin: 0 auto;
  434. }
  435. }
  436. }
  437. .qualifications-btn{
  438. width: 100%;
  439. padding-top: 20rpx;
  440. position: fixed;
  441. bottom: 0;
  442. left: 0;
  443. background-color: #FFFFFF;
  444. .edit-button-canel{
  445. width: 100%;
  446. height: 88rpx;
  447. line-height: 88rpx;
  448. text-align: center;
  449. color: #e15616;
  450. font-size: $font-size-24;
  451. }
  452. .edit-button{
  453. width: 600rpx;
  454. height: 90rpx;
  455. background: $btn-confirm;
  456. line-height: 90rpx;
  457. text-align: center;
  458. color: #FFFFFF;
  459. font-size: $font-size-30;
  460. margin: 0 auto;
  461. border-radius: 45rpx;
  462. }
  463. }
  464. </style>