Browse Source

add tid1731 logic

tid1731
刘嘉炜 4 weeks ago
parent
commit
106b6a6859
  1. 11
      src/pages.json
  2. 37
      src/pages/index/index.vue
  3. 6
      src/subpackage/complaint/js/api.js
  4. 10
      src/subpackage/complaint/js/server.js
  5. 224
      src/subpackage/complaint/pages/operate.vue
  6. BIN
      src/subpackage/complaint/static/images/camera.png
  7. BIN
      src/subpackage/complaint/static/images/close.png

11
src/pages.json

@ -901,6 +901,17 @@
}
}
]
},
{
"root": "subpackage/complaint",
"pages": [
{
"path": "pages/operate",
"style" : {
"navigationBarTitleText": "投诉建议"
}
}
]
}
],
"globalStyle": {

37
src/pages/index/index.vue

@ -80,7 +80,9 @@
<image class="f_icon" src="/static/images/icon/index/scan_icon_white.png" mode="scaleToFill"/>
<text>核销</text>
</view>
<view class="complaint-btn" @click="toComplaint">
</view>
</view>
</template>
<script>
@ -224,6 +226,10 @@
if(JSON.stringify(indexData)!='{}'&&!!app.isLogin())this.getIndexInfo();
},
methods: {
toComplaint(){
let { indexData } = this;
util.routeTo(`/subpackage/complaint/pages/operate?brand_id=${indexData?.brand?.id ?? ''}`,'nT');
},
// ID1000840
isPermissionShowTab(e){
let { indexData } = this;
@ -737,24 +743,29 @@
// fly_btn
.fly_btn{
position: fixed;
bottom: 100rpx;
right: 80rpx;
bottom: 20rpx;
bottom: calc( 20rpx + constant(safe-area-inset-bottom));
bottom: calc( 20rpx + env(safe-area-inset-bottom));
right: 0rpx;
width: 148upx;
height: 148upx;
@include centerFlex(center);
flex-direction: column;
.f_bg{
position: absolute;
width: 148upx;
height: 148upx;
width: 100%;
height: 100%;
}
.f_icon{
z-index: 3;
position: relative;
width: 40rpx;
height: 40rpx;
}
>text{
z-index: 3;
font-size: 20rpx;
color: #fff;
position: relative;
text-align: center;
margin-top: 8upx;
@include flcw(20rpx, 28rpx, #fff, 500);
}
}
@ -762,4 +773,14 @@
height:250rpx;
width: 1rpx;
}
.complaint-btn{
position: fixed;
bottom: 190rpx;
bottom: calc( 190rpx + constant(safe-area-inset-bottom));
bottom: calc( 190rpx + env(safe-area-inset-bottom));
right: 00rpx;
width: 148upx;
height: 148upx;
background: skyblue;
}
</style>

6
src/subpackage/complaint/js/api.js

@ -0,0 +1,6 @@
import { ORIGIN } from "@/js/api";
export const COMPLAINT_API = {
uploadComplaintImgs:`${ORIGIN}/upload/file/complaint_imgs`, // 反馈图片上传
complaintSubmit:`${ORIGIN}/admin/assistant/complaint/submit`, // 商家助手 - 商家投诉建议
}

10
src/subpackage/complaint/js/server.js

@ -0,0 +1,10 @@
import { Server } from '@/js/server';
class C_Server extends Server {
constructor(props){
super(props)
}
}
export default new C_Server();

224
src/subpackage/complaint/pages/operate.vue

@ -0,0 +1,224 @@
<template>
<view class="complaint-operate">
<view class="co-box">
<view class="co-tit"><text class="ct-star">*</text>反馈内容</view>
<view class="co-space"></view>
<textarea class="co-textarea" placeholder="请输入" v-model="iptTxt"></textarea>
</view>
<view class="co-space"></view>
<view class="co-box co-upload">
<view class="co-tit">上传图片</view>
<view class="co-space"></view>
<view class="co-ls">
<view class="cl-item" v-for="(e, i) in imgTempLs" :key="i">
<image class="ci-close" @click="delImg(i)" src="/subpackage/complaint/static/images/close.png"></image>
<image class="ci-img" mode="aspectFill" :src="e"></image>
</view>
<view class="cl-item cl-add" @click="chooseImg">
<image class="ca-icon" mode="aspectFit" src="/subpackage/complaint/static/images/camera.png"></image>
</view>
</view>
</view>
<view class="co-fixed">
<view class="cf-btn">取消</view>
<view class="cf-btn" @click="submitBtn">提交</view>
</view>
</view>
</template>
<script>
import { routeTo, showModal, jsonPar, showLoad, hideLoad, showNone } from "@/utils/util.js";
import server from '../js/server';
import { COMPLAINT_API } from '../js/api';
export default {
data(){
return {
iptTxt: '',
imgTempLs: [],
brand_id: ''
}
},
onLoad(options){
this.brand_id = options?.brand_id ?? '';
},
methods: {
chooseImg(){
uni.chooseImage({
success: imgRes =>{
console.log(imgRes);
this.imgTempLs = imgRes?.tempFilePaths || []
},
failMsg: imgErr => {
console.warn('complaint operate chooseImage err --->' , imgErr);
}
})
},
delImg(idx){
this.imgTempLs.splice(idx, 1);
},
async submitBtn(){
let { iptTxt, imgTempLs, brand_id } = this;
if(!iptTxt)return showModal({ title: '提示', content: '请输入反馈内容' });
try{
showLoad();
let _imgLs = await Promise.all(imgTempLs.map((e, i) => {
return this.uploadImg(e)
}));
hideLoad();
this.submitComplaintInfo({
brand_id: brand_id,
mc_text: iptTxt ?? '',
mc_imgs: _imgLs?.map(e => e?.url ?? '') || []
})
}catch(err){
hideLoad();
console.warn('complaint operate submitBtn err --->', err);
}
},
uploadImg(imgPath){
return server.uploadFile({
url: COMPLAINT_API.uploadComplaintImgs,
filePath: imgPath,
})
.then(res => {
let _res = jsonPar(res.data);
if(_res.code == 0){
return _res.data;
}else{
return Promise.reject(_res);
}
})
.catch(err => {
console.warn('complaint operate uploadImg err --->', err);
return ({
type: 'error',
tempPath: imgPath
})
})
},
//
submitComplaintInfo({ brand_id, mc_text, mc_imgs }){
showLoad();
return server.post({
url: COMPLAINT_API.complaintSubmit,
data: { brand_id, mc_text, mc_imgs },
isDefaultGet: false,
})
.then(res=>{
hideLoad();
let _data = res?.data || {};
if(_data?.code === 0){
showNone('操作成功!');
setTimeout(routeTo, 1000);
}else{
return Promise.reject(_data);
}
})
.catch(err=>{
hideLoad();
showModal({
title: '提示',
content: err.message || '操作失败!'
})
console.warn('complaint operate submitComplaintInfo err --->', err);
})
},
}
}
</script>
<style lang='scss'>
page {
background-color: #F2F2F7;
}
.complaint-operate{
padding: 24upx;
@include isPd(122upx);
.co-space{
height: 24upx
}
.co-tit{
@include flcw(32upx, 44upx, #1a1a1a, 500);
.ct-star{
color: #EA5061;
}
}
.co-box{
padding: 30upx;
border-radius: 20upx;
background: #fff;
}
.co-textarea{
padding: 20upx;
width: auto;
height: 306upx;
border-radius: 16upx;
background: #F6F8F9;
@include flcw(32upx, 44upx, #1a1a1a);
}
.co-upload{
padding: 30upx 20upx;
.co-ls{
font-size: 0;
.cl-item{
position: relative;
margin: 24upx 10upx 0upx;
display: inline-block;
vertical-align: middle;
width: 200upx;
height: 200upx;
border-radius: 10upx;
overflow: hidden;
&.cl-add{
padding-top: 36upx;
border: 2upx dashed #D8D8D8;
.ca-icon{
display: block;
margin: 0 auto;
width: 120upx;
height: 120upx;
}
}
.ci-close{
position: absolute;
top: 6upx;
right: 6upx;
width: 40upx;
height: 40upx;
}
.ci-img{
width: 100%;
height: 100%;
}
}
}
}
.co-fixed{
position: fixed;
left: 0;
bottom: 0;
padding: 10upx 30upx;
width: 100%;
background: #F2F2F7;
@include ctf(center);
.cf-btn{
margin: 0 20upx;
width: 240upx;
text-align: center;
border: 1px solid $mColor;
border-radius: 50upx;
@include flcw(32upx, 92upx, $mColor);
background: #fff;
&+.cf-btn{
background: $mColor;
color: #fff;
}
}
}
}
</style>

BIN
src/subpackage/complaint/static/images/camera.png

After

Width: 60  |  Height: 60  |  Size: 862 B

BIN
src/subpackage/complaint/static/images/close.png

After

Width: 20  |  Height: 20  |  Size: 215 B

Loading…
Cancel
Save