index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  3. <tm-menubars title="我的评价" :shadow="0" :showback="true"></tm-menubars>
  4. <div class="zhuti">
  5. <tm-sheet class="kuang" style="padding-bottom: 70px !important;">
  6. <view style="width: 94%;margin:0 auto;">
  7. <tm-cartCellListFood class="shangpin" :typeclick="typeclick" :mdata="item"
  8. :cart-num.sync="item.buy"></tm-cartCellListFood>
  9. <view class="tiyan">
  10. <text class="text-white mr-20">产品体验</text>
  11. <tm-rate v-model="rate1"></tm-rate>
  12. <text class="ml-20 text-size-s" v-if="rate1==5">非常满意</text>
  13. <text class="ml-20 text-size-s" v-if="rate1<=4&&rate1>3">比较满意</text>
  14. <text class="ml-20 text-size-s" v-if="rate1<=3&&rate1>0">一般满意</text>
  15. </view>
  16. <view class="tiyan">
  17. <text class="text-white mr-20">派送评价</text>
  18. <tm-rate v-model="rate2"></tm-rate>
  19. <text class="ml-20 text-size-s" v-if="rate2==5">非常满意</text>
  20. <text class="ml-20 text-size-s" v-if="rate2<=4&&rate2>3">比较满意</text>
  21. <text class="ml-20 text-size-s" v-if="rate2<=3&&rate2>0">一般满意</text>
  22. </view>
  23. <view class="tiyan">
  24. <text class="text-white mr-20">服务态度</text>
  25. <tm-rate v-model="rate3"></tm-rate>
  26. <text class="ml-20 text-size-s" v-if="rate3==5">非常满意</text>
  27. <text class="ml-20 text-size-s" v-if="rate3<=4&&rate3>3">比较满意</text>
  28. <text class="ml-20 text-size-s" v-if="rate3<=3&&rate3>0">一般满意</text>
  29. </view>
  30. <tm-input class="shuru" :height="150" title="" :maxlength="144" :border-bottom="false"
  31. placeholder="快来发表评论吧!" input-type="textarea" v-model="val_1" bg-color="grey-lighten-5" clear>
  32. </tm-input>
  33. <view class="mt-30">
  34. <view class="">
  35. <view class="cent-bottom-m">
  36. <view class="uploadImg" style="display: flex;justify-content: flex-start;flex-wrap: wrap;align-items: flex-start;">
  37. <view v-for="(el, index) in fileList" :key="index">
  38. <view class="uploadImg-image" >
  39. <image @click="checkImgbox(fileList, index)" :src="imgUrl+el"
  40. mode="aspectFill" style="width: 100%;height: 100%;border-radius: 4px;">
  41. </image>
  42. <view class="jian" @click="popImg(index)">
  43. <tm-button class="shanchu" theme="white" size="s" icon="icon-times">
  44. </tm-button>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="jia-btn" @click="openImagePage" v-if="uploadFlag">
  49. <view class="jia">
  50. <view>
  51. <tm-button theme="white" size="m" icon="icon-plus"></tm-button>
  52. </view>
  53. <view style="font-size: 12px;">上传图片</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- <tm-upload :tips="false" :filelist.sync="filelist" max='5'></tm-upload> -->
  60. </view>
  61. <tm-button :round="24" class="sao" block @click="submit">提交</tm-button>
  62. </view>
  63. </tm-sheet>
  64. </div>
  65. <!-- 弹出层消息 -->
  66. <tm-message ref="toast"></tm-message>
  67. </view>
  68. </template>
  69. <script>
  70. import {
  71. myRequest
  72. } from '@/api/request.js'
  73. export default {
  74. data() {
  75. return {
  76. item: {
  77. // img: '../../static/img/83.png',
  78. // title: '丝缎质感纹理风衣',
  79. // label: '黑色 - 6518/320',
  80. // size: 'S',
  81. // price: '1299',
  82. // id: 3,
  83. // buy: 0,
  84. // itemId: 0,
  85. // checked: false,
  86. },
  87. // typeclick:5,//1加入购物车,2购物车
  88. typeclick: 9, //1加入购物车,2购物车
  89. rate1: 0,
  90. rate2: 0,
  91. rate3: 0,
  92. val_1: '',
  93. fileList: [],
  94. imgUrl: "",
  95. sizeType: ['compressed'],
  96. imageList: [], // 申诉图片地址
  97. uploadFlag: true, // 申诉图片大于3张隐藏上传按钮
  98. orId: '',
  99. imgList:[]
  100. };
  101. },
  102. onLoad(op) {
  103. console.log(op);
  104. if (op) {
  105. this.orId = op.id;
  106. this.getOrderDetail()
  107. }
  108. },
  109. created() {
  110. if (!uni.getStorageSync("token")) {
  111. uni.navigateTo({
  112. url: "/pages/login/index",
  113. })
  114. }
  115. this.sys = uni.getSystemInfoSync();
  116. },
  117. methods: {
  118. getOrderDetail(){
  119. let that = this;
  120. myRequest({
  121. url:'/api/Order/orderDetails',
  122. method:'post',
  123. data:{id:that.orId}
  124. }).then(res=>{
  125. if(res.data.code==200){
  126. this.item=res.data.data.goods_details;
  127. this.item.title=res.data.data.goods_details.goods_name;
  128. this.item.img=res.data.data.goods_details.goods_img;
  129. this.item.price=res.data.data.goods_details.goods_price;
  130. this.item.buy=res.data.data.goods_details.buy_num;
  131. // this.item.title=res.data.data.goods_details.goods_name;
  132. console.log(res.data.data.goods_details,'33');
  133. }else{
  134. that.$refs.toast.show({
  135. model: 'error',
  136. label: res.data.msg
  137. })
  138. }
  139. })
  140. },
  141. openImagePage() {
  142. let that = this;
  143. if (that.fileList.length > 5) {
  144. uni.showToast({
  145. title: "最多支持5张图片",
  146. icon: "none"
  147. })
  148. return;
  149. }
  150. uni.chooseImage({
  151. count: 1,
  152. sizeType: ['compressed'],
  153. sourceType: ['album', 'camera'],
  154. success: function(res) {
  155. uni.showLoading({
  156. title: '图片上传中'
  157. });
  158. that.uploadImage(res.tempFilePaths)
  159. }
  160. });
  161. },
  162. uploadImage(tempFilePaths) {
  163. let _this = this;
  164. uni.uploadFile({
  165. url: 'http://yigui.liliju.com/common/uploads/upload', //接口地址
  166. header: {
  167. "token": uni.getStorageSync('token'),
  168. }, //请求token
  169. filePath: tempFilePaths[0],
  170. name: 'file',
  171. success: (res) => {
  172. let data = JSON.parse(res.data);
  173. console.log(data);
  174. let url = data.data.yimg;
  175. console.log(url, 'url');
  176. // 选中图片
  177. if (_this.fileList.indexOf(url) == -1) {
  178. let uu=url.substr(24);
  179. _this.fileList.push(url);
  180. _this.imgList.push(uu)
  181. console.log(_this.fileList,'haah');
  182. }
  183. uni.hideLoading();
  184. if (_this.fileList.length > 5) {
  185. _this.uploadFlag = false
  186. } else {
  187. _this.uploadFlag = true
  188. }
  189. }
  190. });
  191. },
  192. checkImgbox(fileList, index) { //放大图片
  193. console.log(fileList, index, 999)
  194. let arr = [];
  195. fileList.forEach((el) => {
  196. arr.push(this.imgUrl + el);
  197. })
  198. uni.previewImage({
  199. urls: arr,
  200. current: index
  201. });
  202. },
  203. popImg(index) { //删除图片
  204. this.fileList.splice(index, 1);
  205. this.imgList.splice(index, 1);
  206. if (this.fileList.length < 1) {
  207. this.uploadFlag = true
  208. }
  209. },
  210. aa(num) {
  211. if (num == 1) {
  212. this.checked1 = true;
  213. this.checked2 = false;
  214. this.checked3 = false;
  215. } else if (num == 2) {
  216. this.checked1 = false;
  217. this.checked2 = true;
  218. this.checked3 = false;
  219. } else if (num == 3) {
  220. this.checked1 = false;
  221. this.checked2 = false;
  222. this.checked3 = true;
  223. }
  224. },
  225. // 提交评价
  226. submit() {
  227. if (this.rate1 == 0 || this.rate2 == 0 || this.rate3 == 0) {
  228. uni.showToast({
  229. title: '请选择满意度',
  230. icon: 'none'
  231. })
  232. } else if (this.val_1 == '') {
  233. uni.showToast({
  234. title: '内容不能为空',
  235. icon: 'none'
  236. })
  237. } else {
  238. let that = this;
  239. myRequest({
  240. url: '/api/Order/orderEvaluate',
  241. method: 'post',
  242. data: {
  243. id: that.orId,
  244. experience_value: that.rate1,
  245. delivery_value: that.rate2,
  246. service_value: that.rate3,
  247. atlas: that.imgList.join(','),
  248. content: that.val_1
  249. }
  250. }).then(res => {
  251. if (res.data.code == 200) {
  252. console.log(res.data.data, 'pingjia1!!');
  253. that.$refs.toast.show({
  254. model: 'success',
  255. label: res.data.msg
  256. })
  257. setTimeout(()=>{
  258. uni.navigateBack({
  259. delta:1
  260. })
  261. },800)
  262. } else {
  263. that.$refs.toast.show({
  264. model: 'error',
  265. label: res.data.msg
  266. })
  267. }
  268. })
  269. }
  270. }
  271. },
  272. }
  273. </script>
  274. <style lang="scss">
  275. /deep/ .tm-menubars .body {
  276. background-color: #1b1b1b !important;
  277. }
  278. /deep/ .zhuti {
  279. padding: 10px 10px;
  280. }
  281. /deep/ .kuang {
  282. margin: 0 !important;
  283. padding: 0px !important;
  284. }
  285. .uploadImg-image {
  286. width: 70px;
  287. height: 70px;
  288. margin: 0px 10px 10px 0px;
  289. position: relative;
  290. }
  291. .shanchu {
  292. position: absolute;
  293. right: -15px;
  294. top: -5px;
  295. }
  296. /deep/ .jia .tm-button-btn {
  297. padding: 0px !important;
  298. margin: 0px !important;
  299. }
  300. /deep/ .jia .tm-button-btn .px-12 {
  301. padding: 0 !important;
  302. }
  303. /deep/ .uploadImg-image .white {
  304. background: none !important;
  305. color: #ffffff !important;
  306. }
  307. /deep/ .jia .white {
  308. background: none !important;
  309. color: #ffffff !important;
  310. }
  311. .sao {
  312. width: 90%;
  313. margin: 0 auto;
  314. margin-top: 20px;
  315. }
  316. /deep/ .shuliang .text-size-n {
  317. color: white !important;
  318. }
  319. /deep/ .shangpin .tm-cartCellListFood {
  320. padding: 0px 0px 15px 0px !important;
  321. margin-top: 5px !important;
  322. margin-bottom: 20px !important;
  323. border-bottom: 1px solid #1B1B1B;
  324. }
  325. /deep/ .kuang .border-t-1.bk {
  326. border-top: 1px solid #1b1b1b !important;
  327. }
  328. /deep/ .shangpin .title {
  329. color: white !important;
  330. }
  331. /deep/ .shangpin .text-red {
  332. color: white !important;
  333. }
  334. /deep/ .shangpin .round-3 {
  335. width: 90px !important;
  336. height: 90px !important;
  337. }
  338. /deep/ .shangpin .tm-cartCellListFood-img {
  339. width: 90px !important;
  340. height: 90px !important;
  341. }
  342. /deep/ .shuliang .text-size-n {
  343. color: white !important;
  344. }
  345. .tiyan text {
  346. vertical-align: middle;
  347. }
  348. .tiyan {
  349. margin-top: 20px;
  350. }
  351. /deep/ .tiyan .text-primary.bk {
  352. color: #FFCC00 !important;
  353. }
  354. /deep/ .tiyan .opacity-6 {
  355. opacity: 1 !important;
  356. }
  357. /deep/ .shuru .grey-darken-4 {
  358. background: #0D0D0D !important;
  359. }
  360. .shuru {
  361. padding: 0px !important;
  362. margin-top: 20px !important;
  363. }
  364. .jia {
  365. width: 100%;
  366. height: 100%;
  367. display: flex;
  368. flex-direction: column;
  369. justify-content: center;
  370. align-items: center;
  371. }
  372. .jia-btn {
  373. width: 70px;
  374. height: 70px;
  375. border: 1px solid #ffffff;
  376. border-radius: 4px;
  377. }
  378. </style>