updataKefuMsg.vue 8.3 KB

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