correction.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. <image class="lineImg" src="/static/img/noimg.png" mode=""></image>
  28. <image @click="uploadImg" class="lineImg" src="/static/img/scimg.png" mode=""></image>
  29. </view>
  30. </view>
  31. <view class="btnBox">
  32. <view class="btn" v-if="optdata.type==1" @click="saveVIN">提交</view>
  33. <view class="btn" v-if="optdata.type==2" @click="SaveMatching">提交</view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import nodata from '../../components/nodata/nodata.vue'
  40. import homenav from "../../components/homenav/nav.vue"
  41. export default {
  42. components: {
  43. nodata,homenav
  44. },
  45. data() {
  46. return {
  47. iStatusBarHeight:'',
  48. optdata:'',
  49. jcData:'',
  50. comment:'',
  51. imgs:'',
  52. imgArr:[],
  53. }
  54. },
  55. onLoad(opt) {
  56. this.jcData= uni.getStorageSync("jcData")
  57. console.log(opt)
  58. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  59. this.optdata=opt;
  60. },
  61. methods: {
  62. saveVIN(){
  63. uni.showLoading({ title: '加载中'});
  64. this.$http3('errcheckapi/saveVIN', {
  65. carId:this.jcData.id,
  66. carmodel:this.jcData.value,
  67. comment:this.comment,
  68. imgs:this.imgs,
  69. vin:this.jcData.vin
  70. },'POST').then(res => {
  71. uni.hideLoading();
  72. if(res.code==0){
  73. uni.showToast({
  74. title: '操作成功',
  75. icon: 'none',
  76. duration: 2000
  77. });
  78. }
  79. })
  80. },
  81. SaveMatching(){
  82. uni.showLoading({ title: '加载中'});
  83. this.$http3('errcheckapi/saveVIN', {
  84. goods:this.jcData.goods,
  85. carmodel:this.jcData.value,
  86. comment:this.comment,
  87. imgs:this.imgs,
  88. vin:this.jcData.vin,
  89. carGroupId:this.jcData.carGroupId,
  90. partId:this.jcData.partId
  91. },'POST').then(res => {
  92. uni.hideLoading();
  93. })
  94. },
  95. uploadImg() {
  96. var that = this;
  97. var length = this.imgArr.length;
  98. var num = 9;
  99. if (length > 8) {
  100. uni.showToast({
  101. title: '最多上传9张',
  102. icon: 'none',
  103. duration: 2000,
  104. });
  105. return false;
  106. }
  107. uni.chooseImage({
  108. sourceType: ['album', 'camera'],
  109. count: num - length,
  110. sizeType:['compressed'],
  111. success: (chooseImageRes) => {
  112. const tempFilePaths = chooseImageRes.tempFilePaths;
  113. console.log(tempFilePaths)
  114. tempFilePaths.forEach(v => {
  115. //console.log(that.$baseURL + '/search?action=uploadapi/uploadImgBatch');
  116. uni.uploadFile({
  117. //url: that.$baseURL + '/search?action=uploadapi/uploadImgBatch',
  118. url:'http://openapi.db.66km.cn/uploadapi/uploadImgBatch?timestamp='+Date.now(),
  119. header:{
  120. timestamp:Date.now()
  121. },
  122. //url:'http://api.dms.66km.com.cn/tuhuUploadFile',
  123. filePath: v,
  124. name: 'file',
  125. formData: {
  126. 'user': 'test'
  127. },
  128. success: (uploadFileRes) => {
  129. var res=JSON.parse(uploadFileRes.data)
  130. if(res.code==0){
  131. console.log(JSON.parse(uploadFileRes.data).data);
  132. that.imgArr = that.imgArr.concat(JSON.parse(
  133. uploadFileRes.data).data);
  134. console.log('imgArr--',that.imgArr);
  135. }else{
  136. console.log(res)
  137. uni.showToast({
  138. title: res.msg,
  139. icon: 'none',
  140. duration: 3000,
  141. });
  142. }
  143. },
  144. fail(err) {
  145. uni.showToast({
  146. title: err.msg,
  147. icon: 'none',
  148. duration: 3000,
  149. });
  150. }
  151. });
  152. })
  153. }
  154. });
  155. },
  156. },
  157. }
  158. </script>
  159. <style scoped>
  160. .jtImg{
  161. width: 26rpx;height: 26rpx;
  162. }
  163. .line{
  164. padding: 20rpx 24rpx;
  165. border-bottom: 1px solid #eaeaea;
  166. display: flex;font-size: 28rpx;
  167. color: #333;
  168. }
  169. .lineTitle{
  170. width: 150rpx;
  171. }
  172. .lineCont{
  173. color: #666;
  174. width: 550rpx;
  175. }
  176. .lineConttextarea{
  177. height: 180rpx;width: 520rpx;
  178. border: 1px solid #eaeaea;
  179. padding: 16rpx;
  180. }
  181. .lineImg{
  182. width: 160rpx;
  183. height: 160rpx;
  184. margin-right: 20rpx;
  185. }
  186. .btnBox{
  187. padding-top: 200rpx;
  188. display: flex;justify-content: center;
  189. }
  190. .btn{
  191. width: 600rpx;
  192. height: 80rpx;
  193. text-align: center;
  194. line-height: 80rpx;
  195. color: #fff;
  196. font-size: 32rpx;
  197. background: #FF4F00;
  198. border-radius: 16rpx;
  199. }
  200. </style>