updataKefuMsg.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <!-- <customNav :shownav="true" :title="$t('order.lianxikef')" tinColor="#006AFF" jiantou="0" ></customNav> -->
  2. <template>
  3. <view>
  4. <customNav :shownav="true" :title="$t('order.lianxikef')" tinColor="#006AFF" jiantou="0" ></customNav>
  5. <view class="content" style="margin-top: 40rpx;">
  6. <view class="item_list">
  7. <view class="item_content" v-for="(item,index) in annexList" @click="imagesel(index)">
  8. <netImage v-if="item!=''" width="220" height="220" bradius="4" :mysrc="item" mymode="scaleToFill" ></netImage>
  9. </view>
  10. <view class="item_content" @click="updataImage">
  11. <image class="upimagV" src="/static/imags/shangctp.png" mode="scaleToFill"></image>
  12. </view>
  13. </view>
  14. <textarea class="pinglun" :placeholder="$t('order.wentimiaos')" :value="remarks" @input="sumfontnum"></textarea>
  15. <view style="padding: 0 15rpx;margin-bottom: 20rpx;">
  16. <checkbox-group @change="checkboxChange">
  17. <label class="contentInRowL" style="margin-top: 8rpx;" v-for="(item,index) in checkList">
  18. <view>
  19. <checkbox :value="item.value" :checked="item.checked" />
  20. </view>
  21. <view style="font-size: 30rpx;">{{item.name}}</view>
  22. </label>
  23. </checkbox-group>
  24. </view>
  25. <view style="margin-left: 20rpx;margin-bottom: 20rpx;">
  26. <radio-group @change="radioChange">
  27. <label class="" >
  28. <radio value="0" :checked="shiyong==0" />
  29. <text style="font-size: 30rpx;color: crimson;">{{$t('kefu.weishiyong')}}</text>
  30. <radio style="margin-left: 20rpx;" value="1" :checked="shiyong==1"/>
  31. <text style="font-size: 30rpx;color: crimson;">{{$t('kefu.yishiyong')}}</text>
  32. </label>
  33. </radio-group>
  34. </view>
  35. </view>
  36. <view class="contentColumnC" style="margin-top: 50rpx;">
  37. <text class="savebt" @click="uploadMsg">{{$t('index.tijiao')}}</text>
  38. </view>
  39. <view class="contentColumnC" style="width: 90%;margin-left: 5%;margin-top: 60rpx;">
  40. <text style="font-size: 30rpx;">{{$t('kefu.pzcanksl')}}</text>
  41. <text style="margin-top: 10rpx;font-size: 30rpx;">{{$t('kefu.dingdandb')}}</text>
  42. <view class="contentInRowS" style="width: 100%;">
  43. <image class="imageSizeA" src="/static/defimags/jietu.jpg" mode="aspectFit"></image>
  44. <image class="imageSizeA" src="/static/defimags/paizhao.jpg" mode="aspectFit"></image>
  45. <image class="imageSizeA" src="/static/defimags/abc.jpg" mode="aspectFit"></image>
  46. </view>
  47. <text style="margin-top: 20rpx;font-size: 30rpx;">{{$t('kefu.shangptp')}}</text>
  48. <view class="contentInRowL" style="width: 100%;">
  49. <image class="imageSizeB" src="/static/defimags/cuowu.jpg" mode="aspectFit"></image>
  50. <image class="imageSizeB" src="/static/defimags/zhengque.jpg" mode="aspectFit"></image>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import api from "@/pages/api/api.js"
  57. export default {
  58. data() {
  59. return {
  60. remarks:'',
  61. ddId:'',
  62. userInfo:'',
  63. annexList:[],
  64. feedlist:[],
  65. checkList:[],
  66. shiyong:0,
  67. language:''
  68. }
  69. },
  70. onLoad(option) {
  71. this.ddId= option.ddId;
  72. this.userInfo = uni.getStorageSync('userInfo');
  73. this.language = uni.getStorageSync('language');
  74. this.getfeedlist();
  75. },
  76. methods: {
  77. getfeedlist(){
  78. api('getfeedlist',{},res=>{
  79. console.log('getfeedlist',res)
  80. if(res.data.code==200){
  81. var temp=res.data.data;
  82. this.feedlist=res.data.data;
  83. this.checkList=[];
  84. for(var i=0;i<temp.length;i++){
  85. var item = temp[i];
  86. var obj={
  87. value:item.id,
  88. checked:false,
  89. name:this.getcheckValue(item)
  90. }
  91. this.checkList.push(obj);
  92. }
  93. }
  94. },failc=>{
  95. })
  96. },
  97. getcheckValue(obj){
  98. if(this.language=='zh-Hans'){
  99. return obj.contentCh;
  100. }
  101. if(this.language=='zh-Hant'){
  102. return obj.contentTw;
  103. }
  104. if(this.language=='yuenan'){
  105. return obj.contentVi;
  106. }
  107. return obj.contentCh;
  108. },
  109. checkboxChange: function (e) {
  110. console.log('checkboxChange1',this.checkList)
  111. var items = this.checkList;
  112. var values = e.detail.value;
  113. for (var i = 0; i < items.length;i++) {
  114. const item = items[i]
  115. if(values.includes(item.value)){
  116. this.$set(item,'checked',true)
  117. }else{
  118. this.$set(item,'checked',false)
  119. }
  120. }
  121. console.log('checkboxChange2',this.checkList)
  122. },
  123. radioChange(e){
  124. console.log(e.detail.value)
  125. this.shiyong=e.detail.value;
  126. },
  127. uploadMsg(){
  128. if(this.remarks==''||this.remarks==null||this.remarks==undefined){
  129. uni.showToast({
  130. title:this.$t('order.wentimiaos'),
  131. icon: 'none',
  132. duration: 2500
  133. })
  134. return;
  135. }
  136. var feedBack=this.getfeedBack();
  137. if(feedBack.length==0){
  138. uni.showToast({
  139. title:this.$t('kefu.wentileix'),
  140. icon: 'none',
  141. duration: 2500
  142. })
  143. return;
  144. }
  145. var data = {
  146. "ddId":this.ddId, //订单号
  147. "userType":this.userInfo.userType, //用户类型
  148. "nickName":this.userInfo.nickName, //昵称
  149. "content":this.remarks, //内容
  150. "useCase":this.shiyong,
  151. "feedBack":JSON.stringify(feedBack),
  152. "imgs":this.stringimgs(this.annexList) //上传图片
  153. }
  154. console.log(data)
  155. uni.showLoading({
  156. mask:true
  157. })
  158. api('updatakefuMsg',data,res=>{
  159. console.log('updatakefuMsg',res)
  160. uni.hideLoading();
  161. uni.showToast({
  162. title:res.msg,
  163. icon:"none"
  164. })
  165. setTimeout(function() {
  166. // 这里写要延时执行的代码
  167. uni.navigateBack();
  168. }, 2000);
  169. },failc=>{
  170. uni.hideLoading();
  171. //console.log('getadvertis----',failc)
  172. })
  173. },
  174. getfeedBack(){
  175. var temp=[];
  176. for(var i=0;i<this.checkList.length;i++){
  177. if(this.checkList[i].checked==true){
  178. for(var j=0;j<this.feedlist.length;j++){
  179. if(this.checkList[i].value==this.feedlist[j].id){
  180. temp.push(this.feedlist[j].id);
  181. }
  182. }
  183. }
  184. }
  185. return temp;
  186. },
  187. stringimgs(list){
  188. var str='';
  189. for(var i=0;i<list.length;i++){
  190. if(i==0){
  191. str=list[i];
  192. }
  193. else{
  194. str=str+','+list[i];
  195. }
  196. }
  197. return str
  198. },
  199. sumfontnum(e){
  200. this.remarks=e.target.value;
  201. },
  202. imagesel(index){
  203. var that = this;
  204. uni.showModal({
  205. cancelText:that.$t('order.quxiao'),
  206. confirmText:that.$t('comp.queren'),
  207. title: that.$t('api.message'),
  208. content:that.$t('order.shanchutp'),
  209. success: function (res) {
  210. if (res.confirm) { //这里是点击了确定以后
  211. var temList = [];
  212. for(var i=0;i<that.annexList.length;i++){
  213. if(i!=index){
  214. temList.push(that.annexList[i]);
  215. }
  216. }
  217. that.annexList=temList;
  218. } else { //这里是点击了取消以后
  219. console.log('点击取消')
  220. }
  221. }
  222. })
  223. },
  224. updataImage(){
  225. console.log('selectImage');
  226. var that = this;
  227. uni.chooseImage({
  228. count: 1, // 图片数量
  229. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  230. sourceType: ['album'], //从相册选择或者拍照
  231. success: (res) => {
  232. const tempFilePaths = res.tempFilePaths;
  233. console.log('-----',tempFilePaths)
  234. uni.showLoading({
  235. mask:true
  236. })
  237. uni.uploadFile({
  238. url:'https://api.awayqtw.com/utils/Upload', //上传图片api
  239. filePath: tempFilePaths[0],
  240. name: 'file',
  241. header:{
  242. //"Authorization": userinfo.token
  243. },
  244. success: (res) => {
  245. uni.hideLoading();
  246. let group = JSON.parse(res.data);
  247. that.annexList.push(group.data);
  248. console.log(that.annexList);
  249. },
  250. fail: (res) =>{
  251. uni.hideLoading();
  252. console.log('uni.uploadFile',res)
  253. }
  254. });
  255. }
  256. });
  257. },
  258. }
  259. }
  260. </script>
  261. <style>
  262. .item_list{
  263. padding: 0 15rpx;
  264. display: flex;
  265. flex-wrap: wrap;
  266. justify-content: flex-start;
  267. .item_content{
  268. width:210rpx;
  269. height:210rpx;
  270. margin: 10rpx;
  271. box-sizing: border-box;
  272. }
  273. }
  274. .upimagV{
  275. width: 210rpx;
  276. height:210rpx;
  277. }
  278. .pinglun{
  279. margin: 16rpx;
  280. padding: 10rpx;
  281. width:92%;
  282. height: 100rpx;
  283. border-radius: 15rpx;
  284. border: 2rpx solid lightgray;
  285. }
  286. .savebt{
  287. text-align: center;
  288. font-size: 36rpx;
  289. width: 80%;
  290. height: 80rpx;
  291. line-height: 80rpx;
  292. color: white;
  293. background-color: green;
  294. border-radius: 10rpx;
  295. }
  296. .imageSizeA{
  297. padding: 10rpx;
  298. width: 28%;
  299. background-color: whitesmoke;
  300. }
  301. .imageSizeB{
  302. padding: 10rpx;
  303. margin-left: 10rpx;
  304. width: 40%;
  305. background-color: whitesmoke;
  306. }
  307. </style>