qualifications-add.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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.name" 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.code" 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, index) in item.imageList" :key="index">
  45. <image :src="image" mode="aspectFill" @click.stop="previewImg(item.imageList,index)"></image>
  46. <text class="iconfont icon-iconfontguanbi" @click.stop="deletePhotoFn(item.imageList,index)"></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">暂不填写</view>
  62. <view class="edit-button">确定</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. productActions:[
  76. {
  77. id:1,
  78. name:'asdasdasM22'
  79. },
  80. {
  81. id:2,
  82. name:'奥术大师大所打M22'
  83. },
  84. {
  85. id:3,
  86. name:'美国第六代光子多功能智能平台M22'
  87. },
  88. ],
  89. qualificationsList:[
  90. {
  91. name:'美国第六代光子多功能智能平台M22',
  92. code:'SN2562659874565',
  93. fileList:[
  94. {
  95. fileName:'深圳市和创元文件.pdf',
  96. ossName:'深圳市和创元文件.pdf'
  97. }
  98. ],
  99. imageList:[
  100. 'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2306696130,3636777462&fm=26&gp=0.jpg'
  101. ]
  102. }
  103. ]
  104. }
  105. },
  106. onLoad(option) {
  107. },
  108. methods:{
  109. ...mapMutations(['login']),
  110. initGetLogisticsInfo(){
  111. this.ShopService.GetLogisticsInfo({ logisticsBatchId : this.logisticsBatchId, shopOrderId:this.info.shopOrderId }).then(response =>{
  112. const data = response.data.logisticsBatch
  113. if(data.remarkImages!=null){
  114. this.photoLists = data.remarkImages
  115. }else{
  116. this.photoLists =[]
  117. }
  118. this.info.note = data.remark
  119. }).catch(error =>{
  120. this.$util.msg(error.msg,2000);
  121. })
  122. },
  123. bindPickerChange: function(item,e) {//选择筛选条件
  124. item.name = this.productActions[e.target.value].name
  125. },
  126. addListFn(){//添加
  127. let obj ={
  128. name:'',
  129. code:'',
  130. fileList:[],
  131. imageList:[],
  132. };
  133. this.qualificationsList.push(obj)
  134. },
  135. deleteLogistItemFn(item,index){
  136. this.$util.modal('提示','确认删除物流信息吗?','确定','取消',true,() =>{
  137. this.qualificationsList.splice(index, 1);
  138. })
  139. },
  140. uploadFile(array){//上传资质文件
  141. console.log(array)
  142. uploadFilePdf().then(res =>{
  143. let data = JSON.parse(res.data).data
  144. let obj = {
  145. fileName:uni.getStorageSync('fileName'),
  146. ossName:data.ossName
  147. }
  148. array.push(obj)
  149. console.log('array',array)
  150. })
  151. },
  152. uploadPhotoFn(array){//添加图片
  153. uploadFileImage().then(res =>{
  154. array.push(JSON.parse(res.data).data)
  155. })
  156. },
  157. deleteFileFn(array,index){//删除文件
  158. this.UploadService.PostFileDelete(
  159. {
  160. ossName:array[index].ossName,
  161. }
  162. )
  163. .then(res=>{
  164. array.splice(index, 1);
  165. })
  166. .catch(error =>{
  167. console.log('删除文件异常提示===>',error.msg)
  168. })
  169. },
  170. deletePhotoFn(array,index){//删除图片
  171. array.splice(index, 1);
  172. },
  173. previewImg (image,index) {//顶部商品图片预览
  174. isPreviewImg = true
  175. let previewUrls = image
  176. uni.previewImage({
  177. current: index, //图片索引
  178. urls: previewUrls, //必须是http图片,本地图片无效
  179. longPressActions:''
  180. })
  181. },
  182. },
  183. onShow() {
  184. }
  185. }
  186. </script>
  187. <style lang="scss">
  188. page {
  189. height: auto;
  190. background:#F7F7F7;
  191. }
  192. .qualifications-title{
  193. width: 100%;
  194. height: 72rpx;
  195. line-height: 72rpx;
  196. font-size: $font-size-24;
  197. background-image: linear-gradient(270deg, #ffffff 0%, rgba(225,86,22,0.1) 51%, #ffffff 100%);
  198. color: $color-system;
  199. text-align: center;
  200. }
  201. .qualifications-content{
  202. width: 100%;
  203. height: auto;
  204. .list{
  205. width: 100%;
  206. height: auto;
  207. background-color: #FFFFFF;
  208. box-sizing: border-box;
  209. margin-bottom: 20rpx;
  210. padding: 0 24rpx;
  211. .list-view-title{
  212. width: 100%;
  213. height: 92rpx;
  214. border-bottom: 1px solid #E1E1E1;
  215. line-height: 92rpx;
  216. font-size: $font-size-30;
  217. color: #333333;
  218. text-align: left;
  219. .title-left{
  220. float: left;
  221. }
  222. .title-right{
  223. float: right;
  224. color: $color-system;
  225. font-size: $font-size-24;
  226. }
  227. &.none{
  228. border-bottom: none;
  229. }
  230. .none{
  231. color: #666666;
  232. }
  233. }
  234. .list-view{
  235. width: 100%;
  236. height: 92rpx;
  237. border-bottom: 1px solid #E1E1E1;
  238. line-height: 92rpx;
  239. font-size: $font-size-30;
  240. .list-view-label{
  241. width: 192rpx;
  242. color: #666666;
  243. float: left;
  244. }
  245. .list-view-text{
  246. width: 510rpx;
  247. float: right;
  248. position: relative;
  249. .input{
  250. width: 510rpx;
  251. height: 92rpx;
  252. box-sizing: border-box;
  253. line-height: 92rpx;
  254. color: #333333;
  255. text-overflow: ellipsis;
  256. overflow: hidden;
  257. display: -webkit-box;
  258. -webkit-line-clamp: 1;
  259. line-clamp: 1;
  260. -webkit-box-orient: vertical;
  261. padding-right: 40rpx;
  262. }
  263. .icon-xiayibu{
  264. width: 40rpx;
  265. height: 80rpx;
  266. display: block;
  267. position: absolute;
  268. right: 0;
  269. top: 0;
  270. font-size: $font-size-32;
  271. color: #B2B2B2;
  272. text-align: center;
  273. }
  274. .icon-iconfontguanbi{
  275. width: 40rpx;
  276. height: 40rpx;
  277. border-radius: 50%;
  278. background-color: #f94b4b;
  279. display: block;
  280. position: absolute;
  281. right: 0;
  282. top: 28rpx;
  283. font-size: $font-size-24;
  284. color: #FFFFFF;
  285. line-height: 40rpx;
  286. text-align: center;
  287. }
  288. .list-view-file{
  289. width: 88rpx;
  290. height: 44rpx;
  291. line-height: 44rpx;
  292. font-size: $font-size-20;
  293. text-align: center;
  294. color: #FFFFFF;
  295. background-color: $color-system;
  296. border-radius: 4rpx;
  297. position: absolute;
  298. right: 0;
  299. top: 25rpx;
  300. }
  301. }
  302. }
  303. .list-view-upload{
  304. width: 100%;
  305. height: auto;
  306. padding: 10rpx 0;
  307. .photo-item{
  308. display: inline-block;
  309. width: 112rpx;
  310. height: 112rpx;
  311. margin: 10rpx 0;
  312. margin-right: 25rpx;
  313. border-radius: 10rpx;
  314. border:1px solid #F5F5F5;
  315. position: relative;
  316. float: left;
  317. &.add{
  318. width: 112rpx;
  319. height: 112rpx;
  320. border-color: #b2b2b2;
  321. text-align: center;
  322. line-height: 112rpx;
  323. margin-right: 0rpx;
  324. .icon-jiahao{
  325. font-size: $font-size-44;
  326. color:#b2b2b2 ;
  327. font-weight: bold;
  328. }
  329. }
  330. .icon-iconfontguanbi{
  331. width: 30rpx;
  332. height: 30rpx;
  333. border-radius:50%;
  334. display: block;
  335. position: absolute;
  336. right: -10rpx;
  337. top: -10rpx;
  338. background: #f94b4b;
  339. text-align: center;
  340. line-height: 30rpx;
  341. color: #FFFFFF;
  342. font-size: $font-size-22;
  343. }
  344. image{
  345. width: 112rpx;
  346. height: 112rpx;
  347. border-radius: 10rpx;
  348. }
  349. }
  350. .photo-list{
  351. width: 100%;
  352. height: 116rpx;
  353. overflow: hidden;
  354. white-space: nowrap;
  355. display: flex;
  356. align-items: flex-start;
  357. }
  358. .scoll-wrapper{
  359. display:flex;
  360. align-items: flex-start;
  361. }
  362. }
  363. }
  364. .list-btn{
  365. width: 702rpx;
  366. height: 56rpx;
  367. margin: 0 auto;
  368. .btn{
  369. width: 236rpx;
  370. height: 56rpx;
  371. border-radius: 28rpx;
  372. border: 1px solid $color-system;
  373. line-height: 56rpx;
  374. text-align: center;
  375. color: $color-system;
  376. margin: 0 auto;
  377. }
  378. }
  379. }
  380. .qualifications-btn{
  381. width: 100%;
  382. padding-top: 20rpx;
  383. position: fixed;
  384. bottom: 0;
  385. left: 0;
  386. background-color: #FFFFFF;
  387. .edit-button-canel{
  388. width: 100%;
  389. height: 88rpx;
  390. line-height: 88rpx;
  391. text-align: center;
  392. color: #e15616;
  393. font-size: $font-size-24;
  394. }
  395. .edit-button{
  396. width: 600rpx;
  397. height: 90rpx;
  398. background: $btn-confirm;
  399. line-height: 90rpx;
  400. text-align: center;
  401. color: #FFFFFF;
  402. font-size: $font-size-30;
  403. margin: 0 auto;
  404. border-radius: 45rpx;
  405. }
  406. }
  407. </style>