1 line
5.5 KiB
Plaintext
1 line
5.5 KiB
Plaintext
|
{"version":3,"file":"add.js","sources":["../../../../../../../src/modules/mall/goods/comment/add.vue","../../../../../../../uniPage:/bW9kdWxlc1xtYWxsXGdvb2RzXGNvbW1lbnRcYWRkLnZ1ZQ"],"sourcesContent":["<!-- 评价 -->\r\n<template>\r\n <s-layout title=\"评价\">\r\n <view>\r\n <view v-for=\"(item, index) in state.orderInfo.items\" :key=\"item.id\">\r\n <view>\r\n <view class=\"commont-from-wrap\">\r\n <!-- 评价商品 -->\r\n <s-goods-item\r\n :img=\"item.picUrl\"\r\n :title=\"item.spuName\"\r\n :skuText=\"item.properties.map((property) => property.valueName).join(' ')\"\r\n :price=\"item.payPrice\"\r\n :num=\"item.count\"\r\n />\r\n </view>\r\n\r\n <view class=\"form-item\">\r\n <!-- 评分 -->\r\n <view class=\"star-box ss-flex ss-col-center\">\r\n <view class=\"star-title ss-m-r-40\">商品质量</view>\r\n <uni-rate v-model=\"state.commentList[index].descriptionScores\" />\r\n </view>\r\n <view class=\"star-box ss-flex ss-col-center\">\r\n <view class=\"star-title ss-m-r-40\">服务态度</view>\r\n <uni-rate v-model=\"state.commentList[index].benefitScores\" />\r\n </view>\r\n <!-- 评价 -->\r\n <view class=\"area-box\">\r\n <uni-easyinput\r\n :inputBorder=\"false\"\r\n type=\"textarea\"\r\n maxlength=\"120\"\r\n autoHeight\r\n v-model=\"state.commentList[index].content\"\r\n placeholder=\"宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~\"\r\n />\r\n <!-- TODO 芋艿:文件上传 -->\r\n <view class=\"img-box\">\r\n <s-uploader\r\n v-model:url=\"state.commentList[index].images\"\r\n fileMediatype=\"image\"\r\n limit=\"9\"\r\n mode=\"grid\"\r\n :imageStyles=\"{ width: '168rpx', height: '168rpx' }\"\r\n />\r\n </view>\r\n </view>\r\n </view>\r\n </view>\r\n </view>\r\n </view>\r\n <!-- TODO 芋艿:是否匿名 -->\r\n\r\n <su-fixed bottom placeholder>\r\n <view class=\"foot_box ss-flex ss-row-center ss-col-center\">\r\n <button class=\"ss-reset-button post-btn ui-BG-Main-Gradient ui-Shadow-Main\" @tap=\"onSubmit\">\r\n 发布\r\n </button>\r\n </view>\r\n </su-fixed>\r\n </s-layout>\r\n</template>\r\n\r\n<script setup>\r\nimport sheep from '@/sheep'\r\nimport { onLoad } from '@dcloudio/uni-app'\r\nimport { reactive } from 'vue'\r\nimport OrderApi from '@/sheep/api/trade/order'\r\n\r\nconst state = reactive({\r\n orderInfo: {},\r\n commentList: [],\r\n id: null,\r\n})\r\n\r\nasync function onSubmit() {\r\n // 顺序提交评论\r\n for (const comment of state.commentList) {\r\n await OrderApi.createOrderItemComment(comment)\r\n }\r\n // 都评论好,返回\r\n sheep.$router.back()\r\n}\r\n\r\nonLoad(async (options) => {\r\n if (!options.id) {\r\n sheep.$helper.toast(`缺少订单信息,请检查`)\r\n return\r\n }\r\n state.id = options.id\r\n\r\n const { code, data } = await OrderApi.getOrder(state.id)\r\n if (code !== 0) {\r\n sheep.$helper.toast('无待评价订单')\r\n return\r\n }\r\n // 处理评论\r\n data.items.forEach((item) => {\r\n state.commentList.push({\r\n anonymous: false,\r\n orderItemId: item.id,\r\n descriptionScores: 5,\r\n benefitScores: 5,\r\n content: '',\r\n picUrls: [],\r\n })\r\n })\r\n state.orderInfo = data\r\n})\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n \r\n// 评价商品\r\n.goods-card {\r\n padding: 20rpx;\r\n margin: 10rpx 0;\r\n background: #fff;\r\n}\r\n\r\n// 评论,选择图片\r\n.form-item {\r\n background: #fff;\r\n\r\n .star-box {\r\n
|