diff --git a/api/inn.js b/api/inn.js index dbd61a4..83a09ad 100644 --- a/api/inn.js +++ b/api/inn.js @@ -197,4 +197,26 @@ export function getHotelTypeList() { * */ export function getPoster(id) { 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 + }); +} + +/** + * 置顶客栈资讯 + * @param data + * @returns {*} + */ +export function setTopHotelNew(data) { + return request.post("/api/hotelNews/setIsTop", data, { + login: true + }); } \ No newline at end of file diff --git a/api/product.js b/api/product.js index da4eaf6..9df683e 100644 --- a/api/product.js +++ b/api/product.js @@ -16,9 +16,17 @@ export function wellnessPlaceList(param) { /** * 特色礼品首页 - * */ + */ export function customizedGift() { - return request.get("/customizedGift/index", {}, {login: true}) + return request.get("/customizedGift/index", {}, {login: false}) +} + +/** + * 特色礼品省份专题页 + * + */ +export function customizedGiftContent(param) { + return request.get("/customizedGift/cityContent", param, {login: false}) } /** diff --git a/api/user.js b/api/user.js index 07dcb0a..ab4ac36 100644 --- a/api/user.js +++ b/api/user.js @@ -534,3 +534,8 @@ export function setDetection() { export function getRechargeApi() { return request.get("recharge/index"); } + + +export function getUserCenterBanner() { + return request.get("userCenterBanner"); +} diff --git a/assets/css/goods.less b/assets/css/goods.less index 8c575ba..ed2ccdf 100644 --- a/assets/css/goods.less +++ b/assets/css/goods.less @@ -25,7 +25,7 @@ } .goods-section { - margin: 24rpx; + margin: 0 24upx 24upx 24upx; padding: 30rpx 24rpx; border-radius: 20rpx; background: #fff; @@ -103,6 +103,15 @@ color: #333; font-size: 30rpx; } + .store-btn { + display: flex; + padding: 12upx; + border-radius: 6upx; + color: #fff; + line-height: 20upx; + font-size: 24rpx; + background-color: #FF564A; + } .value { color: #666; diff --git a/assets/css/style.less b/assets/css/style.less index 1dff01f..79d1604 100644 --- a/assets/css/style.less +++ b/assets/css/style.less @@ -274,7 +274,10 @@ page { } .noCommodity { - padding-top: 0.75*100rpx; + display: flex; + justify-content: center; + padding: 75rpx 0; + background-color: #fff; } .noCommodity .noPictrue { @@ -644,6 +647,7 @@ page { } .product-window .productWinList .item .listn .itemn { + position: relative; border: 1px solid #bbb; font-size: 0.26*100rpx; color: #282828; @@ -657,6 +661,23 @@ page { background-color: #eb3729; border-color: #eb3729; } +.product-window .productWinList .item .listn .itemn.disabled { + color: #333; + background-color: #F1F1F1; + border-color: #F1F1F1; +} +.product-window .productWinList .item .listn .itemn.disabled .tag { + position: absolute; + top: -18upx; + right: -18upx; + height: 28upx; + padding: 0 6upx; + border-radius: 6upx; + color: #fff; + line-height: 28upx; + font-size: 10px; + background-color: #FD5749; +} .product-window .cart { margin-top: 0.36*100rpx; @@ -2397,11 +2418,25 @@ page { .user .wrapper .myOrder .title, .user .wrapper .myService .title { - height: 0.88*100rpx; - padding: 0 0.3*100rpx; - border-bottom: 1px dashed #eee; - font-size: 0.3*100rpx; - color: #282828; + height: 88rpx; + padding: 0 30rpx; + border-bottom: 1px solid #ECECEE; + font-size: 28rpx; + color: #333; + font-weight: 600; +} +.user .wrapper .myService .title { + border-bottom: 0; +} + +.user .wrapper .myOrder .title .line, +.user .wrapper .myService .title .line { + display: block; + width: 6rpx; + height: 28rpx; + margin: 0 15rpx 0 0; + border-radius: 6rpx; + background-color: #FF564A; } .user .wrapper .myOrder .title .allOrder { @@ -2428,16 +2463,11 @@ page { } .user .wrapper .myOrder .orderState .item .pictrue { - width: 0.49*100rpx; - height: 0.42*100rpx; + width: 52rpx; + height: 52rpx; margin: 0 auto 0.18*100rpx auto; } -.user .wrapper .myOrder .orderState .item .pictrue image { - width: 100%; - height: 100%; -} - .user .wrapper .myService { background-color: #fff; margin-top: 0.15*100rpx; diff --git a/components/Coupons.vue b/components/Coupons.vue index 54ba702..bd82d9e 100644 --- a/components/Coupons.vue +++ b/components/Coupons.vue @@ -17,7 +17,12 @@ 使用规则 - + + + @@ -124,6 +129,14 @@ export default { transform: rotate(180deg); } } + .coupon-html { + height: 80rpx; + overflow: hidden; + transition: all .3s; + &.auto-height { + height: auto; + } + } } } \ No newline at end of file diff --git a/components/GooSkeleton/README.md b/components/GooSkeleton/README.md new file mode 100644 index 0000000..140fff1 --- /dev/null +++ b/components/GooSkeleton/README.md @@ -0,0 +1,62 @@ +# skeleton +uni-app 骨架屏组件,用于数据加载时显示占位元素 + +## 属性说明 + +|属性名|类型|默认值|说明| +| -- | -- | --|--| +| loading | Boolean | true | 是否显示占位图 | +| showAvatar | Boolean | true | 是否显示头像占位图 | +| AvatarSize | String | 50px | 头像站占位图大小 | +| AvatarShape | String | round | 头像形状,可选值:round, square | +| showTitle | Boolean | true | 是否显示标题占位图 | +| titleWidth | String | 40% | 标题占位图宽度 | +| row | Number| 3 | 段落占位图行数 | +| animate | Boolean | true | 是否开启动画 | + +## 使用示例 + +```html + + 我是段落1 + +``` + +```javascript +import Skeleton from '../components/skeleton/index.vue' +export default { + components: { + Skeleton + }, + data() { + return { + loading: true, + skeleton1 : { + avatarSize: '52px', + row: 3, + showTitle: true, + } + } + }, + created() { + this.reloadData() + }, + methods: { + reloadData() { + this.loading = true + setTimeout(() => { + this.loading = false + }, 3000) + }, + }, +} +``` + +## 效果图 + +![](http://images.alisali.cn/img_20191014113211.png) diff --git a/components/GooSkeleton/index.vue b/components/GooSkeleton/index.vue new file mode 100644 index 0000000..a7e3669 --- /dev/null +++ b/components/GooSkeleton/index.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/components/ProductWindow.vue b/components/ProductWindow.vue index a0b1065..4d7f731 100644 --- a/components/ProductWindow.vue +++ b/components/ProductWindow.vue @@ -20,12 +20,21 @@ {{ item.attrName }} {{ itemn.attr }} + :class="{ + 'on': item.index == indexn, + 'disabled': productValue[itemn.attr].stock === 0 + }" + class="itemn" + @click="tapAttr(indexw, indexn, itemn)" + > + {{ itemn.attr }} + 缺货 + @@ -57,6 +66,10 @@ export default { type: Object, default: () => {} }, + productValue: { + type: Object, + default: () => {} + }, cartNum: { type: Number, default: () => 1 @@ -80,7 +93,10 @@ export default { CartNumAdd: function() { this.$emit("changeFun", { action: "ChangeCartNum", value: 1 }); }, - tapAttr: function(indexw, indexn) { + tapAttr: function(indexw, indexn, itemn) { + if (this.productValue[itemn.attr].stock === 0) { + return + } // 修改商品规格不生效的原因: // H5端下面写法,attr更新,但是除H5外其他端不支持, // 尽量避免下面的骚写法,不要在子组件内更新props diff --git a/components/good/NoData.vue b/components/good/NoData.vue new file mode 100644 index 0000000..4562662 --- /dev/null +++ b/components/good/NoData.vue @@ -0,0 +1,17 @@ + + diff --git a/pages.json b/pages.json index 781aff0..1b1d2c9 100644 --- a/pages.json +++ b/pages.json @@ -43,7 +43,7 @@ } }, { - "path": "components/chose-city/chose-city", + "path": "pages/chose-city/chose-city", "style": { "navigationBarTitleText": "选择城市" } @@ -461,6 +461,12 @@ "navigationStyle": "custom" } }, + { + "path": "inn/innGoodList", + "style": { + "navigationBarTitleText": "店铺商品列表" + } + }, { "path": "inn/innApply", "style": { @@ -632,9 +638,15 @@ }, { "path": "views/giftList", + "style": { + "navigationBarTitleText": "特色礼品" + } + }, + { + "path": "views/giftContent", "style": { "navigationBarTitleText": "特色礼品", - "onReachBottomDistance": 100 + "navigationBarTextStyle": "black" } }, { @@ -951,9 +963,9 @@ "query": "" }, { - "name": "提交订单", - "path": "pages/order/OrderSubmission/index", - "query": "lotteryRecordId=217" + "name": "特色礼品", + "path": "pkg_product/views/giftList", + "query": "" } ] } diff --git a/pages/authorization/index.vue b/pages/authorization/index.vue index b337241..e01b481 100644 --- a/pages/authorization/index.vue +++ b/pages/authorization/index.vue @@ -41,7 +41,7 @@ 请完善您的头像和昵称 - - - + + - - + {{ item.label }} - - - + - + 当前定位:{{ location }} 定位失败 - + - - - - - - - - - - - - - - + - - - @@ -85,15 +76,15 @@ diff --git a/pages/user/User/index_bak20240307.vue b/pages/user/User/index_bak20240307.vue new file mode 100644 index 0000000..7fabf7f --- /dev/null +++ b/pages/user/User/index_bak20240307.vue @@ -0,0 +1,1104 @@ + + + + + diff --git a/pagesInn/components/jin-edit/jin-edit.vue b/pagesInn/components/jin-edit/jin-edit.vue new file mode 100644 index 0000000..c435769 --- /dev/null +++ b/pagesInn/components/jin-edit/jin-edit.vue @@ -0,0 +1,303 @@ + + + + + diff --git a/pagesInn/components/jin-edit/jin-icons.vue b/pagesInn/components/jin-edit/jin-icons.vue new file mode 100644 index 0000000..223ff10 --- /dev/null +++ b/pagesInn/components/jin-edit/jin-icons.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/pagesInn/components/jin-edit/readme.md b/pagesInn/components/jin-edit/readme.md new file mode 100644 index 0000000..5fd5e2c --- /dev/null +++ b/pagesInn/components/jin-edit/readme.md @@ -0,0 +1,65 @@ +## jin-edit 基于editor的富文本编辑器 + +### 兼容性 + +这是一个uni-app的通用组件,兼容微信小程序端、安卓端、ios端(未测试)、H5端。作者因没有ios设备无法对ios端进行测试,其他端测试无问题。 + +微信小程序 | APP | H5 +:--: | :--: | :--: +√ | √ | √ + +我的HbuilderX版本2.6.7,不同的版本可能会造成不兼容的问题。 + +### 使用方式 + +1. 将此组件进入你的项目中的 /components/ 目录中 +2. 在某个页面中使用该插件 +- 在 `script` 中引用组件 +```javascript +import jinEdit from '../../components/jin-edit/jin-edit.vue'; +export default { + data() { + return { + + } + }, + components: { + jinEdit + }, + methods: { + // 点击发布 + editOk(res) { + console.log(res); + } + } +} +``` +- 在 `template` 中使用组件 +```html + +``` + +### Demo + +[uni-jin(一个uni-app组件集合)](https://github.com/wangjinxin613/uni-jin) + +### 参数 + +属性 | 类型 | 默认值 | 说明 +:--: | :--: | :--: | :--: +showImgSize | Boolean | false | 点击图片时显示图片大小控件 +showImgToolbar | Boolean | false | 点击图片时显示工具栏控件 +showImgResize | Boolean | false | 点击图片时显示修改尺寸控件 +placeholder | String | '' | 编辑器占位符 +uploadFileUrl | String | '#' | 图片上传的服务器地址 +fileKeyName | String | 'file' | 图片上传时的name +header | Object | - | 图片上传http请求的header +html | String | - | 初始化的html + +### 方法 + +方法名 | 参数 | 说明 +:--: | :--: | :--: +editOk | e={html,text,delta,isPublic} | 点击发布按钮触发 + +以上 \ No newline at end of file diff --git a/pagesInn/inn/innGoodList.vue b/pagesInn/inn/innGoodList.vue new file mode 100644 index 0000000..8c47507 --- /dev/null +++ b/pagesInn/inn/innGoodList.vue @@ -0,0 +1,193 @@ + + + + diff --git a/pagesInn/inn/innHome.vue b/pagesInn/inn/innHome.vue index 0a31fc9..6878809 100644 --- a/pagesInn/inn/innHome.vue +++ b/pagesInn/inn/innHome.vue @@ -1,223 +1,379 @@ @@ -228,136 +384,122 @@ import { getHotelNewsList, getHotelZan, getPoster, - goodsList, - postHotelNewsDel -} from "@/api/inn.js"; -import {formatDateTime} from "@/utils"; -import {getUrlParam} from "@/utils/common.js"; + getHotelGoodList, + postHotelNewsDel, + setTopHotelNew +} from "@/api/inn.js" +import {formatDateTime} from "@/utils" +import {getUrlParam} from "@/utils/common.js" import imgBox from '@/components/imageTypeSet/imagebox.vue' -import cookie from "@/utils/store/cookie"; -import {addStore, removeStore} from "@/api/favorite"; +import cookie from "@/utils/store/cookie" +import {addStore, removeStore} from "@/api/favorite" +import GooSkeleton from '@/components/GooSkeleton/index.vue' export default { components: { - imgBox + imgBox, + GooSkeleton }, data() { return { webUrl: this.$VUE_APP_RESOURCES_URL, - isExpand: false, + isLoad: false, activeIndex: 0, - page: 1, - limit: 20, loading: false, - loadend: false, picColumnWidth: '325rpx', scrollData: {}, infoArray: [], - inn: {}, + inn: { + cityName: '', + pics: [], + desc: '', + latitude: '', + longitude: '' + }, isMyInn: false, //是否是自己的客栈 goodsList: [], - goodsPage: 1, showShare: false, - posterUrl: "", // 分享海报 + posterUrl: '', // 分享海报 id: null, partnerId: null, isLike: false, //点赞 isFavorite: false, - favoriteCount: 0 + favoriteCount: 0, + videoStyle: { + width: '750rpx', + height: '500rpx' + }, + tabList: [ + { text: '精选商品', value: 0, isShow: true }, + { text: '最新资讯', value: 1, isShow: true }, + { text: '企业文化', value: 2, isShow: true }, + { text: '商家资质', value: 3, isShow: true } + ] } }, - //必须在页面加 onPageScroll(e){} ,才能滑动显示背景 + // 必须在页面加 onPageScroll(e){} ,才能滑动显示背景 onPageScroll(e) { - this.scrollData = e; - }, - onShow: function () { - this.page = 1; - this.loading = false; - this.loadend = false; + this.scrollData = e }, onLoad: function (options) { if (options.id) { - this.id = options.id || null; - this.partnerId = options.partnerId || null; + this.id = options.id || null + this.partnerId = options.partnerId || null } else { - let obj = uni.getEnterOptionsSync(); + let obj = uni.getEnterOptionsSync() if (options.scene || obj.query.scene) { - let query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene); - this.id = getUrlParam(query, "id") || null; - this.partnerId = getUrlParam(query, "partnerId") || null; + const query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene) + this.id = getUrlParam(query, 'id') || null + this.partnerId = getUrlParam(query, 'partnerId') || null } } - if (this.partnerId) cookie.set("spread", this.partnerId); - - this.fetchInnDetail(); - this.fetchInnInfoList(); - this.initPoster(); - - let that = this; - this.isMyInn = (this.$yroute.query.isMyInn != null ? true : false); + if (this.partnerId) cookie.set('spread', this.partnerId) + this.fetchInnDetail() + this.fetchInnInfoList() + this.initPoster() + this.isMyInn = (this.$yroute.query.isMyInn != null ? true : false) uni.getSystemInfo({ success: (e) => { - //两列商品宽度 - that.picColumnWidth = (e.screenWidth - uni.upx2px(92)) / 2 + 'px'; - console.log('picColumnWidth:' + that.picColumnWidth); + // 两列商品宽度 + this.picColumnWidth = (e.screenWidth - uni.upx2px(92)) / 2 + 'px' } - }); + }) }, - // 下拉刷新 - onPullDownRefresh() { - if (this.activeIndex == 0) { - this.page = 1; - this.loading = false; - this.loadend = false; - this.fetchInnInfoList(); - } else { - this.fetchInnDetail(); - + onShow() { + if (!this.isLoad) { + return } - }, - // 上拉触底 - onReachBottom() { - if (this.activeIndex === 3) { - this.goodsPage++; - this.fetchGoods(); - } else { - !this.loading && this.fetchInnInfoList(); + if (this.inn.hasProduct <= 0) { + this.fetchGoods() } + this.fetchInnInfoList() + this.fetchInnDetail() }, methods: { 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) { this.$yrouter.push({ path: '/pages/shop/GoodsCon/index', query: { id: item.id } - }); + }) }, - saveImg() { - let that = this; - + const _this = this uni.getSetting({ success: getRes => { if (getRes.authSetting["scope.writePhotosAlbum"]) { - that.downloadImage(); + _this.downloadImage() } else { uni.authorize({ scope: "scope.writePhotosAlbum", success: () => { - that.downloadImage(); + _this.downloadImage() }, fail: () => { - console.log("authorize fail") uni.openSetting({ success: openRes => { console.log(typeof openRes, openRes) @@ -378,25 +520,21 @@ export default { } }) }, - downloadImage() { - let that = this; - const randomID = () => Math.random().toString(36).substring(2); - + const _this = this + const randomID = () => Math.random().toString(36).substring(2) uni.downloadFile({ - url: this.posterUrl, //网络图片的地址 - filePath: wx.env.USER_DATA_PATH + "/share_" + randomID() + ".png", //指定的本地文件路径 + url: this.posterUrl, // 网络图片的地址 + filePath: wx.env.USER_DATA_PATH + "/share_" + randomID() + ".png", // 指定的本地文件路径 success: downRes => { - console.log(typeof downRes, downRes, "down") - uni.saveImageToPhotosAlbum({ - filePath: downRes.filePath, //临时文件地址 + filePath: downRes.filePath, // 临时文件地址 success: function () { uni.showToast({ title: "保存成功", icon: "success", success() { - that.showShare = false; + _this.showShare = false } }) }, @@ -416,184 +554,168 @@ export default { } }) }, - - doExpandDesc: function () { - this.isExpand = !this.isExpand; - }, - showQrcode: function () { - uni.previewImage({ - current: 0, - urls: [this.inn.qrcode] - }); - }, zanInn: function () { getHotelZan(this.inn.id).then(() => { - this.isLike = !this.isLike; - this.fetchInnDetail(); + this.isLike = !this.isLike + this.fetchInnDetail() }).catch((err) => { uni.showToast({ title: err.msg + '', icon: 'none', mask: false, duration: 1500 - }); + }) }) }, infoClick: function (info) { - this.$yrouter.push('/pagesInn/inn/innInfoDetail?id=' + info.id); + this.$yrouter.push('/pagesInn/inn/innInfoDetail?id=' + info.id) }, publishBtnClick: function () { - this.$yrouter.push('/pagesInn/inn/innInfoPublish?hotelId=' + this.inn.id); + this.$yrouter.push('/pagesInn/inn/innInfoPublish?hotelId=' + this.inn.id) }, - modifyBtnClick: function () { - this.$yrouter.push("/pagesInn/inn/innProfileEdit?hotel=" + encodeURIComponent(JSON.stringify(this.inn))); - // this.$yrouter.push('/pagesInn/inn/innProfileEdit'); + uni.setStorageSync('MY_HOTEL_INFO', JSON.stringify(this.inn)) + this.$yrouter.push("/pagesInn/inn/innProfileEdit?id=" + this.inn.id) }, - //删除客栈动态 - deleteInnInfo: function (info) { - let that = this; + // 删除客栈动态 + deleteInnInfo: function (info, index) { + const _this = this + _this.toggleMoreHandle(index) uni.showModal({ - title: '确认删除此动态?', - content: '', + title: '提示', + content: '确认删除此动态?', showCancel: true, cancelText: '取消', confirmText: '确认', success: res => { - if (res.confirm) { - uni.showLoading(); - var param = { + uni.showLoading() + postHotelNewsDel({ id: info.id, - hotelId: that.inn.id - } - postHotelNewsDel(param).then((res1) => { - uni.hideLoading(); - - - that.$dialog.toast({ + hotelId: _this.inn.id + }).then((res1) => { + uni.hideLoading() + _this.$dialog.toast({ mes: '删除成功!' - }); - //删除成功刷新动态列表 - that.page = 1; - that.loading = false; - that.loadend = false; - that.fetchInnInfoList(); - - // setTimeout(function() { - - - // }, 1000); - - + }) + // 删除成功刷新动态列表 + _this.fetchInnInfoList() }).catch((err) => { - uni.hideLoading(); - + uni.hideLoading() uni.showToast({ title: err.msg, icon: "none", duration: 1500 - }); - - }).finally(() => { - - }); + }) + }) } - - }, - fail: () => { - }, - complete: () => { } - }); + }) }, fetchInnInfoList: function () { - let that = this; - if (that.loading) return; //阻止下次请求(false可以进行请求); - if (that.loadend) return; //阻止结束当前请求(false可以进行请求); - that.loading = true; - let q = { - page: that.page, - limit: that.limit, - hotelId: that.id - }; - getHotelNewsList(q).then(res => { - that.loading = false; - //apply();js将一个数组插入另一个数组; - if (that.page == 1) { - that.infoArray = []; - } - that.infoArray.push.apply(that.infoArray, res.data.map((info) => { - var pt = info.createdTime.replace(/-/g, "/"); - info.year = formatDateTime(pt, 'yyyy'); - info.monthDay = formatDateTime(pt, 'MM/dd'); - info.time = formatDateTime(pt, 'HH:mm:ss'); - return info; - })); - that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成; - that.page = that.page + 1; - }).catch((err) => { - - }).finally(() => { - uni.stopPullDownRefresh(); - }); - }, - handleRichText: function (str) { - if (str != null) { - return `简介:` + str.replace(/<\/?[^>]*>/g, ''); - } else { - return ''; + const _this = this + if (_this.loading) { + return } + _this.loading = true + _this.infoArray = [] + getHotelNewsList({ + page: 1, + limit: 9999, + hotelId: _this.id + }).then(res => { + _this.loading = false + _this.infoArray.push.apply(_this.infoArray, res.data.map((info) => { + var pt = info.createdTime.replace(/-/g, "/") + info.year = formatDateTime(pt, 'yyyy') + info.monthDay = formatDateTime(pt, 'MM/dd') + info.time = formatDateTime(pt, 'HH:mm:ss') + info.showMore = false + return info + })) + }).finally(() => { + _this.loading = false + uni.stopPullDownRefresh() + }) }, fetchInnDetail: function () { - let that = this; - if (this.isMyInn) { - getHotelDetail(that.id).then((res) => { - that.inn = res.data; - that.isLike = res.data.zanVo !== null; - that.isFavorite = res.data.hasFavorite - that.favoriteCount = res.data.favoriteCount - }).catch((err) => { - - }).finally(() => { - uni.stopPullDownRefresh(); - }); + const _this = this + let reqFn = null + if (_this.isMyInn) { + reqFn = getHotelDetail } else { - getHomeHotelDetail(that.id).then((res) => { - that.inn = res.data; - that.isLike = res.data.zanVo !== null; - that.isFavorite = res.data.hasFavorite - that.favoriteCount = res.data.favoriteCount - }).catch((err) => { - - }).finally(() => { - uni.stopPullDownRefresh(); - }); + reqFn = getHomeHotelDetail } + reqFn(_this.id).then((res) => { + const { success, data } = res + if (success) { + _this.isLoad = true + _this.inn = data + _this.isLike = data.zanVo !== null + _this.isFavorite = data.hasFavorite + _this.favoriteCount = data.favoriteCount + _this.inn.latitude = _this.inn.latitude ? parseFloat(_this.inn.latitude) : 24.993587 + _this.inn.longitude = _this.inn.longitude ? parseFloat(_this.inn.longitude) : 102.779656 + // 该店铺无商品则不显示“精选商品” + if (data.hasProduct <= 0) { + _this.activeIndex = 1 + _this.tabList[0].isShow = false + } else { + _this.fetchGoods() + } + // coverType: 1-图片,2-视频 + if (data.coverType === 2) { + uni.getSystemInfo({ + success: info => { + const screenWidth = info.windowWidth + _this.videoStyle.width = screenWidth + 'px' + _this.videoStyle.height = screenWidth * 500 / 750 + 'px' + } + }) + // 视频宽高自适应 + /* + uni.downloadFile({ + url: data.cover, + success: downRes => { + const { tempFilePath } = downRes + if (tempFilePath) { + uni.getVideoInfo({ + src: tempFilePath, + success: videoRes => { + const { width, height } = videoRes + uni.getSystemInfo({ + success: info => { + const screenWidth = info.windowWidth + that.videoStyle.width = screenWidth + 'px' + that.videoStyle.height = screenWidth * height / width + 'px' + } + }) + }, + fail: err => { + console.log(err) + } + }) + } + } + }) + */ + } + } + }).finally(() => { + uni.stopPullDownRefresh() + }) }, initPoster() { - getPoster(this.id).then(({data}) => this.posterUrl = data); + getPoster(this.id).then(({data}) => this.posterUrl = data) }, 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) { - this.$dialog.error('暂无位置信息'); + this.$dialog.error('暂无位置信息') } else { uni.openLocation({ latitude: this.inn.latitude, longitude: this.inn.longitude - }); + }) } }, showPic: function (index) { @@ -603,63 +725,54 @@ export default { }) }, changeTab: function (index) { - this.activeIndex = index; - this.page = 1; - this.loading = false; - this.loadend = false; - - //刷新数据 + this.activeIndex = index + this.loading = false + // 刷新数据 switch (this.activeIndex) { - case 0: - this.fetchInnDetail(); - break; case 1: - this.fetchInnInfoList(); - break; - case 3: - this.goodsPage = 1; - this.goodsList = []; - this.fetchGoods(); - break; + this.fetchInnInfoList() + break + case 0: + this.goodsList = [] + this.fetchGoods() + break + default: + break } }, fetchGoods() { - goodsList({ + getHotelGoodList({ id: this.inn.id, - page: this.goodsPage - }).then(({ - data - }) => { - let len = data.records.length; - if (len > 0) { - for (let i = 0; i < len; i++) { - this.goodsList.push(data.records[i]); + page: 1, + limit: 12 + }).then(res => { + const { success, data } = res + if (success) { + const len = data.records.length + if (len > 0) { + for (let i = 0; i < len; i++) { + this.goodsList.push(data.records[i]) + } } } - }).catch(() => { }) }, call: function () { - if (this.inn.tel != undefined && this.inn.tel.length > 0) { uni.makePhoneCall({ - // 手机号 phoneNumber: this.inn.tel, - // 成功回调 success: (res) => { console.log('调用成功!') }, - // 失败回调 fail: (res) => { console.log('调用失败!') } - - }); + }) } else { - this.$dialog.error('电话为空'); + this.$dialog.error('电话为空') } }, async doneFavorite() { @@ -676,65 +789,51 @@ export default { this.favoriteCount = res.data.favoriteCount } } + }, + toggleMoreHandle(index) { + this.$set(this.infoArray[index], 'showMore', !this.infoArray[index].showMore) + }, + viewAllGoodHandle() { + uni.navigateTo({ + url: '/pagesInn/inn/innGoodList?id=' + this.inn.id + }) + }, + setTopInfoHandle(item, isTop) { + uni.showLoading() + setTopHotelNew({ + id: item.id, + isTop + }).then(res => { + const { success } = res + if (success) { + this.$dialog.toast({ + mes: '操作成功!' + }) + this.fetchInnInfoList() + } + }).finally(() => { + uni.hideLoading() + }) } } } - - diff --git a/pagesInn/inn/innInfoDetail.vue b/pagesInn/inn/innInfoDetail.vue index 8739e13..0ae4578 100644 --- a/pagesInn/inn/innInfoDetail.vue +++ b/pagesInn/inn/innInfoDetail.vue @@ -20,7 +20,7 @@ - diff --git a/pagesInn/inn/innInfoPublish.vue b/pagesInn/inn/innInfoPublish.vue index 0681d14..07ecdc2 100644 --- a/pagesInn/inn/innInfoPublish.vue +++ b/pagesInn/inn/innInfoPublish.vue @@ -1,38 +1,69 @@