123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401 |
- <template>
- <view class="content">
- <view class="order-item">
- <view class="goods-box-single">
- <image class="goods-img" :src="productInfo.image" mode="aspectFill"></image>
- <view class="right position-relative">
- <view class="flex">
- <text class="title">{{ productInfo.store_name }}</text>
- <view class="title-right">
- <view class="price">{{ productInfo.price }}</view>
- <view class="attr-box">x{{ list.cart_num }}</view>
- </view>
- </view>
- </view>
- </view>
- <view>
- <view class="flex_item zhil">
- <view>商品质量</view>
- <view><uni-rate text="1" size="20" margin="10" :value="rateValue1" @change="rateChange1"></uni-rate></view>
- </view>
- <view class="flex_item zhil">
- <view>服务态度</view>
- <view><uni-rate text="1" size="20" margin="10" :value="rateValue2" @change="rateChange2"></uni-rate></view>
- </view>
- <view class="equity_box">
- <view class="text-box uni-textarea">
- <textarea placeholder-style="color:#999" :placeholder="placeholder" @blur="bindTextAreaBlur"></textarea>
- </view>
- <view class="">
- <view class="add-img-box flex_item">
- <view class="add-img-item" v-for="(item, index) in imgList" :key="index">
- <image class="add-img" @click.stop="imgInfo(index)" :src="item.url" mode="aspectFill"></image>
- <image class="add-img-del" @click.stop="delImg(index)" src="/static/img/delete.png"></image>
- </view>
- <view v-if="imgList.length < 9" class="add-img-item" @click.stop="scImg()">
- <image class="add-img" src="/static/img/add.png"></image>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view @click.stop="submit" class="address-box submit-box"><text class="submit-btn">提交评论</text></view>
- </view>
- </template>
- <script>
- import { product, upload, order_comment } from '@/api/order.js';
- export default {
- data() {
- return {
- list: '', //订单详情
- productInfo: '',
- text: '', //评论内容
- placeholder: '商品满足你的期待么?说说你的想法,分享给想买的他们吧~',
- imgList: [],
- unique: '', //商品唯一标识码
- cloudimgList: [],
- rateValue1: '', //商品质量
- rateValue2: '', //服务态度
- imgCount: 6 //最多支持9张上传,可以修改
- };
- },
- onLoad(option) {
- this.unique = option.unique;
- this.loadOrder();
- },
- onShow() {},
- methods: {
- //text
- bindTextAreaBlur: function(e) {
- this.text = e.detail.value;
- },
- //获取收入支出信息
- async loadOrder() {
- product({
- unique: this.unique
- }).then(e => {
- this.list = e.data;
- this.productInfo = e.data.productInfo;
- });
- },
- //商品质量评分
- rateChange1(val) {
- this.rateValue1 = val.value;
- },
- //服务态度评分
- rateChange2(val) {
- this.rateValue2 = val.value;
- },
- //单张上传图片
- scImg() {
- let obj = this;
- console.log(obj.imgCount, 11);
- if (obj.imgCount == 0) {
- uni.showToast({
- title: '最多添加6张图片',
- icon: 'none'
- });
- return;
- }
- upload({
- file: ''
- })
- .then(e => {
- console.log(e,'e')
- obj.imgList = [...obj.imgList, ...e];
- console.log(obj.imgList,'imgList')
- obj.imgCount = 10 - obj.imgList.length;
- console.log(obj.imgCount ,'imgCount ')
- })
- .catch(e => {});
- },
- //提交评论
- submit(e) {
- let obj = this;
- if (obj.imgList.length < 1) {
- uni.showToast({
- title: '请添加图片',
- icon: 'none'
- });
- return;
- }
- for (let i = 0; i < obj.imgList.length; i++) {
- obj.cloudimgList.push(obj.imgList[i].url);
- }
- let arr = obj.cloudimgList.join(',');
- order_comment({
- pics: arr,
- comment: obj.text,
- product_score: obj.rateValue1,
- service_score: obj.rateValue2,
- unique: obj.unique,
-
- })
- .then(e => {
- uni.navigateTo({
- url: '/pages/order/order?state=4'
- });
- })
- .catch(e => {
- uni.navigateTo({
- url: '/pages/order/order?state=4'
- });
- });
- },
- //点击图片显示大图
- imgInfo(i) {
- let tempList = [];
- console.log(111);
- this.imgList.forEach(e => {
- tempList.push(e.url);
- });
- console.log(tempList);
- //显示图片
- uni.previewImage({
- current: i,
- loop: false,
- urls: tempList,
- indicator: 'default'
- });
- },
- //删除图片
- delImg(i) {
- uni.showModal({
- content: '确定删除这张吗',
- success: res => {
- if (res.confirm) {
- this.imgList.splice(i, 1);
- this.imgCount++;
- } else if (res.cancel) {
- }
- }
- });
- },
- // 页面跳转
- navto(e) {
- uni.navigateTo({
- url: e
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background: #ffffff;
- height: 100%;
- .content {
- background: #ffffff;
- height: 100%;
- }
- }
- /* 多条商品 */
- .order-item {
- display: flex;
- flex-direction: column;
- padding: 0rpx 30rpx;
- background: #fff;
- margin-top: 20rpx;
- /* 单条商品 */
- .goods-box-single {
- display: flex;
- padding: 20rpx 0;
- .goods-img {
- display: block;
- width: 120rpx;
- height: 120rpx;
- }
- .right {
- flex: 1;
- display: flex;
- flex-direction: column;
- padding: 0 30rpx 0 24rpx;
- overflow: hidden;
- height: 100%;
- .title {
- align-self: flex-start;
- font-size: $font-base + 2rpx;
- color: $font-color-dark;
- height: 80rpx;
- overflow:hidden;
- text-overflow:ellipsis;
- display:-webkit-box;
- -webkit-box-orient:vertical;
- -webkit-line-clamp:2;
- }
- .title-right {
- flex-shrink: 0;
- text-align: right;
- align-self: flex-start;
- }
- .attr-box {
- font-size: $font-sm + 2rpx;
- color: $font-color-light;
- }
- .price {
- font-size: $font-base + 2rpx;
- color: $font-color-dark;
- &:before {
- content: '¥';
- font-size: $font-sm;
- margin: 0 2rpx 0 8rpx;
- }
- }
- }
- }
- }
- .equity_box {
- background-color: #fafafa;
- border-radius: 10rpx;
- padding: 25rpx 25rpx;
- margin: 25rpx 0rpx;
- .text-box {
- height: 200rpx;
- textarea {
- font-size: 25rpx;
- width: 100%;
- height: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 5;
- }
- }
- }
- .zhil {
- font-size: 28rpx !important;
- padding: 15rpx 15rpx;
- }
- .submit-box {
- bottom: 0;
- left: 0;
- width: 750rpx;
- }
- .submit-btn {
- margin-top: 10px;
- display: inline-block;
- width: 670rpx;
- height: 96rpx;
- line-height: 96rpx;
- text-align: center;
- background-color: #1BCC26 !important;
- opacity: 1;
- border-radius: 32rpx;
- border-width: 8rpx;
- border-color: rgba(255, 255, 255, 1);
- box-shadow: 0rpx 8rpx 12rpx rgba(0, 0, 0, 0.16);
- border-radius: 56rpx;
- font-size: 39rpx;
- font-weight: bold;
- color: rgba(255, 255, 255, 1);
- }
- .submit-btn-txt {
- font-size: 39rpx;
- font-weight: bold;
- line-height: 47rpx;
- color: rgba(255, 255, 255, 1);
- opacity: 1;
- }
- .map-box {
- width: 484rpx;
- height: 256rpx;
- border-width: 4rpx;
- border-color: rgba(255, 255, 255, 1);
- box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.16);
- /* border-radius: 12rpx; */
- position: relative;
- }
- .map {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- width: 476rpx;
- height: 250rpx;
- }
- .map-img {
- position: absolute;
- top: 90rpx;
- left: 156rpx;
- width: 230rpx;
- height: 68rpx;
- background-color: rgba(51, 51, 51, 0.64);
- border-width: 1rpx;
- border-color: rgba(0, 0, 0, 0);
- border-radius: 34px;
- font-size: 28rpx;
- font-weight: bold;
- line-height: 66rpx;
- color: rgba(255, 255, 255, 1);
- text-align: center;
- }
- .address-box {
- padding: 15rpx 40rpx;
- margin-bottom: 10px;
- }
- .label {
- font-size: 36rpx;
- font-weight: bold;
- line-height: 50rpx;
- color: #222222;
- }
- .label-img {
- padding-left: 40rpx;
- }
- .add-img-box {
- width: 100%;
- flex-direction: row;
- flex-wrap: wrap;
- margin-top: 50rpx;
- }
- .add-img-item {
- width: 180rpx;
- height: 180rpx;
- border-radius: 24rpx;
- position: relative;
- margin: 0rpx 20rpx;
- margin-bottom: 25rpx;
- .add-img {
- width: 100%;
- height: 100%;
- border-radius: 24rpx;
- }
- }
- .add-img-camera {
- flex: 1;
- }
- .add-img-del {
- position: absolute;
- width: 40rpx;
- height: 40rpx;
- left: 155rpx;
- bottom: 155rpx;
- //background-color: rgba(238, 0, 0, 1);
- border-radius: 20rpx;
- }
- .address-time {
- width: 484rpx;
- height: 88rpx;
- background-color: rgba(245, 245, 245, 1);
- opacity: 1;
- border-radius: 24rpx;
- text-align: center;
- font-size: 35rpx;
- font-weight: 500;
- color: rgba(51, 51, 51, 1);
- }
- .line {
- width: 750rpx;
- height: 1px;
- transform: scaleY(0.3);
- background-color: rgba(0, 0, 0, 0.5);
- }
- </style>
|