Style(店铺):界面调整
This commit is contained in:
+11
@@ -198,3 +198,14 @@ export function getHotelTypeList() {
|
|||||||
export function getPoster(id) {
|
export function getPoster(id) {
|
||||||
return request.get("/api/hotelMain/poster/" + id, {}, {login: true})
|
return request.get("/api/hotelMain/poster/" + id, {}, {login: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客栈商品列表
|
||||||
|
* @param data
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
export function getHotelGoodList(data) {
|
||||||
|
return request.get("/api/hotelMain/goodsList", data, {
|
||||||
|
login: false
|
||||||
|
});
|
||||||
|
}
|
||||||
+18
-84
@@ -357,7 +357,7 @@ import {
|
|||||||
getHotelNewsList,
|
getHotelNewsList,
|
||||||
getHotelZan,
|
getHotelZan,
|
||||||
getPoster,
|
getPoster,
|
||||||
goodsList,
|
getHotelGoodList,
|
||||||
postHotelNewsDel
|
postHotelNewsDel
|
||||||
} from "@/api/inn.js";
|
} from "@/api/inn.js";
|
||||||
import {formatDateTime} from "@/utils";
|
import {formatDateTime} from "@/utils";
|
||||||
@@ -436,18 +436,15 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.partnerId) cookie.set("spread", this.partnerId);
|
if (this.partnerId) cookie.set("spread", this.partnerId);
|
||||||
|
|
||||||
this.fetchInnDetail();
|
this.fetchInnDetail();
|
||||||
this.fetchInnInfoList();
|
this.fetchInnInfoList();
|
||||||
this.initPoster();
|
this.initPoster();
|
||||||
|
|
||||||
let that = this;
|
let that = this;
|
||||||
this.isMyInn = (this.$yroute.query.isMyInn != null ? true : false);
|
this.isMyInn = (this.$yroute.query.isMyInn != null ? true : false);
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success: (e) => {
|
success: (e) => {
|
||||||
//两列商品宽度
|
//两列商品宽度
|
||||||
that.picColumnWidth = (e.screenWidth - uni.upx2px(92)) / 2 + 'px';
|
that.picColumnWidth = (e.screenWidth - uni.upx2px(92)) / 2 + 'px';
|
||||||
console.log('picColumnWidth:' + that.picColumnWidth);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -460,28 +457,12 @@ export default {
|
|||||||
this.fetchInnInfoList();
|
this.fetchInnInfoList();
|
||||||
} else {
|
} else {
|
||||||
this.fetchInnDetail();
|
this.fetchInnDetail();
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 上拉触底
|
|
||||||
onReachBottom() {
|
|
||||||
if (this.activeIndex === 3) {
|
|
||||||
this.goodsPage++;
|
|
||||||
this.fetchGoods();
|
|
||||||
} else {
|
|
||||||
!this.loading && this.fetchInnInfoList();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeShare() {
|
changeShare() {
|
||||||
this.showShare = !this.showShare;
|
this.showShare = !this.showShare;
|
||||||
},
|
},
|
||||||
goRoom() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pkg_common/views/room?id=${this.inn.merId}&name=${this.inn.name}`
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
goGoodsConByID(item) {
|
goGoodsConByID(item) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: '/pages/shop/GoodsCon/index',
|
path: '/pages/shop/GoodsCon/index',
|
||||||
@@ -490,10 +471,8 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
saveImg() {
|
saveImg() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
||||||
uni.getSetting({
|
uni.getSetting({
|
||||||
success: getRes => {
|
success: getRes => {
|
||||||
if (getRes.authSetting["scope.writePhotosAlbum"]) {
|
if (getRes.authSetting["scope.writePhotosAlbum"]) {
|
||||||
@@ -526,17 +505,13 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadImage() {
|
downloadImage() {
|
||||||
let that = this;
|
let that = this;
|
||||||
const randomID = () => Math.random().toString(36).substring(2);
|
const randomID = () => Math.random().toString(36).substring(2);
|
||||||
|
|
||||||
uni.downloadFile({
|
uni.downloadFile({
|
||||||
url: this.posterUrl, //网络图片的地址
|
url: this.posterUrl, //网络图片的地址
|
||||||
filePath: wx.env.USER_DATA_PATH + "/share_" + randomID() + ".png", //指定的本地文件路径
|
filePath: wx.env.USER_DATA_PATH + "/share_" + randomID() + ".png", //指定的本地文件路径
|
||||||
success: downRes => {
|
success: downRes => {
|
||||||
console.log(typeof downRes, downRes, "down")
|
|
||||||
|
|
||||||
uni.saveImageToPhotosAlbum({
|
uni.saveImageToPhotosAlbum({
|
||||||
filePath: downRes.filePath, //临时文件地址
|
filePath: downRes.filePath, //临时文件地址
|
||||||
success: function () {
|
success: function () {
|
||||||
@@ -564,7 +539,6 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
doExpandDesc: function () {
|
doExpandDesc: function () {
|
||||||
this.isExpand = !this.isExpand;
|
this.isExpand = !this.isExpand;
|
||||||
},
|
},
|
||||||
@@ -593,7 +567,6 @@ export default {
|
|||||||
publishBtnClick: function () {
|
publishBtnClick: function () {
|
||||||
this.$yrouter.push('/pagesInn/inn/innInfoPublish?hotelId=' + this.inn.id);
|
this.$yrouter.push('/pagesInn/inn/innInfoPublish?hotelId=' + this.inn.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
modifyBtnClick: function () {
|
modifyBtnClick: function () {
|
||||||
this.$yrouter.push("/pagesInn/inn/innProfileEdit?hotel=" + encodeURIComponent(JSON.stringify(this.inn)));
|
this.$yrouter.push("/pagesInn/inn/innProfileEdit?hotel=" + encodeURIComponent(JSON.stringify(this.inn)));
|
||||||
// this.$yrouter.push('/pagesInn/inn/innProfileEdit');
|
// this.$yrouter.push('/pagesInn/inn/innProfileEdit');
|
||||||
@@ -612,47 +585,28 @@ export default {
|
|||||||
|
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
uni.showLoading();
|
uni.showLoading();
|
||||||
var param = {
|
postHotelNewsDel({
|
||||||
id: info.id,
|
id: info.id,
|
||||||
hotelId: that.inn.id
|
hotelId: that.inn.id
|
||||||
}
|
}).then((res1) => {
|
||||||
postHotelNewsDel(param).then((res1) => {
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
|
||||||
|
|
||||||
that.$dialog.toast({
|
that.$dialog.toast({
|
||||||
mes: '删除成功!'
|
mes: '删除成功!'
|
||||||
});
|
});
|
||||||
//删除成功刷新动态列表
|
// 删除成功刷新动态列表
|
||||||
that.page = 1;
|
that.page = 1;
|
||||||
that.loading = false;
|
that.loading = false;
|
||||||
that.loadend = false;
|
that.loadend = false;
|
||||||
that.fetchInnInfoList();
|
that.fetchInnInfoList();
|
||||||
|
|
||||||
// setTimeout(function() {
|
|
||||||
|
|
||||||
|
|
||||||
// }, 1000);
|
|
||||||
|
|
||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err.msg,
|
title: err.msg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 1500
|
duration: 1500
|
||||||
});
|
});
|
||||||
|
})
|
||||||
}).finally(() => {
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
},
|
|
||||||
complete: () => {
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -661,12 +615,11 @@ export default {
|
|||||||
if (that.loading) return; //阻止下次请求(false可以进行请求);
|
if (that.loading) return; //阻止下次请求(false可以进行请求);
|
||||||
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
|
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
|
||||||
that.loading = true;
|
that.loading = true;
|
||||||
let q = {
|
getHotelNewsList({
|
||||||
page: that.page,
|
page: that.page,
|
||||||
limit: that.limit,
|
limit: that.limit,
|
||||||
hotelId: that.id
|
hotelId: that.id
|
||||||
};
|
}).then(res => {
|
||||||
getHotelNewsList(q).then(res => {
|
|
||||||
that.loading = false;
|
that.loading = false;
|
||||||
//apply();js将一个数组插入另一个数组;
|
//apply();js将一个数组插入另一个数组;
|
||||||
if (that.page == 1) {
|
if (that.page == 1) {
|
||||||
@@ -698,7 +651,7 @@ export default {
|
|||||||
fetchInnDetail: function () {
|
fetchInnDetail: function () {
|
||||||
const that = this
|
const that = this
|
||||||
let reqFn = null
|
let reqFn = null
|
||||||
if (this.isMyInn) {
|
if (that.isMyInn) {
|
||||||
reqFn = getHotelDetail
|
reqFn = getHotelDetail
|
||||||
} else {
|
} else {
|
||||||
reqFn = getHomeHotelDetail
|
reqFn = getHomeHotelDetail
|
||||||
@@ -717,6 +670,8 @@ export default {
|
|||||||
if (data.hasProduct <= 0) {
|
if (data.hasProduct <= 0) {
|
||||||
that.activeIndex = 1
|
that.activeIndex = 1
|
||||||
that.tabList[0].isShow = false
|
that.tabList[0].isShow = false
|
||||||
|
} else {
|
||||||
|
that.fetchGoods()
|
||||||
}
|
}
|
||||||
// coverType: 1-图片,2-视频
|
// coverType: 1-图片,2-视频
|
||||||
if (data.coverType === 2) {
|
if (data.coverType === 2) {
|
||||||
@@ -766,18 +721,6 @@ export default {
|
|||||||
getPoster(this.id).then(({data}) => this.posterUrl = data);
|
getPoster(this.id).then(({data}) => this.posterUrl = data);
|
||||||
},
|
},
|
||||||
showLocation: function () {
|
showLocation: function () {
|
||||||
// if (this.inn.position != null && this.inn.position.length > 0) {
|
|
||||||
// var arr = this.inn.position.split(",");
|
|
||||||
// uni.openLocation({
|
|
||||||
// latitude: parseFloat(arr[1]),
|
|
||||||
// longitude: parseFloat(arr[0]),
|
|
||||||
// success: function () {
|
|
||||||
// console.log('success');
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// this.$dialog.error('暂无位置信息');
|
|
||||||
// }
|
|
||||||
if (!this.inn.latitude || !this.inn.longitude) {
|
if (!this.inn.latitude || !this.inn.longitude) {
|
||||||
this.$dialog.error('暂无位置信息');
|
this.$dialog.error('暂无位置信息');
|
||||||
} else {
|
} else {
|
||||||
@@ -798,56 +741,47 @@ export default {
|
|||||||
this.page = 1;
|
this.page = 1;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.loadend = false;
|
this.loadend = false;
|
||||||
|
|
||||||
//刷新数据
|
//刷新数据
|
||||||
switch (this.activeIndex) {
|
switch (this.activeIndex) {
|
||||||
case 0:
|
|
||||||
this.fetchInnDetail();
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
this.fetchInnInfoList();
|
this.fetchInnInfoList();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 0:
|
||||||
this.goodsPage = 1;
|
this.goodsPage = 1;
|
||||||
this.goodsList = [];
|
this.goodsList = [];
|
||||||
this.fetchGoods();
|
this.fetchGoods();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetchGoods() {
|
fetchGoods() {
|
||||||
goodsList({
|
getHotelGoodList({
|
||||||
id: this.inn.id,
|
id: this.inn.id,
|
||||||
page: this.goodsPage
|
page: this.goodsPage,
|
||||||
}).then(({
|
limit: 12
|
||||||
data
|
}).then(data => {
|
||||||
}) => {
|
const len = data.records.length;
|
||||||
let len = data.records.length;
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
this.goodsList.push(data.records[i]);
|
this.goodsList.push(data.records[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
call: function () {
|
call: function () {
|
||||||
|
|
||||||
if (this.inn.tel != undefined && this.inn.tel.length > 0) {
|
if (this.inn.tel != undefined && this.inn.tel.length > 0) {
|
||||||
uni.makePhoneCall({
|
uni.makePhoneCall({
|
||||||
|
|
||||||
// 手机号
|
// 手机号
|
||||||
phoneNumber: this.inn.tel,
|
phoneNumber: this.inn.tel,
|
||||||
|
|
||||||
// 成功回调
|
// 成功回调
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('调用成功!')
|
console.log('调用成功!')
|
||||||
},
|
},
|
||||||
|
|
||||||
// 失败回调
|
// 失败回调
|
||||||
fail: (res) => {
|
fail: (res) => {
|
||||||
console.log('调用失败!')
|
console.log('调用失败!')
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$dialog.error('电话为空');
|
this.$dialog.error('电话为空');
|
||||||
|
|||||||
Reference in New Issue
Block a user