|
@@ -2,21 +2,22 @@
|
|
|
<div>
|
|
|
<nav-bar path="index" title="礼品卡"/>
|
|
|
<!--对方的礼物信息-->
|
|
|
+ <!--<p>{{myPresent.name}}-{{receivedPresent.name}}</p>-->
|
|
|
<gift-card
|
|
|
v-if="myPresent.status === 2 || myPresent.status === 3"
|
|
|
- :present-img="recievedPresent.imgUrl"
|
|
|
- :present-name="recievedPresent.name"
|
|
|
- :present-desc="recievedPresent.desc_long"
|
|
|
+ :present-img="receivedPresent.img"
|
|
|
+ :present-name="receivedPresent.name"
|
|
|
+ :present-desc="receivedPresent.desc"
|
|
|
:owner="1"
|
|
|
- :placeId="recievedPresent.placeId"
|
|
|
- :gender="recievedPresent.gender"
|
|
|
- :status="recievedPresent.status"
|
|
|
- :wechat="recievedPresent.wechat"
|
|
|
+ :placeId="receivedPresent.placeId"
|
|
|
+ :gender="receivedPresent.gender"
|
|
|
+ :status="-1"
|
|
|
+ :wechat="receivedPresent.wechat"
|
|
|
/>
|
|
|
<!--我写的感谢信-->
|
|
|
- <div class="letter" v-if="recievedPresent.comment.length !== 0">
|
|
|
+ <div class="letter" v-if="RcommentDo.length !== 0">
|
|
|
<p style="font-size: 110%"><strong>我送出的感谢信</strong></p>
|
|
|
- <p>{{recievedPresent.comment}}</p>
|
|
|
+ <p>{{RcommentDo}}</p>
|
|
|
</div>
|
|
|
<!--我的礼物信息-->
|
|
|
<gift-card
|
|
@@ -29,9 +30,9 @@
|
|
|
:status="myPresent.status"
|
|
|
:wechat="myPresent.wechat"
|
|
|
/>
|
|
|
- <div class="letter" v-if="myPresent.comment.length !== 0">
|
|
|
+ <div class="letter" v-if="commentDo.length !== 0">
|
|
|
<p style="font-size: 110%"><strong>我收到的感谢信</strong></p>
|
|
|
- <p>{{myPresent.comment}}</p>
|
|
|
+ <p>{{commentDo}}</p>
|
|
|
</div>
|
|
|
<div class="letter" v-if="myPresent.status === 4">
|
|
|
<p><strong>审核未通过,请前往首页重新发布礼物!</strong></p>
|
|
@@ -86,15 +87,15 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- myPresent: {
|
|
|
- placeId: 1,
|
|
|
- comment: '',
|
|
|
- },
|
|
|
+ myPresent: {},
|
|
|
reason: '',
|
|
|
- recievedPresent: {
|
|
|
- comment: ''
|
|
|
- },
|
|
|
- giftDo : {}
|
|
|
+ receivedPresent: {},
|
|
|
+ giftDo: {},
|
|
|
+ identityDo: {},
|
|
|
+ commentDo: '',
|
|
|
+ RgiftDo: {},
|
|
|
+ RidentityDo: {},
|
|
|
+ RcommentDo: ''
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
@@ -111,8 +112,7 @@
|
|
|
Dialog.confirm({
|
|
|
message: '确认删除礼物吗?'
|
|
|
}).then(() => {
|
|
|
- // on confirm
|
|
|
- // TODO: 考虑 updateBatch, 就是需要 将isDel设为1, 配合首页查找进行过滤
|
|
|
+ // 删除礼物:将isDel设为1
|
|
|
Toast.loading({
|
|
|
mask: true,
|
|
|
message: '加载中...',
|
|
@@ -172,35 +172,145 @@
|
|
|
}
|
|
|
}, {});
|
|
|
},
|
|
|
- onloadGift(){
|
|
|
- let that = this;
|
|
|
+ initGifts() {
|
|
|
+ if (this.RgiftDo.goodid !== undefined) {
|
|
|
+ let rpresent = {};
|
|
|
+ let ridentity = this.RidentityDo;
|
|
|
+ rpresent.id = this.RgiftDo.goodid;
|
|
|
+ rpresent.name = this.RgiftDo.name;
|
|
|
+ rpresent.desc = this.RgiftDo.description;
|
|
|
+ rpresent.gender = ridentity.userSex;
|
|
|
+ rpresent.placeId = ridentity.dormDistrict;
|
|
|
+ rpresent.wechat = ridentity.userWxAccount;
|
|
|
+ rpresent.img = "http://pjczv6ygf.bkt.clouddn.com/mysterious%20gift.jpg";
|
|
|
+ this.receivedPresent = rpresent;
|
|
|
+ }
|
|
|
let present = {};
|
|
|
- let identity = this.identityDo;
|
|
|
+ let identity = {};
|
|
|
+ identity = this.identityDo;
|
|
|
present.id = this.giftDo.goodid;
|
|
|
present.name = this.giftDo.name;
|
|
|
present.desc = this.giftDo.description;
|
|
|
present.status = this.giftDo.sort;
|
|
|
present.gender = this.giftDo.goodFirstKind;
|
|
|
- present.comment = '';
|
|
|
present.placeId = identity.dormDistrict;
|
|
|
present.wechat = identity.userWxAccount;
|
|
|
present.img = "http://gift.fogice.com" + this.giftDo.img;
|
|
|
- that.myPresent = present;
|
|
|
+ this.myPresent = present;
|
|
|
+ },
|
|
|
+ onloadGift(){
|
|
|
+ let that = this;
|
|
|
+ let status = this.giftDo.sort;
|
|
|
+ let id = this.giftDo.goodid;
|
|
|
// console.log(that.myPresent);
|
|
|
- if (present.status === 3) BasicFunction.get_data('smartOrderFeedback/list?goodid=' + present.id, function (res) {
|
|
|
- // console.log(res);
|
|
|
+ if (status >= 2) {
|
|
|
+ if (status === 4) that.onloadReview(id);
|
|
|
+ let userid = localStorage.getItem('frontend-userid');
|
|
|
+ BasicFunction.get_data('smartOrder/list?userId=' + userid, function (orderRes) {
|
|
|
+ try {
|
|
|
+ console.log('----- order res -----');
|
|
|
+ console.log(orderRes);
|
|
|
+ if (orderRes.ret === '10000' && orderRes.model.list !== undefined && orderRes.model.list.length !== 0) {
|
|
|
+ let order = orderRes.model.list[0];
|
|
|
+ let receiverId = parseInt(order.note);
|
|
|
+ BasicFunction.get_data('smartGoods/list?goodid=' + receiverId, function (receiverRes) {
|
|
|
+ console.log('----- received gift -----');
|
|
|
+ try {
|
|
|
+ console.log(receiverRes);
|
|
|
+ if (receiverRes.ret === '10000') {
|
|
|
+ if (receiverRes.model === undefined || receiverRes.model == null || receiverRes.model.list == undefined || receiverRes.model.list.length <= 0) {
|
|
|
+ Toast.fail('礼物查看遇到问题,请稍等一下再试吧');
|
|
|
+ that.$router.push('index');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ that.RgiftDo = receiverRes.model.list[0];
|
|
|
+ that.onloadReceiveGift(id, status);
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.warn(e);
|
|
|
+ Toast.fail('获取数据失败,请重试');
|
|
|
+ }
|
|
|
+ }, {});
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.warn(e);
|
|
|
+ Toast.fail('数据异常!请重试');
|
|
|
+ }
|
|
|
+ }, {})
|
|
|
+ } else this.initGifts();
|
|
|
+ },
|
|
|
+ onloadReceiveGift(myid, status) {
|
|
|
+ let receiverId = this.RgiftDo.ownerId;
|
|
|
+ let that = this;
|
|
|
+ BasicFunction.get_data('smartIdentity/list?userId=' + receiverId, function (recvRes) {
|
|
|
+ try {
|
|
|
+ console.log("----- receiver's identity");
|
|
|
+ console.log(recvRes);
|
|
|
+ if (recvRes.ret === '10000' && recvRes.model !== undefined && recvRes.model.list.length !== 0) {
|
|
|
+ that.RidentityDo = recvRes.model.list[0];
|
|
|
+ if (status === 3) that.onloadFeedback(myid, receiverId);
|
|
|
+ else that.initGifts();
|
|
|
+ } else {
|
|
|
+ Toast.fail('获取数据失败,请重试');
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e);
|
|
|
+ Toast.fail('获取数据失败,请重试');
|
|
|
+ }
|
|
|
+ }, {});
|
|
|
+ },
|
|
|
+ onloadFeedback(myid, receiverId) {
|
|
|
+ let that = this;
|
|
|
+ BasicFunction.get_data('smartOrderFeedback/list?goodId=' + myid, function (res) {
|
|
|
+ console.log('----- received feedback -----');
|
|
|
+ console.log(res);
|
|
|
try {
|
|
|
- let comment = res.model.list[0];
|
|
|
if (res.ret === '10000') {
|
|
|
- if (comment.length === 0) that.myPresent.comment = '暂未收到';
|
|
|
- else that.myPresent.comment = comment.content;
|
|
|
- } else Toast.fail('获取信息失败');
|
|
|
+ let comment = {
|
|
|
+ content: '暂未收到'
|
|
|
+ };
|
|
|
+ if (res.model.list !== undefined && res.model.list.length !== 0) {
|
|
|
+ comment = res.model.list[0];
|
|
|
+ }
|
|
|
+ that.commentDo = comment.content;
|
|
|
+ // 对方的评价
|
|
|
+ BasicFunction.get_data('smartOrderFeedback/list?goodId=' + receiverId, function (recvRes) {
|
|
|
+ console.log('----- sent feedback -----');
|
|
|
+ console.log(res);
|
|
|
+ try {
|
|
|
+ if (recvRes.ret === '10000') {
|
|
|
+ let comment = {
|
|
|
+ content: '感谢信未发送或发送失败'
|
|
|
+ };
|
|
|
+ if (recvRes.model.list !== undefined && recvRes.model.list.length !== 0) {
|
|
|
+ comment = recvRes.model.list[0];
|
|
|
+ }
|
|
|
+ that.RcommentDo = comment.content;
|
|
|
+ that.initGifts();
|
|
|
+ } else {
|
|
|
+ Toast.fail('获取信息失败');
|
|
|
+ that.initGifts();
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.warn(e);
|
|
|
+ Toast.fail('获取信息失败');
|
|
|
+ that.initGifts();
|
|
|
+ }
|
|
|
+ }, {});
|
|
|
+ } else {
|
|
|
+ Toast.fail('获取信息失败');
|
|
|
+ that.initGifts();
|
|
|
+ }
|
|
|
} catch (e) {
|
|
|
console.warn(e);
|
|
|
Toast.fail('获取信息失败');
|
|
|
+ that.initGifts();
|
|
|
}
|
|
|
}, {});
|
|
|
- if (present.status === 4) BasicFunction.get_data('smartGoodReview/list?goodId=' + present.id, function (res) {
|
|
|
+ },
|
|
|
+ onloadReview(goodid) {
|
|
|
+ let that = this;
|
|
|
+ BasicFunction.get_data('smartGoodReview/list?goodId=' + goodid, function (res) {
|
|
|
if (res.ret === '10000' && res.model.list !== undefined) {
|
|
|
if (res.model.list.length !== 0) {
|
|
|
let i = sortReason(res.model.list);
|