qualifications-add.vue 10.0 KB

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