correction.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="content">
  3. <homenav :iStatusBarHeight="iStatusBarHeight" :title="'纠错'"></homenav>
  4. <view class="box">
  5. <view class="line">
  6. <view class="lineTitle">纠错类型</view>
  7. <view class="lineCont" v-if="optdata.type==1">VIN解析纠错</view>
  8. <view class="lineCont" v-if="optdata.type==2">匹配关系纠错</view>
  9. </view>
  10. <view class="line" v-if="optdata.type==1">
  11. <view class="lineTitle">VIN</view>
  12. <view class="lineCont">{{jcData.vin}}</view>
  13. </view>
  14. <view class="line">
  15. <view class="lineTitle">车型</view>
  16. <view class="lineCont">{{jcData.value}}</view>
  17. </view>
  18. <view class="line">
  19. <view class="lineTitle">错误说明</view>
  20. <view class="lineCont">
  21. <textarea v-model="comment" class="lineConttextarea" placeholder="请输入" name="" id=""></textarea>
  22. </view>
  23. </view>
  24. <view class="line" style="border: none;">
  25. <view class="lineTitle">上传图片</view>
  26. <view class="lineCont lineImgBox">
  27. <view class="imgLine" v-for="(item,index) in imgArr" >
  28. <image class="lineImg" :src="item.path" mode="widthFix"></image>
  29. <image src="../../static/img/icon_close.png" mode="" class="delImg" @click="delimg(imgindex)">
  30. </image>
  31. </view>
  32. <image @click="uploadImg" class="lineImg" src="/static/img/scimg.png" mode=""></image>
  33. </view>
  34. </view>
  35. <view class="btnBox">
  36. <view class="btn" v-if="optdata.type==1" @click="saveVIN">提交</view>
  37. <view class="btn" v-if="optdata.type==2" @click="SaveMatching">提交</view>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import nodata from '../../components/nodata/nodata.vue'
  44. import homenav from "../../components/homenav/nav.vue"
  45. export default {
  46. components: {
  47. nodata,homenav
  48. },
  49. data() {
  50. return {
  51. iStatusBarHeight:'',
  52. optdata:'',
  53. jcData:'',
  54. comment:'',
  55. imgs:'',
  56. imgArr:[],
  57. }
  58. },
  59. onLoad(opt) {
  60. this.jcData= uni.getStorageSync("jcData")
  61. console.log(opt)
  62. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  63. this.optdata=opt;
  64. },
  65. methods: {
  66. delimg(index) {
  67. this.imgArr.splice(index, 1)
  68. },
  69. saveVIN(){
  70. if(this.imgArr.length){
  71. var imgs=[]
  72. this.imgArr.forEach(item=>{
  73. imgs.push(item.path)
  74. })
  75. this.imgs=imgs.splice(',')
  76. }
  77. if(!this.comment){
  78. uni.showToast({
  79. title: '请填写错误说明',
  80. icon: 'none',
  81. duration: 3000
  82. });
  83. return false
  84. }
  85. uni.showLoading({ title: '加载中'});
  86. this.$http3('errcheckapi/saveVIN', {
  87. carId:this.jcData.id,
  88. carmodel:this.jcData.value,
  89. comment:this.comment,
  90. imgs:this.imgs,
  91. vin:this.jcData.vin
  92. },'POST').then(res => {
  93. uni.hideLoading();
  94. if(res.code==0){
  95. /* uni.showToast({
  96. title: '操作成功',
  97. icon: 'none',
  98. duration: 3000
  99. }); */
  100. uni.showModal({
  101. title: '提示',
  102. content: '操作成功',
  103. showCancel:false,
  104. success: function (res) {
  105. if (res.confirm) {
  106. uni.navigateBack(-1)
  107. } else if (res.cancel) {
  108. console.log('用户点击取消');
  109. }
  110. }
  111. });
  112. }
  113. })
  114. },
  115. SaveMatching(){
  116. if(this.imgArr.length){
  117. var imgs=[]
  118. this.imgArr.forEach(item=>{
  119. imgs.push(item.path)
  120. })
  121. this.imgs=imgs.splice(',')
  122. }
  123. if(!this.comment){
  124. uni.showToast({
  125. title: '请填写错误说明',
  126. icon: 'none',
  127. duration: 3000
  128. });
  129. return false
  130. }
  131. uni.showLoading({ title: '加载中'});
  132. this.$http('errcheckapi/SaveMatching', {
  133. goods:this.jcData.goods,
  134. carmodel:this.jcData.value,
  135. comment:this.comment,
  136. imgs:this.imgs,
  137. vin:this.jcData.vin,
  138. carGroupId:this.jcData.carGroupId,
  139. partId:this.jcData.partId
  140. },'POST').then(res => {
  141. uni.hideLoading();
  142. uni.showModal({
  143. title: '提示',
  144. content: '操作成功',
  145. showCancel:false,
  146. success: function (res) {
  147. if (res.confirm) {
  148. uni.navigateBack(-1)
  149. } else if (res.cancel) {
  150. console.log('用户点击取消');
  151. }
  152. }
  153. });
  154. })
  155. },
  156. uploadImg() {
  157. var that = this;
  158. var length = this.imgArr.length;
  159. var num = 9;
  160. if (length > 8) {
  161. uni.showToast({
  162. title: '最多上传9张',
  163. icon: 'none',
  164. duration: 2000,
  165. });
  166. return false;
  167. }
  168. uni.chooseImage({
  169. sourceType: ['album', 'camera'],
  170. count: num - length,
  171. sizeType:['compressed'],
  172. success: (chooseImageRes) => {
  173. const tempFilePaths = chooseImageRes.tempFilePaths;
  174. console.log(tempFilePaths)
  175. tempFilePaths.forEach(v => {
  176. //console.log(that.$baseURL + '/search?action=uploadapi/uploadImgBatch');
  177. uni.uploadFile({
  178. //url: that.$baseURL + '/search?action=uploadapi/uploadImgBatch',
  179. url:'https://openapi.db.66km.cn/uploadapi/uploadImgBatch?timestamp='+Date.now()+'&type=errorcorrection',
  180. //url:'http://192.168.1.8:20134/uploadapi/uploadImgBatch?timestamp='+Date.now()+'&type=errorcorrection',
  181. header:{
  182. timestamp:Date.now(),
  183. appId:'0d3f11e4-3344-4d59-a11e-06a8acc4b1bf'
  184. },
  185. //url:'http://api.dms.66km.com.cn/tuhuUploadFile',
  186. filePath: v,
  187. name: 'file',
  188. formData: {
  189. 'type': 'errorcorrection'
  190. },
  191. success: (uploadFileRes) => {
  192. var res=JSON.parse(uploadFileRes.data)
  193. if(res.code==0){
  194. console.log(JSON.parse(uploadFileRes.data).data);
  195. that.imgArr = that.imgArr.concat(JSON.parse(
  196. uploadFileRes.data).data);
  197. console.log('imgArr--',that.imgArr);
  198. }else{
  199. console.log(res)
  200. uni.showToast({
  201. title: res.msg,
  202. icon: 'none',
  203. duration: 3000,
  204. });
  205. }
  206. },
  207. fail(err) {
  208. uni.showToast({
  209. title: err.msg,
  210. icon: 'none',
  211. duration: 3000,
  212. });
  213. }
  214. });
  215. })
  216. }
  217. });
  218. },
  219. },
  220. }
  221. </script>
  222. <style scoped>
  223. .jtImg{
  224. width: 26rpx;height: 26rpx;
  225. }
  226. .line{
  227. padding: 20rpx 24rpx;
  228. border-bottom: 1px solid #eaeaea;
  229. display: flex;font-size: 28rpx;
  230. color: #333;
  231. }
  232. .lineTitle{
  233. width: 150rpx;
  234. }
  235. .lineCont{
  236. color: #666;
  237. width: 550rpx;
  238. }
  239. .lineConttextarea{
  240. height: 180rpx;width: 520rpx;
  241. border: 1px solid #eaeaea;
  242. padding: 16rpx;
  243. }
  244. .lineImg{
  245. width: 160rpx;
  246. height: 160rpx;
  247. margin-right: 20rpx;
  248. }
  249. .btnBox{
  250. padding-top: 200rpx;
  251. display: flex;justify-content: center;
  252. }
  253. .btn{
  254. width: 600rpx;
  255. height: 80rpx;
  256. text-align: center;
  257. line-height: 80rpx;
  258. color: #fff;
  259. font-size: 32rpx;
  260. background: #E60006;
  261. border-radius: 16rpx;
  262. }
  263. .delImg {
  264. width: 32rpx;
  265. height: 32rpx;
  266. position: absolute;
  267. right: 20rpx;
  268. top: 0rpx;
  269. }
  270. .imgLine {
  271. position: relative;
  272. /* display: inline-block; */
  273. display: flex;
  274. /* justify-items: center ; */
  275. align-items: center;
  276. }
  277. .lineImgBox{
  278. display: flex;flex-wrap: wrap;
  279. }
  280. </style>