correction.vue 7.1 KB

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