123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <template>
- <view class="main">
- <view class="one">
- <view class="one_1">
- <image v-if="info.source&&info.source.file.length>0" class="image"
- :src="info.source.file&&info.source.file.length>0?info.source.file[0].url:''">
- </image>
- <image v-else class="image" :src="config.logo_url&&config.logo_url.length>0?config.logo_url[0].url:''">
- </image>
- <text v-if="info.type=='0'">酒店民宿</text>
- <text v-else>景区门票</text>
- </view>
- <view class="one_2">
- <view class="left">
- <image v-if="info.source&&info.source.file.length>0" class="image"
- :src="info.source.file&&info.source.file.length>0?info.source.file[0].url:''">
- </image>
- <image v-else class="image"
- :src="config.logo_url&&config.logo_url.length>0?config.logo_url[0].url:''">
- </image>
- </view>
- <view class="right">
- <view class="right_1">
- <view class="left">
- <view class="name textOver">{{info.source_name||'暂无'}}</view>
- <view class="other">{{info.zhType||'暂无'}}</view>
- <view class="other">{{info.zhPerson||'暂无'}}</view>
- </view>
- <view class="right">
- <view class="other">
- ¥{{info.source.money||'0'}}
- </view>
- <view class="other">
- ×{{info.num||'0'}}
- </view>
- </view>
- </view>
- <view class="right_2">
- 合计:¥{{info.money||'0'}}
- </view>
- </view>
- </view>
- </view>
- <view class="two">
- <uni-forms class="form" ref="form" :rules="rules" :modelValue="form" label-position="top" label-width='100'>
- <uni-forms-item label="评分(必填)" required name="rate">
- <uni-rate v-model="form.rate" />
- </uni-forms-item>
- <uni-forms-item label="内容(必填)" required name="content">
- <uni-easyinput type="textarea" v-model="form.content" placeholder="请输入内容" />
- </uni-forms-item>
- <uni-forms-item label="上传图片0/3(选填)" name="file">
- <upload class='upload' :list="form.file" name="file" :count="3" @uplSuc="uplSuc" @uplDel="uplDel">
- </upload>
- </uni-forms-item>
- </uni-forms>
- <button class="button" type="primary" @click="submit('form')">提交</button>
- </view>
- </view>
- </template>
- <script>
- import moment from 'moment';
- import upload from '../../components/upload/index.vue';
- export default {
- components: {
- upload
- },
- data() {
- return {
- id: '',
- config: {
- logo_url: []
- },
- user: {},
- info: {
- source: {
- file: []
- }
- },
- form: {
- file: []
- },
- statusList: [],
- personList: [],
- typeList: [],
- // 校验规则
- rules: {
- rate: {
- rules: [{
- required: true,
- errorMessage: '请选择评分'
- }]
- },
- content: {
- rules: [{
- required: true,
- errorMessage: '请输入内容'
- }]
- },
- },
- }
- },
- onLoad: async function(e) {
- const that = this;
- that.$set(that, `id`, e && e.id || '');
- that.searchConfig();
- that.searchToken();
- await that.searchOther();
- that.search();
- },
- methods: {
- searchConfig() {
- const that = this;
- try {
- const res = uni.getStorageSync('config');
- if (res) that.$set(that, `config`, res);
- } catch (e) {
- uni.showToast({
- title: err.errmsg,
- icon: 'error',
- duration: 2000
- });
- }
- },
- searchToken() {
- const that = this;
- try {
- const res = uni.getStorageSync('token');
- if (res) that.$set(that, `user`, res);
- } catch (e) {
- uni.showToast({
- title: err.errmsg,
- icon: 'error',
- duration: 2000
- });
- }
- },
- async search() {
- const that = this;
- if (that.id) {
- const res = await that.$api(`/order/${that.id}`, 'GET', {})
- if (res.errcode == '0') {
- const status = that.statusList.find(i => i.value == res.data.status)
- if (status) res.data.zhStatus = status.label
- if (res.data && res.data.source && res.data.source.person) {
- const person = that.personList.find(i => i.value == res.data.source.person)
- if (person) res.data.zhPerson = person.label
- }
- if (res.data && res.data.source && res.data.source.type) {
- const type = that.typeList.find(i => i.value == res.data.source.type)
- if (type) res.data.zhType = type.label
- }
- that.$set(that, `info`, res.data)
- } else {
- uni.showToast({
- title: res.errmsg,
- });
- }
- }
- },
- // 图片上传
- uplSuc(e) {
- const that = this;
- that.$set(that.form, `${e.name}`, [...that.form[e.name], e.data]);
- },
- // 图片删除
- uplDel(e) {
- const that = this;
- let data = that.form[e.name];
- let arr = data.filter((i, index) => index != e.data.index);
- that.$set(that.form, `${e.name}`, arr)
- },
- submit(ref) {
- const that = this;
- that.$refs[ref].validate().then(async data => {
- data.user = that.user._id
- data.order = that.id
- data.source = that.info.source._id
- data.type = that.info.type
- data.create_time = moment().format('YYYY-MM-DD HH:mm:ss')
- const res = await that.$api(`/rateOrder`, 'POST', data);
- if (res.errcode == '0') {
- const arr = await that.$api(`/order/${that.id}`, 'POST', {
- status: "7"
- })
- if (arr.errcode == '0') {
- uni.showToast({
- title: '评价成功',
- icon: 'none'
- })
- uni.navigateBack({
- delta: 1
- })
- } else {
- uni.showToast({
- title: res.errmsg,
- });
- }
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: 'none'
- })
- }
- }).catch(err => {
- console.log('err', err);
- })
- },
- // 查询其他信息
- async searchOther() {
- const that = this;
- let res;
- // 查询类型
- res = await that.$api(`/dictData`, 'GET', {
- type: 'order_status',
- is_use: '0',
- })
- if (res.errcode == '0') that.$set(that, `statusList`, res.data);
- // 出游人群
- res = await that.$api(`/dictData`, 'GET', {
- type: 'ticket_person',
- is_use: '0',
- })
- if (res.errcode == '0') that.$set(that, `personList`, res.data);
- // 服务特色
- res = await that.$api(`/dictData`, 'GET', {
- type: 'ticket_type',
- is_use: '0',
- })
- if (res.errcode == '0') that.$set(that, `typeList`, res.data);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .main {
- .one {
- background-color: var(--mainColor);
- border-radius: 5px;
- margin: 2vw 2vw 0 2vw;
- padding: 2vw;
- border: 1px solid #d5d5da;
- .one_1 {
- display: flex;
- align-items: center;
- .image {
- width: 8vw;
- height: 8vw;
- border-radius: 8vw;
- }
- text {
- padding: 0 0 0 2vw;
- }
- }
- .one_2 {
- display: flex;
- justify-content: space-between;
- margin: 2vw 0 0 0;
- padding: 0 2vw;
- .left {
- width: 20vw;
- .image {
- width: 20vw;
- height: 20vw;
- border-radius: 1vw;
- }
- }
- .right {
- width: 65vw;
- margin: 0 0 0 2vw;
- .right_1 {
- display: flex;
- justify-content: space-between;
- .left {
- width: 55vw;
- .name {
- font-size: var(--font14Size);
- }
- .other {
- padding: 2px 0 0 0;
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- .right {
- width: 10vw;
- text-align: right;
- .other {
- padding: 2px 0 0 0;
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- }
- .right_2 {
- text-align: right;
- font-size: var(--font12Size);
- }
- }
- }
- }
- .two {
- padding: 2vw;
- .form-item {
- display: flex;
- align-items: center;
- }
- .button {
- background-color: var(--f3CColor);
- }
- }
- }
- </style>
|