details.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <view class="container qualifications" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0' }">
  3. <view class="remarks-content">
  4. <view class="list-view-title"> <view class="list-view-h1">文字备注</view> </view>
  5. <view class="remarks-textarea"> {{ remarksParams.note }} </view>
  6. <view class="list-view-title"> <view class="list-view-h1">上传图片</view> </view>
  7. <view class="list-view-upload clearfix">
  8. <view class="photo-item" v-for="(image, imageIndex) in remarksParams.imageList" :key="imageIndex">
  9. <image
  10. :src="image"
  11. mode="aspectFill"
  12. @click.stop="previewImg(remarksParams.imageList, imageIndex)"
  13. ></image>
  14. </view>
  15. </view>
  16. <view class="list-view-title"> <view class="list-view-h1">上传文件</view> </view>
  17. <view class="list-view" v-for="(file, fileIndex) in remarksParams.fileList" :key="fileIndex">
  18. <view class="list-view-text">
  19. <view class="input">{{ file.name }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import { mapState, mapMutations } from 'vuex'
  27. import authorize from '@/common/config/authorize.js'
  28. import { uploadFileImage, uploadFilePdfDocDocx } from '@/services/public.js'
  29. var isPreviewImg
  30. export default {
  31. data() {
  32. return {
  33. isIphoneX: this.$store.state.isIphoneX,
  34. shopOrderId: 0,
  35. logisticsBatchId: 0,
  36. productActions: [],
  37. remarksParams: {
  38. note:
  39. '本期采美网给大家带来重磅消息:中国医美知名上游品牌半岛医疗正式入驻采美啦!!!本期采美网给大家带来重磅消息:中国医美知名上游品牌半岛医疗正式入驻采美啦!!!本期采美网给大家带来重磅消息:中国医美知名上游品牌半岛医疗正式入驻采美啦!!!本期采美网给大家带来重磅消息:中国医美知名上游品牌半岛医疗正式入驻采美啦!!!本期采美网给大家带来重磅消息:中国医美知名上游品牌半岛医疗正式入驻采美啦!!!本期采美网给大家带来重磅消息:中国医美知名上游品牌半岛医疗正式入驻采美啦!!!本期采美网给大家带来重磅消息:中国医美知名上游品牌半岛医疗正式入驻采美啦!!!本期采美网给大家带来重磅消息本期采美网给大家带来重磅消息本期采美网给大家带来重磅消息本期采美网给大家带来重磅消息本期采美网给大家带来重磅消息本期采美网给大家带来重磅消息:中国医美知名上游品牌半岛医疗正式入驻采美啦!!!',
  40. fileList: [
  41. {
  42. name: '任正非:除了胜利,我们已无路可走.pdf',
  43. },
  44. {
  45. name: '任正非:除了胜利,我们已无路可走.pdf',
  46. },
  47. {
  48. name: '任正非:除了胜利,我们已无路可走.pdf',
  49. },
  50. {
  51. name: '任正非:除了胜利,我们已无路可走.pdf',
  52. },
  53. ],
  54. imageList: [
  55. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
  56. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
  57. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
  58. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
  59. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
  60. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
  61. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
  62. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
  63. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
  64. 'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png'
  65. ]
  66. },
  67. min: 0,
  68. max: 500
  69. }
  70. },
  71. onLoad(option) {
  72. console.log(option)
  73. if (option.type == 'add') {
  74. this.logisticsBatchId = option.logisticsBatchId
  75. this.shopOrderId = option.shopOrderId
  76. this.GetSupplierLogisticsRecord()
  77. } else {
  78. this.logisticsBatchId = option.logisticsBatchId
  79. this.shopOrderId = option.shopOrderId
  80. this.GetSupplierLogisticsRecord()
  81. this.GetSupplierQualificationData()
  82. }
  83. },
  84. methods: {
  85. ...mapMutations(['login']),
  86. GetSupplierQualificationData() {
  87. //编辑回显商品资质信息
  88. this.ShopService.GetSupplierQualificationData({
  89. logisticsBatchId: this.logisticsBatchId
  90. })
  91. .then(response => {
  92. const data = response.data
  93. if (data && data.length > 0) {
  94. this.qualificationsList = data
  95. this.isEmpty = false
  96. } else {
  97. this.isEmpty = true
  98. }
  99. })
  100. .catch(error => {
  101. this.$util.msg(error.msg, 2000)
  102. })
  103. },
  104. GetSupplierLogisticsRecord() {
  105. //添加商品资质初始化查询商品信息
  106. this.ShopService.GetSupplierLogisticsRecord({
  107. logisticsBatchId: this.logisticsBatchId
  108. })
  109. .then(response => {
  110. const data = response.data
  111. data.forEach((el, index) => {
  112. let obj = {
  113. value: el.id,
  114. name: el.productName
  115. }
  116. this.productActions.push(obj)
  117. })
  118. })
  119. .catch(error => {
  120. this.$util.msg(error.msg, 2000)
  121. })
  122. },
  123. editButtonConfim() {
  124. //确定
  125. // 校验物流公司不能为空
  126. let isRecordId = false
  127. let isSnCode = false
  128. let isFileList = false
  129. let isImageList = false
  130. let params = [] //参数
  131. this.qualificationsList.forEach((el, index) => {
  132. if (el.recordId == '') {
  133. isRecordId = true
  134. }
  135. if (el.sn == '') {
  136. isSnCode = true
  137. }
  138. if (el.fileList == '') {
  139. isFileList = true
  140. }
  141. if (el.imageList == '') {
  142. isImageList = true
  143. }
  144. let paramsObject = {
  145. recordId: el.recordId,
  146. sn: el.sn,
  147. files: el.fileList,
  148. images: el.imageList
  149. }
  150. params.push(paramsObject)
  151. })
  152. if (isRecordId) {
  153. this.$util.msg('请选择商品', 2000)
  154. return
  155. }
  156. if (isSnCode) {
  157. this.$util.msg('请输入商品SN码', 2000)
  158. return
  159. }
  160. if (isFileList && isImageList) {
  161. this.$util.msg('请上传商品资质文件', 2000)
  162. return
  163. }
  164. console.log('params========>', params)
  165. this.ShopService.GetSupplierQualificationUpdata({
  166. params: JSON.stringify(params)
  167. })
  168. .then(response => {
  169. this.$util.msg('保存成功', 3000, true, 'success')
  170. setTimeout(() => {
  171. this.$api.navigateTo(`/pages/supplier/deliver/deliver-record?shopOrderId=${this.shopOrderId}`)
  172. }, 2000)
  173. })
  174. .catch(error => {
  175. this.$util.msg(error.msg, 2000)
  176. })
  177. },
  178. bindPickerChange: function(item, e) {
  179. //选择筛选条件
  180. item.recordId = this.productActions[e.target.value].value
  181. item.productName = this.productActions[e.target.value].name
  182. },
  183. addListFn() {
  184. //添加
  185. let obj = {
  186. productName: '',
  187. recordId: '',
  188. sn: '',
  189. fileList: [],
  190. imageList: []
  191. }
  192. this.qualificationsList.push(obj)
  193. },
  194. deleteLogistItemFn(item, index) {
  195. this.$util.modal('提示', '确认删除物流信息吗?', '确定', '取消', true, () => {
  196. this.qualificationsList.splice(index, 1)
  197. })
  198. },
  199. uploadFile(array) {
  200. //上传资质文件
  201. console.log(array)
  202. uploadFilePdfDocDocx().then(res => {
  203. let data = JSON.parse(res.data).data
  204. let obj = {
  205. fileName: uni.getStorageSync('fileName'),
  206. ossName: data.ossName
  207. }
  208. array.push(obj)
  209. console.log('array', array)
  210. })
  211. },
  212. uploadPhotoFn(array) {
  213. //添加图片
  214. uploadFileImage().then(res => {
  215. array.push(JSON.parse(res.data).data)
  216. })
  217. },
  218. deleteFileFn(array, index) {
  219. //删除文件
  220. this.UploadService.PostFileDelete({
  221. ossName: array[index].ossName
  222. })
  223. .then(res => {
  224. array.splice(index, 1)
  225. })
  226. .catch(error => {
  227. console.log('删除文件异常提示===>', error.msg)
  228. })
  229. },
  230. deletePhotoFn(array, index) {
  231. //删除图片
  232. array.splice(index, 1)
  233. },
  234. previewImg(image, index) {
  235. //顶部商品图片预览
  236. isPreviewImg = true
  237. let previewUrls = image
  238. uni.previewImage({
  239. current: index, //图片索引
  240. urls: previewUrls, //必须是http图片,本地图片无效
  241. longPressActions: ''
  242. })
  243. },
  244. conInput(e) {
  245. //备注文字字数限制
  246. let value = e.detail.value
  247. let len = parseInt(value.length)
  248. if (len > this.max) return
  249. this.min = len
  250. if (this.min == 200) {
  251. this.$util.msg('您输入的字数已达上限', 2000)
  252. }
  253. }
  254. },
  255. onShow() {}
  256. }
  257. </script>
  258. <style lang="scss">
  259. page {
  260. height: auto;
  261. background: #ffffff;
  262. }
  263. .remarks-content {
  264. width: 100%;
  265. height: auto;
  266. box-sizing: border-box;
  267. padding: 0 24rpx;
  268. .list-view-title {
  269. width: 100%;
  270. height: auto;
  271. margin-bottom: 16rpx;
  272. margin-top: 40rpx;
  273. .list-view-h1 {
  274. line-height: 40rpx;
  275. font-size: $font-size-28;
  276. color: #333333;
  277. text-align: left;
  278. }
  279. }
  280. .remarks-textarea {
  281. width: 100%;
  282. height: 340rpx;
  283. padding: 16rpx;
  284. margin: 20rpx 0 0 0;
  285. border-radius: 6rpx;
  286. position: relative;
  287. border: 1px solid #b2b2b2;
  288. box-sizing: border-box;
  289. overflow-y: scroll;
  290. line-height: 38rpx;
  291. font-size: $font-size-26;
  292. color: #333333;
  293. }
  294. .list-view {
  295. width: 100%;
  296. height: auto;
  297. margin-top: 20rpx;
  298. .list-view-text {
  299. width: 100%;
  300. float: left;
  301. .input {
  302. width: 560rpx;
  303. height: 50rpx;
  304. box-sizing: border-box;
  305. line-height: 50rpx;
  306. color: #333333;
  307. text-overflow: ellipsis;
  308. overflow: hidden;
  309. display: -webkit-box;
  310. -webkit-line-clamp: 1;
  311. line-clamp: 1;
  312. -webkit-box-orient: vertical;
  313. float: left;
  314. font-size: 26rpx;
  315. }
  316. }
  317. }
  318. .list-view-upload {
  319. width: 100%;
  320. height: auto;
  321. .photo-item {
  322. display: inline-block;
  323. width: 112rpx;
  324. height: 112rpx;
  325. margin: 10rpx 0;
  326. margin-right: 25rpx;
  327. border-radius: 10rpx;
  328. border: 1px solid #f5f5f5;
  329. position: relative;
  330. float: left;
  331. image {
  332. width: 112rpx;
  333. height: 112rpx;
  334. border-radius: 10rpx;
  335. }
  336. }
  337. .photo-list {
  338. width: 100%;
  339. height: 116rpx;
  340. overflow: hidden;
  341. white-space: nowrap;
  342. display: flex;
  343. align-items: flex-start;
  344. }
  345. }
  346. }
  347. </style>