index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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">
  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: {
  124. id: that.orId
  125. }
  126. }).then(res => {
  127. if (res.data.code == 200) {
  128. this.item = res.data.data.goods_details;
  129. this.item.title = res.data.data.goods_details.goods_name;
  130. this.item.img = res.data.data.goods_details.goods_img;
  131. this.item.price = res.data.data.goods_details.goods_price;
  132. this.item.buy = res.data.data.goods_details.buy_num;
  133. // this.item.title=res.data.data.goods_details.goods_name;
  134. console.log(res.data.data.goods_details, '33');
  135. } else {
  136. that.$refs.toast.show({
  137. model: 'error',
  138. label: res.data.msg
  139. })
  140. }
  141. })
  142. },
  143. openImagePage() {
  144. let that = this;
  145. if (that.fileList.length > 5) {
  146. uni.showToast({
  147. title: "最多支持5张图片",
  148. icon: "none"
  149. })
  150. return;
  151. }
  152. uni.chooseImage({
  153. count: 1,
  154. sizeType: ['compressed'],
  155. sourceType: ['album', 'camera'],
  156. success: function(res) {
  157. uni.showLoading({
  158. title: '图片上传中'
  159. });
  160. that.uploadImage(res.tempFilePaths)
  161. }
  162. });
  163. },
  164. uploadImage(tempFilePaths) {
  165. let _this = this;
  166. uni.uploadFile({
  167. url: 'http://yigui.liliju.com/common/uploads/upload', //接口地址
  168. header: {
  169. "token": uni.getStorageSync('token'),
  170. }, //请求token
  171. filePath: tempFilePaths[0],
  172. name: 'file',
  173. success: (res) => {
  174. let data = JSON.parse(res.data);
  175. console.log(data);
  176. let url = data.data.yimg;
  177. console.log(url, 'url');
  178. // 选中图片
  179. if (_this.fileList.indexOf(url) == -1) {
  180. let uu = url.substr(24);
  181. _this.fileList.push(url);
  182. _this.imgList.push(uu)
  183. console.log(_this.fileList, 'haah');
  184. }
  185. uni.hideLoading();
  186. if (_this.fileList.length > 5) {
  187. _this.uploadFlag = false
  188. } else {
  189. _this.uploadFlag = true
  190. }
  191. }
  192. });
  193. },
  194. checkImgbox(fileList, index) { //放大图片
  195. console.log(fileList, index, 999)
  196. let arr = [];
  197. fileList.forEach((el) => {
  198. arr.push(this.imgUrl + el);
  199. })
  200. uni.previewImage({
  201. urls: arr,
  202. current: index
  203. });
  204. },
  205. popImg(index) { //删除图片
  206. this.fileList.splice(index, 1);
  207. this.imgList.splice(index, 1);
  208. if (this.fileList.length < 1) {
  209. this.uploadFlag = true
  210. }
  211. },
  212. aa(num) {
  213. if (num == 1) {
  214. this.checked1 = true;
  215. this.checked2 = false;
  216. this.checked3 = false;
  217. } else if (num == 2) {
  218. this.checked1 = false;
  219. this.checked2 = true;
  220. this.checked3 = false;
  221. } else if (num == 3) {
  222. this.checked1 = false;
  223. this.checked2 = false;
  224. this.checked3 = true;
  225. }
  226. },
  227. // 提交评价
  228. submit() {
  229. if (this.rate1 == 0 || this.rate2 == 0 || this.rate3 == 0) {
  230. uni.showToast({
  231. title: '请选择满意度',
  232. icon: 'none'
  233. })
  234. } else if (this.val_1 == '') {
  235. uni.showToast({
  236. title: '内容不能为空',
  237. icon: 'none'
  238. })
  239. } else {
  240. let that = this;
  241. myRequest({
  242. url: '/api/Order/orderEvaluate',
  243. method: 'post',
  244. data: {
  245. id: that.orId,
  246. experience_value: that.rate1,
  247. delivery_value: that.rate2,
  248. service_value: that.rate3,
  249. atlas: that.imgList.join(','),
  250. content: that.val_1
  251. }
  252. }).then(res => {
  253. if (res.data.code == 200) {
  254. console.log(res.data.data, 'pingjia1!!');
  255. that.$refs.toast.show({
  256. model: 'success',
  257. label: res.data.msg
  258. })
  259. setTimeout(() => {
  260. uni.navigateBack({
  261. delta: 1
  262. })
  263. }, 800)
  264. } else {
  265. that.$refs.toast.show({
  266. model: 'error',
  267. label: res.data.msg
  268. })
  269. }
  270. })
  271. }
  272. }
  273. },
  274. }
  275. </script>
  276. <style lang="scss">
  277. /deep/ .tm-menubars .body {
  278. background-color: #1b1b1b !important;
  279. }
  280. /deep/ .zhuti {
  281. padding: 10px 10px;
  282. }
  283. /deep/ .kuang,
  284. /deep/ .jia .tm-button-btn {
  285. margin: 0 !important;
  286. padding: 0px !important;
  287. }
  288. .uploadImg {
  289. display: flex;
  290. justify-content: flex-start;
  291. align-items: flex-start;
  292. flex-wrap: wrap;
  293. }
  294. .uploadImg-image {
  295. width: 70px;
  296. height: 70px;
  297. margin: 0px 10px 10px 0px;
  298. position: relative;
  299. }
  300. .shanchu {
  301. position: absolute;
  302. right: -15px;
  303. top: -5px;
  304. }
  305. /deep/ .jia .tm-button-btn .px-12 {
  306. padding: 0 !important;
  307. }
  308. /deep/ .white {
  309. background: none !important;
  310. }
  311. /deep/ .jia .white,
  312. /deep/ .jian .white {
  313. color: #ffffff !important;
  314. }
  315. .sao {
  316. width: 90%;
  317. margin: 20px auto 0px;
  318. }
  319. /deep/ .shuliang .text-size-n {
  320. color: white !important;
  321. }
  322. /deep/ .shangpin .tm-cartCellListFood {
  323. margin: 5px 0px 20px !important;
  324. padding-bottom: 15px !important;
  325. border-bottom: 1px solid #1B1B1B;
  326. }
  327. /deep/ .kuang .border-t-1.bk {
  328. border-top: 1px solid #1b1b1b !important;
  329. }
  330. /deep/ .shangpin .title,
  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 #eeeeee;
  376. border-radius: 4px;
  377. }
  378. </style>