123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- <template>
- <view :style="colorStyle">
- <form @submit="formSubmit" report-submit='true'>
- <view class='evaluate-con'>
- <view class='goodsStyle acea-row row-between'>
- <view class='pictrue'>
- <image :src='productInfo.attrInfo?productInfo.attrInfo.image:productInfo.image'></image>
- </view>
- <view class='text acea-row row-between'>
- <view class='name line3'>{{productInfo.store_name}}</view>
- <view class='money'>
- <view>¥{{productInfo.attrInfo?productInfo.attrInfo.price:productInfo.price}}</view>
- <view class='num'>x{{cart_num}}</view>
- </view>
- </view>
- </view>
- <view class='score'>
- <view class='item acea-row row-middle' v-for="(item,indexw) in scoreList" :key="indexw">
- <view>{{item.name}}</view>
- <view class='starsList'>
- <text @click="stars(indexn, indexw)" v-for="(itemn, indexn) in item.stars" :key="indexn"
- class='iconfont'
- :class="item.index >= indexn? 'icon-shitixing font-num':'icon-kongxinxing'"></text>
- </view>
- <text class='evaluate'>{{item.index === -1 ? "" : item.index + 1 + "分"}}</text>
- </view>
- <view class='textarea'>
- <textarea placeholder='商品满足你的期待么?说说你的想法,分享给想买的他们吧~(最多输入100个字)' name="comment"
- placeholder-class='placeholder' maxlength='100'></textarea>
- <view class='list acea-row row-middle'>
- <view class='pictrue' v-for="(item,index) in pics" :key="index" v-if="index<8">
- <image :src='item'></image>
- <text class='iconfont icon-guanbi1 font-num' @click='DelPic(index)'></text>
- </view>
- <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic'
- v-if="pics.length < 8">
- <text class='iconfont icon-icon25201'></text>
- <view>上传图片</view>
- </view>
- </view>
- </view>
- <button class='evaluateBnt bg-color' formType="submit">立即评价</button>
- </view>
- </view>
- </form>
- <canvas canvas-id="canvas" v-if="canvasStatus"
- :style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
- <!-- #ifdef MP -->
- <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
- <!-- #endif -->
- </view>
- </template>
- <script>
- import {
- orderProduct,
- orderComment
- } from '@/api/order.js';
- import {
- toLogin
- } from '@/libs/login.js';
- import {
- mapGetters
- } from "vuex";
- import colors from "@/mixins/color";
- export default {
- components: {},
- mixins: [colors],
- data() {
- return {
- pics: [],
- scoreList: [{
- name: "商品质量",
- stars: ["", "", "", "", ""],
- index: -1
- },
- {
- name: "服务态度",
- stars: ["", "", "", "", ""],
- index: -1
- }
- ],
- orderId: '',
- unique: '',
- productInfo: {},
- cart_num: 0,
- isAuto: false, //没有授权的不会自动授权
- isShowAuth: false, //是否隐藏授权
- canvasWidth: "",
- canvasHeight: "",
- canvasStatus: false
- };
- },
- computed: mapGetters(['isLogin']),
- watch: {
- isLogin: {
- handler: function(newV, oldV) {
- if (newV) {
- this.getOrderProduct();
- }
- },
- deep: true
- }
- },
- onLoad(options) {
- if (!options.unique || !options.uni) return this.$util.Tips({
- title: '缺少参数'
- }, {
- tab: 3,
- url: 1
- });
- this.unique = options.unique;
- this.orderId = options.uni;
- if (this.isLogin) {
- this.getOrderProduct();
- }
- },
- onShow() {
- uni.removeStorageSync('form_type_cart');
- if(!this.isLogin){
- toLogin()
- }
- },
- methods: {
- onLoadFun() {
- this.getOrderProduct();
- this.isShowAuth = false;
- },
- // 授权关闭
- authColse: function(e) {
- this.isShowAuth = e
- },
- /**
- * 获取某个产品详情
- *
- */
- getOrderProduct: function() {
- let that = this;
- orderProduct(that.unique).then(res => {
- that.$set(that, 'productInfo', res.data.productInfo);
- that.cart_num = res.data.cart_num;
- });
- },
- stars: function(indexn, indexw) {
- this.scoreList[indexw].index = indexn;
- },
- /**
- * 删除图片
- *
- */
- DelPic: function(index) {
- let that = this,
- pic = this.pics[index];
- that.pics.splice(index, 1);
- that.$set(that, 'pics', that.pics);
- },
- /**
- * 上传文件
- *
- */
- uploadpic: function() {
- let that = this;
- this.canvasStatus = true
- that.$util.uploadImageChange({count:8,url:'upload/image'}, function(res) {
- that.pics.push(res.data.url);
- }, (res) => {
- this.canvasStatus = false
- }, (res) => {
- this.canvasWidth = res.w
- this.canvasHeight = res.h
- });
- },
- /**
- * 立即评价
- */
- formSubmit: function(e) {
- let formId = e.detail.formId,
- value = e.detail.value,
- that = this,
- product_score = that.scoreList[0].index + 1 === 0 ? "" : that.scoreList[0].index + 1,
- service_score = that.scoreList[1].index + 1 === 0 ? "" : that.scoreList[1].index + 1;
- if (!value.comment) return that.$util.Tips({
- title: '请填写你对宝贝的心得!'
- });
- value.product_score = product_score;
- value.service_score = service_score;
- value.pics = that.pics;
- value.unique = that.unique;
- uni.showLoading({
- title: "正在发布评论……"
- });
- orderComment(value).then(res => {
- uni.hideLoading();
- let jumpPath = res.data.to_lottery ?
- '/pages/goods/goods_comment_con/lottery_comment?type=4&order_id=' + that
- .orderId : '/pages/goods/order_details/index?order_id=' + that.orderId
- let obj = {
- tab: 3,
- url: 1
- };
- let pages = getCurrentPages();
- if (pages[pages.length - 3]) {
- if (pages[pages.length - 3].route == 'pages/goods/order_pay_status/index') {
- obj.tab = 5;
- obj.url = '/pages/goods/order_list/index';
- }
- }
- if (res.data.to_lottery) {
- obj.tab = 5;
- obj.url = '/pages/goods/goods_comment_con/lottery_comment?type=4&order_id=' + that.orderId
- }
- that.$util.Tips({
- title: '感谢您的评价!',
- icon: 'success'
- }, obj);
- }).catch(err => {
- uni.hideLoading();
- return that.$util.Tips({
- title: err
- });
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .evaluate-con .score {
- background-color: #fff;
- border-top: 1rpx solid #f5f5f5;
- font-size: 28rpx;
- color: #282828;
- padding: 48rpx 30rpx 65rpx 30rpx;
- }
- .evaluate-con .score .item~.item {
- margin-top: 30rpx;
- }
- .evaluate-con .score .item .starsList {
- padding: 0 35rpx 0 40rpx;
- }
- .evaluate-con .score .item .starsList .iconfont {
- font-size: 40rpx;
- color: #aaa;
- }
- .evaluate-con .score .item .starsList .iconfont~.iconfont {
- margin-left: 20rpx;
- }
- .evaluate-con .score .item .evaluate {
- color: #aaa;
- font-size: 24rpx;
- }
- .evaluate-con .score .textarea {
- width: 690rpx;
- background-color: #fafafa;
- border-radius: 10rpx;
- margin-top: 48rpx;
- }
- .evaluate-con .score .textarea textarea {
- font-size: 28rpx;
- padding: 20rpx 8rpx 0 8rpx;
- width: 100%;
- box-sizing: border-box;
- height: 160rpx;
- }
- .evaluate-con .score .textarea .placeholder {
- color: #bbb;
- }
- .evaluate-con .score .textarea .list {
- margin-top: 25rpx;
- padding-left: 5rpx;
- }
- .evaluate-con .score .textarea .list .pictrue {
- width: 140rpx;
- height: 140rpx;
- margin: 0 0 35rpx 25rpx;
- position: relative;
- font-size: 22rpx;
- color: #bbb;
- }
- .evaluate-con .score .textarea .list .pictrue:nth-last-child(1) {
- border: 1rpx solid #ddd;
- box-sizing: border-box;
- }
- .evaluate-con .score .textarea .list .pictrue image {
- width: 100%;
- height: 100%;
- border-radius: 3rpx;
- }
- .evaluate-con .score .textarea .list .pictrue .icon-guanbi1 {
- font-size: 45rpx;
- position: absolute;
- top: -20rpx;
- right: -20rpx;
- }
- .evaluate-con .score .textarea .list .pictrue .icon-icon25201 {
- color: #bfbfbf;
- font-size: 50rpx;
- }
- .evaluate-con .score .evaluateBnt {
- font-size: 30rpx;
- color: #fff;
- width: 690rpx;
- height: 86rpx;
- border-radius: 43rpx;
- text-align: center;
- line-height: 86rpx;
- margin-top: 45rpx;
- }
- </style>
|