Compare commits

...

12 Commits

Author SHA1 Message Date
1154079537
991f55a47d bug修复 2024-05-25 18:07:07 +08:00
1154079537
011fcbc2e4 scrollview定位 2024-05-25 11:20:18 +08:00
1154079537
50409cd8c4 文字修改 2024-05-24 18:04:37 +08:00
1154079537
b0ccfc9f29 抖动bug修改 2024-05-22 17:29:52 +08:00
6478239fc2 删除多余代码 2024-05-22 14:57:08 +08:00
1154079537
df16e85df9 购物车登录 2024-05-22 14:55:39 +08:00
1154079537
50787f1df9 iOS暂存 2024-05-21 17:57:15 +08:00
1154079537
fb98086acd 登录修改 2024-05-21 17:16:07 +08:00
1154079537
728f3c0611 无微信不能登录限制 2024-05-21 16:29:01 +08:00
1154079537
1669b9be74 首页和滚动优化 2024-05-20 17:15:51 +08:00
1154079537
a3c032b3e4 首页滚动修改 订单修改 2024-05-18 19:46:22 +08:00
1154079537
86df2a2950 文字修改 2024-05-18 19:41:57 +08:00
22 changed files with 1982 additions and 1652 deletions

View File

@ -64,27 +64,36 @@
<!-- tab导航 --> <!-- tab导航 -->
<view class="tabs" v-if="showTab" :style="{top:'calc(98rpx + var(--status-bar-height))'}"> <view class="tabs" v-if="showTab" :style="{top:'calc(98rpx + var(--status-bar-height))'}">
<block v-for="(item,indx) in tabsArr" :key="indx"> <view class="tabs-wrap">
<view v-if="indx>0" style="width: 3rpx;height: 36rpx;background-color: #ccc;"></view> <block v-for="(item,indx) in tabsArr" :key="indx">
<view :class="{'tabs-item-active':item.val==currTabs}" class="tabs-item" @click="changeTab(item.val)"> <view v-if="indx>0" style="width: 3rpx;height: 36rpx;background-color: #ccc;"></view>
<view class="tabs-item-main">{{item.name}}</view> <view :class="{'tabs-item-active':item.val==currTabs}" class="tabs-item"
<view class="tabs-item-sub">{{item.desc}}</view> @click="changeTab(item.val)">
</view> <view class="tabs-item-main">{{item.name}}</view>
</block> <view class="tabs-item-sub">{{item.desc}}</view>
</view> </view>
</block>
<view class='recommendList' :class="indexP?'on':''"> </view>
<view class="loadingicon acea-row row-center-wrapper" <view class="loadingicon acea-row row-center-wrapper tabs-loading"
:style="{height:((!hostProduct || hostProduct.length == 0 || loading) && isShow)?'80rpx':'0rpx'}"
v-if="!hostProduct || hostProduct.length == 0 || loading"> v-if="!hostProduct || hostProduct.length == 0 || loading">
<text class="loading iconfont icon-jiazai loading-flex"></text> <text class="loading iconfont icon-jiazai loading-flex"></text>
{{ hotTitle }} {{ hotTitle }}
</view> </view>
</view>
<view class='recommendList' :class="indexP?'on':''">
<!-- <view class="loadingicon acea-row row-center-wrapper"
v-if="!hostProduct || hostProduct.length == 0 || loading">
<text class="loading iconfont icon-jiazai loading-flex"></text>
{{ hotTitle }}
</view> -->
<WaterfallsFlow v-if="hostProduct.length>0" :wfList='hostProduct' @itemTap="goDetail" :type="0" <WaterfallsFlow v-if="hostProduct.length>0" :wfList='hostProduct' @itemTap="goDetail" :type="0"
:sale_type="sale_type" /> :sale_type="sale_type" />
<view class='pictrue' v-if="!loading && hostProduct.length==0"> <!-- <view class='pictrue' v-if="!loading && hostProduct.length==0">
<image :src="`${domain}/static/images/noCart.png`"></image> <image :src="`${domain}/static/images/noCart.png`"></image>
<view>暂无商品看点别的吧</view> <view>暂无商品看点别的吧</view>
</view> </view> -->
</view> </view>
</view> </view>
</template> </template>
@ -171,11 +180,22 @@
}], }],
currTabs: 1, currTabs: 1,
list: [], list: [],
tabsTop: '' tabsTop: '',
isShow: true
}; };
}, },
mounted() { mounted() {
this.getArticleList(); this.getArticleList();
uni.$on('scroll', res => {
uni.$u.debounce(() => {
if (res && res.scrollTop > this.tabsTop) {
this.isShow = false;
} else {
this.isShow = true;
}
}, 500)
})
}, },
methods: { methods: {
@ -197,18 +217,19 @@
limit: 10 limit: 10
}).then(res => { }).then(res => {
this.list = res.data.list; this.list = res.data.list;
setTimeout(() => { setTimeout(() => {
this.$util.getDom(this, '.tabs', res => { this.$util.getDom(this, '.tabs', res => {
console.log(res.top);
// #ifdef APP // #ifdef APP
this.tabsTop = res.top + 10; this.tabsTop = res.top;
// #endif // #endif
// #ifdef H5 // #ifdef H5
this.tabsTop = res.top; this.tabsTop = res.top;
// #endif // #endif
}) })
}, 300) }, 1000)
}) })
}, },
goDetail(item) { goDetail(item) {
@ -236,6 +257,11 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.topLoading {
position: sticky;
z-index: 10;
}
.common-hd { .common-hd {
display: flex; display: flex;
align-items: center; align-items: center;
@ -306,13 +332,19 @@
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 900; z-index: 900;
background: #fff;
padding-bottom: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 -20rpx 10rpx; margin: 0 -20rpx 10rpx;
padding-top: 20rpx;
.tabs-wrap {
display: flex;
justify-content: space-between;
align-items: center;
height: 110rpx;
background: #fff;
}
.tabs-loading {
height: 80rpx;
}
.tabs-item { .tabs-item {
width: 23%; width: 23%;
@ -350,7 +382,6 @@
.recommend .recommendList { .recommend .recommendList {
padding: 0 20rpx; padding: 0 20rpx;
min-height: 100rpx;
min-height: calc(100vh - 82rpx - var(--status-bar-height)); min-height: calc(100vh - 82rpx - var(--status-bar-height));
} }

View File

@ -16,8 +16,8 @@ let openPlantGrass = '-openPlantGrass-'
let httpSix, httpApi; let httpSix, httpApi;
// const env = 'dev'; // 开发 // const env = 'dev'; // 开发
// const env = 'prod'; // 生产 const env = 'prod'; // 生产
const env = 'prew'; // 预上线 // const env = 'prew'; // 预上线
switch (env) { switch (env) {
case 'prod': case 'prod':
@ -77,4 +77,5 @@ module.exports = {
TOKENNAME: 'X-Token', TOKENNAME: 'X-Token',
// 缓存时间 0 永久 // 缓存时间 0 永久
EXPIRE: 0, EXPIRE: 0,
AUTH_EXPIRE_TIME: 20 * 1000 //秒
}; };

View File

@ -1,353 +1,353 @@
{ {
"name": "惠农生活", "name" : "惠农生活",
"appid": "__UNI__3A527D1", "appid" : "__UNI__3A527D1",
"description": "", "description" : "",
"versionName": "2.0.53", "versionName" : "2.0.26",
"versionCode": 2053, "versionCode" : 2026,
"transformPx": false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus": { "app-plus" : {
"titleNView": true, "titleNView" : true,
"usingComponents": true, "usingComponents" : true,
"nvueCompiler": "uni-app", "nvueCompiler" : "uni-app",
"nvueStyleCompiler": "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion": 3, "compilerVersion" : 3,
"compatible": { "compatible" : {
"ignoreVersion": true //trueHBuilderX1.9.0 "ignoreVersion" : true //trueHBuilderX1.9.0
}, },
"splashscreen": { "splashscreen" : {
"alwaysShowBeforeRender": false, "alwaysShowBeforeRender" : false,
"waiting": false, "waiting" : false,
"autoclose": true, "autoclose" : true,
"delay": 0 "delay" : 0
}, },
/* */ /* */
"modules": { "modules" : {
"VideoPlayer": {}, "VideoPlayer" : {},
"OAuth": {}, "OAuth" : {},
"Payment": {}, "Payment" : {},
"Share": {}, "Share" : {},
"iBeacon": {}, "iBeacon" : {},
"Maps": {}, "Maps" : {},
"Geolocation": {}, "Geolocation" : {},
"UniMP": { "UniMP" : {
"description": "uni小程序" "description" : "uni小程序"
}, },
"Push": {}, "Push" : {},
"Barcode": {}, "Barcode" : {},
"Camera": {} "Camera" : {}
}, },
"safearea": { "safearea" : {
"bottom": { "bottom" : {
"offset": "none" "offset" : "none"
} }
}, },
/* */ /* */
"distribute": { "distribute" : {
/* android */ /* android */
"android": { "android" : {
"permissions": [ "permissions" : [
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS\"/>", "<uses-permission android:name=\"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.BATTERY_STATS\"/>", "<uses-permission android:name=\"android.permission.BATTERY_STATS\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH\"/>", "<uses-permission android:name=\"android.permission.BLUETOOTH\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>", "<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_CONFIGURATION\"/>", "<uses-permission android:name=\"android.permission.CHANGE_CONFIGURATION\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>", "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>" "<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>"
], ],
"abiFilters": ["armeabi-v7a", "arm64-v8a", "x86"], "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"permissionExternalStorage": { "permissionExternalStorage" : {
"request": "none", "request" : "none",
"prompt": "应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。" "prompt" : "应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。"
}, },
"permissionPhoneState": { "permissionPhoneState" : {
"request": "none" // "request" : "none" //
}, },
"minSdkVersion": 23, "minSdkVersion" : 23,
"targetSdkVersion": 30 "targetSdkVersion" : 30
}, },
/* ios */ /* ios */
"ios": { "ios" : {
"privacyDescription": { "privacyDescription" : {
"NSPhotoLibraryUsageDescription": "上传用户头像保存分享海报", "NSPhotoLibraryUsageDescription" : "上传用户头像保存分享海报",
"NSPhotoLibraryAddUsageDescription": "上传用户头像保存分享海报", "NSPhotoLibraryAddUsageDescription" : "上传用户头像保存分享海报",
"NSCameraUsageDescription": "上传用户头像保存分享海报", "NSCameraUsageDescription" : "上传用户头像保存分享海报",
"NSLocationWhenInUseUsageDescription": "根据客户地理位置推荐最近门店", "NSLocationWhenInUseUsageDescription" : "根据客户地理位置推荐最近门店",
"NSLocationAlwaysUsageDescription": "根据客户地理位置推荐最近门店" "NSLocationAlwaysUsageDescription" : "根据客户地理位置推荐最近门店"
}, },
"idfa": false, "idfa" : false,
"dSYMs": false "dSYMs" : false
}, },
/* SDK */ /* SDK */
"sdkConfigs": { "sdkConfigs" : {
"maps": { "maps" : {
"amap": { "amap" : {
"appkey_ios": "0a3202688624938fd5d2f37b52c30d5d", "appkey_ios" : "0a3202688624938fd5d2f37b52c30d5d",
"appkey_android": "0354f5ddc11e2ea76c5aac647f44d945", "appkey_android" : "0354f5ddc11e2ea76c5aac647f44d945",
"name": "amapIvoVHpJR" "name" : "amapIvoVHpJR"
} }
}, },
"payment": { "payment" : {
"weixin": { "weixin" : {
"__platform__": ["ios", "android"], "__platform__" : [ "ios", "android" ],
"appid": "wx2e8f79ff281284f5", "appid" : "wx2e8f79ff281284f5",
"UniversalLinks": "https://shop.lihaink.cn/" "UniversalLinks" : "https://shop.lihaink.cn/"
} }
}, },
"share": { "share" : {
"weixin": { "weixin" : {
"appid": "wx2e8f79ff281284f5", "appid" : "wx2e8f79ff281284f5",
"UniversalLinks": "https://shop.lihaink.cn/" "UniversalLinks" : "https://shop.lihaink.cn/"
} }
}, },
"geolocation": { "geolocation" : {
"amap": { "amap" : {
"name": "amapIvoVHpJR", "name" : "amapIvoVHpJR",
"__platform__": ["ios", "android"], "__platform__" : [ "ios", "android" ],
"appkey_ios": "0a3202688624938fd5d2f37b52c30d5d", "appkey_ios" : "0a3202688624938fd5d2f37b52c30d5d",
"appkey_android": "0354f5ddc11e2ea76c5aac647f44d945" "appkey_android" : "0354f5ddc11e2ea76c5aac647f44d945"
} }
}, },
"push": {}, "push" : {},
"oauth": { "oauth" : {
"weixin": { "weixin" : {
"appid": "wx2e8f79ff281284f5", "appid" : "wx2e8f79ff281284f5",
"UniversalLinks": "https://shop.lihaink.cn/" "UniversalLinks" : "https://shop.lihaink.cn/"
}, },
"univerify": {} "univerify" : {}
}, },
"ad": {} "ad" : {}
}, },
"icons": { "icons" : {
"android": { "android" : {
"hdpi": "unpackage/res/icons/72x72.png", "hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png", "xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png", "xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png" "xxxhdpi" : "unpackage/res/icons/192x192.png"
}, },
"ios": { "ios" : {
"appstore": "unpackage/res/icons/1024x1024.png", "appstore" : "unpackage/res/icons/1024x1024.png",
"ipad": { "ipad" : {
"app": "unpackage/res/icons/76x76.png", "app" : "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png", "app@2x" : "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png", "notification" : "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png", "proapp@2x" : "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png", "settings" : "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png", "spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png" "spotlight@2x" : "unpackage/res/icons/80x80.png"
}, },
"iphone": { "iphone" : {
"app@2x": "unpackage/res/icons/120x120.png", "app@2x" : "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png", "app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png", "notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png", "settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png", "spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png" "spotlight@3x" : "unpackage/res/icons/120x120.png"
} }
} }
}, },
"splashscreen": { "splashscreen" : {
"useOriginalMsgbox": true, "useOriginalMsgbox" : true,
"androidStyle": "common" "androidStyle" : "common"
} }
}, },
"nativePlugins": { "nativePlugins" : {
"JG-JCore": { "JG-JCore" : {
"JPUSH_APPKEY_IOS": "8a5efd65cda14fafa6e64ad3", "JPUSH_APPKEY_IOS" : "8a5efd65cda14fafa6e64ad3",
"JPUSH_CHANNEL_IOS": "8a5efd65cda14fafa6e64ad3", "JPUSH_CHANNEL_IOS" : "8a5efd65cda14fafa6e64ad3",
"JPUSH_APPKEY_ANDROID": "b5f679f4357018605ea6fd2e", "JPUSH_APPKEY_ANDROID" : "b5f679f4357018605ea6fd2e",
"JPUSH_CHANNEL_ANDROID": "", "JPUSH_CHANNEL_ANDROID" : "",
"__plugin_info__": { "__plugin_info__" : {
"name": "JG-JCore", "name" : "JG-JCore",
"description": "极光推送JCore插件", "description" : "极光推送JCore插件",
"platforms": "Android,iOS", "platforms" : "Android,iOS",
"url": "", "url" : "",
"android_package_name": "uni.UNI3A527D1", "android_package_name" : "uni.UNI3A527D1",
"ios_bundle_id": "", "ios_bundle_id" : "",
"isCloud": false, "isCloud" : false,
"bought": -1, "bought" : -1,
"pid": "", "pid" : "",
"parameters": { "parameters" : {
"JPUSH_APPKEY_IOS": { "JPUSH_APPKEY_IOS" : {
"des": "[iOS]极光portal配置应用信息时分配的AppKey", "des" : "[iOS]极光portal配置应用信息时分配的AppKey",
"key": "JCore:APP_KEY", "key" : "JCore:APP_KEY",
"value": "daebe19b547c43128796a078" "value" : "daebe19b547c43128796a078"
}, },
"JPUSH_CHANNEL_IOS": { "JPUSH_CHANNEL_IOS" : {
"des": "[iOS]用于统计分发渠道不需要可填默认值developer-default", "des" : "[iOS]用于统计分发渠道不需要可填默认值developer-default",
"key": "JCore:CHANNEL", "key" : "JCore:CHANNEL",
"value": "" "value" : ""
}, },
"JPUSH_APPKEY_ANDROID": { "JPUSH_APPKEY_ANDROID" : {
"des": "[Android]极光portal配置应用信息时分配的AppKey", "des" : "[Android]极光portal配置应用信息时分配的AppKey",
"key": "JPUSH_APPKEY", "key" : "JPUSH_APPKEY",
"value": "" "value" : ""
}, },
"JPUSH_CHANNEL_ANDROID": { "JPUSH_CHANNEL_ANDROID" : {
"des": "[Android]用于统计分发渠道不需要可填默认值developer-default", "des" : "[Android]用于统计分发渠道不需要可填默认值developer-default",
"key": "JPUSH_CHANNEL", "key" : "JPUSH_CHANNEL",
"value": "" "value" : ""
} }
} }
} }
}, },
"JG-JPush": { "JG-JPush" : {
"JPUSH_ISPRODUCTION_IOS": "true", "JPUSH_ISPRODUCTION_IOS" : "true",
"JPUSH_ADVERTISINGID_IOS": "", "JPUSH_ADVERTISINGID_IOS" : "",
"JPUSH_DEFAULTINITJPUSH_IOS": "true", "JPUSH_DEFAULTINITJPUSH_IOS" : "true",
"JPUSH_OPPO_APPKEY": "", "JPUSH_OPPO_APPKEY" : "",
"JPUSH_OPPO_APPID": "", "JPUSH_OPPO_APPID" : "",
"JPUSH_OPPO_APPSECRET": "", "JPUSH_OPPO_APPSECRET" : "",
"JPUSH_VIVO_APPKEY": "", "JPUSH_VIVO_APPKEY" : "",
"JPUSH_VIVO_APPID": "", "JPUSH_VIVO_APPID" : "",
"JPUSH_MEIZU_APPKEY": "", "JPUSH_MEIZU_APPKEY" : "",
"JPUSH_MEIZU_APPID": "", "JPUSH_MEIZU_APPID" : "",
"JPUSH_XIAOMI_APPKEY": "", "JPUSH_XIAOMI_APPKEY" : "",
"JPUSH_XIAOMI_APPID": "", "JPUSH_XIAOMI_APPID" : "",
"__plugin_info__": { "__plugin_info__" : {
"name": "JG-JPush", "name" : "JG-JPush",
"description": "极光推送Hbuilder插件", "description" : "极光推送Hbuilder插件",
"platforms": "Android,iOS", "platforms" : "Android,iOS",
"url": "", "url" : "",
"android_package_name": "uni.UNI3A527D1", "android_package_name" : "uni.UNI3A527D1",
"ios_bundle_id": "", "ios_bundle_id" : "",
"isCloud": false, "isCloud" : false,
"bought": -1, "bought" : -1,
"pid": "", "pid" : "",
"parameters": { "parameters" : {
"JPUSH_ISPRODUCTION_IOS": { "JPUSH_ISPRODUCTION_IOS" : {
"des": "[iOS]是否是生产环境是填true不是填false或者不填", "des" : "[iOS]是否是生产环境是填true不是填false或者不填",
"key": "JPush:ISPRODUCTION", "key" : "JPush:ISPRODUCTION",
"value": "" "value" : ""
}, },
"JPUSH_ADVERTISINGID_IOS": { "JPUSH_ADVERTISINGID_IOS" : {
"des": "[iOS]广告标识符IDFA如果不需要使用IDFA可不填", "des" : "[iOS]广告标识符IDFA如果不需要使用IDFA可不填",
"key": "JPush:ADVERTISINGID", "key" : "JPush:ADVERTISINGID",
"value": "" "value" : ""
}, },
"JPUSH_DEFAULTINITJPUSH_IOS": { "JPUSH_DEFAULTINITJPUSH_IOS" : {
"des": "[iOS]是否默认初始化是填true不是填false或者不填", "des" : "[iOS]是否默认初始化是填true不是填false或者不填",
"key": "JPush:DEFAULTINITJPUSH", "key" : "JPush:DEFAULTINITJPUSH",
"value": "" "value" : ""
}, },
"JPUSH_OPPO_APPKEY": { "JPUSH_OPPO_APPKEY" : {
"des": "厂商OPPO-appkey,示例OP-12345678", "des" : "厂商OPPO-appkey,示例OP-12345678",
"key": "OPPO_APPKEY", "key" : "OPPO_APPKEY",
"value": "" "value" : ""
}, },
"JPUSH_OPPO_APPID": { "JPUSH_OPPO_APPID" : {
"des": "厂商OPPO-appId,示例OP-12345678", "des" : "厂商OPPO-appId,示例OP-12345678",
"key": "OPPO_APPID", "key" : "OPPO_APPID",
"value": "" "value" : ""
}, },
"JPUSH_OPPO_APPSECRET": { "JPUSH_OPPO_APPSECRET" : {
"des": "厂商OPPO-appSecret,示例OP-12345678", "des" : "厂商OPPO-appSecret,示例OP-12345678",
"key": "OPPO_APPSECRET", "key" : "OPPO_APPSECRET",
"value": "" "value" : ""
}, },
"JPUSH_VIVO_APPKEY": { "JPUSH_VIVO_APPKEY" : {
"des": "厂商VIVO-appkey,示例12345678", "des" : "厂商VIVO-appkey,示例12345678",
"key": "com.vivo.push.api_key", "key" : "com.vivo.push.api_key",
"value": "" "value" : ""
}, },
"JPUSH_VIVO_APPID": { "JPUSH_VIVO_APPID" : {
"des": "厂商VIVO-appId,示例12345678", "des" : "厂商VIVO-appId,示例12345678",
"key": "com.vivo.push.app_id", "key" : "com.vivo.push.app_id",
"value": "" "value" : ""
}, },
"JPUSH_MEIZU_APPKEY": { "JPUSH_MEIZU_APPKEY" : {
"des": "厂商MEIZU-appKey,示例MZ-12345678", "des" : "厂商MEIZU-appKey,示例MZ-12345678",
"key": "MEIZU_APPKEY", "key" : "MEIZU_APPKEY",
"value": "" "value" : ""
}, },
"JPUSH_MEIZU_APPID": { "JPUSH_MEIZU_APPID" : {
"des": "厂商MEIZU-appId,示例MZ-12345678", "des" : "厂商MEIZU-appId,示例MZ-12345678",
"key": "MEIZU_APPID", "key" : "MEIZU_APPID",
"value": "" "value" : ""
}, },
"JPUSH_XIAOMI_APPKEY": { "JPUSH_XIAOMI_APPKEY" : {
"des": "厂商XIAOMI-appKey,示例MI-12345678", "des" : "厂商XIAOMI-appKey,示例MI-12345678",
"key": "XIAOMI_APPKEY", "key" : "XIAOMI_APPKEY",
"value": "" "value" : ""
}, },
"JPUSH_XIAOMI_APPID": { "JPUSH_XIAOMI_APPID" : {
"des": "厂商XIAOMI-appId,示例MI-12345678", "des" : "厂商XIAOMI-appId,示例MI-12345678",
"key": "XIAOMI_APPID", "key" : "XIAOMI_APPID",
"value": "" "value" : ""
} }
} }
} }
} }
} }
}, },
/* */ /* */
"quickapp": {}, "quickapp" : {},
/* */ /* */
"mp-weixin": { "mp-weixin" : {
"appid": "wx5fb1cc8edb3f8baa", "appid" : "wx5fb1cc8edb3f8baa",
"setting": { "setting" : {
"urlCheck": false, "urlCheck" : false,
"minified": true, "minified" : true,
"postcss": true, "postcss" : true,
"es6": true "es6" : true
}, },
"permission": { "permission" : {
"scope.userLocation": { "scope.userLocation" : {
"desc": "获取您的位置" "desc" : "获取您的位置"
} }
}, },
"requiredPrivateInfos": ["getLocation", "chooseAddress"], "requiredPrivateInfos" : [ "getLocation", "chooseAddress" ],
"usingComponents": true, "usingComponents" : true,
"__usePrivacyCheck__": true "__usePrivacyCheck__" : true
}, },
"mp-alipay": { "mp-alipay" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-baidu": { "mp-baidu" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-toutiao": { "mp-toutiao" : {
"usingComponents": true "usingComponents" : true
}, },
"h5": { "h5" : {
"devServer": { "devServer" : {
"https": false "https" : false
}, },
"router": { "router" : {
"mode": "history", "mode" : "history",
"base": "" "base" : ""
}, },
"domain": "", "domain" : "",
"sdkConfigs": { "sdkConfigs" : {
"maps": { "maps" : {
"qqmap": { "qqmap" : {
"key": "SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7" "key" : "SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7"
} }
} }
}, },
"title": "加载中...", "title" : "加载中...",
"template": "template.h5.html", "template" : "template.h5.html",
"optimization": { "optimization" : {
"treeShaking": { "treeShaking" : {
"enable": true "enable" : true
} }
} }
} }
} }

View File

@ -51,7 +51,7 @@
}, { }, {
"path": "pages/whole_sale/index", "path": "pages/whole_sale/index",
"style": { "style": {
"enablePullDownRefresh": false, "enablePullDownRefresh": true,
"navigationBarTitleText": "批发", "navigationBarTitleText": "批发",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
@ -388,14 +388,14 @@
"style": { "style": {
"navigationBarTitleText": "里海云仓", "navigationBarTitleText": "里海云仓",
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": false "enablePullDownRefresh": true
} }
}, },
{ {
"path": "market/market", "path": "market/market",
"style": { "style": {
"navigationBarTitleText": "供销云市场", "navigationBarTitleText": "供销云市场",
"enablePullDownRefresh": false, "enablePullDownRefresh": true,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
@ -403,7 +403,7 @@
"path": "specialty/specialty", "path": "specialty/specialty",
"style": { "style": {
"navigationBarTitleText": "名优特产", "navigationBarTitleText": "名优特产",
"enablePullDownRefresh": false, "enablePullDownRefresh": true,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
} }

View File

@ -113,7 +113,7 @@
</div> </div>
<div class="broadcast_details_picBox_no noPad"> <div class="broadcast_details_picBox_no noPad">
<div class="broadcast_details_pic"> <div class="broadcast_details_pic">
{{ item.product.price }} {{ saleType == 1? item.product.price :item.product.wholesale_price}}
</div> </div>
<div class="broadcast_details_tit_no line1"> <div class="broadcast_details_tit_no line1">
{{item.product.store_name}} {{item.product.store_name}}
@ -271,7 +271,7 @@
</div> </div>
<div class="broadcast_details_picBox_no noPad"> <div class="broadcast_details_picBox_no noPad">
<div class="broadcast_details_pic"> <div class="broadcast_details_pic">
{{ item.product.price }} {{ saleType == 1? item.product.price :item.product.wholesale_price}}
</div> </div>
<div class="broadcast_details_tit_no line1"> <div class="broadcast_details_tit_no line1">
{{item.product.store_name}} {{item.product.store_name}}
@ -459,7 +459,7 @@
</div> </div>
<div class="broadcast_details_picBox_no noPad"> <div class="broadcast_details_picBox_no noPad">
<div class="broadcast_details_pic"> <div class="broadcast_details_pic">
{{ item.product.price }} {{ saleType == 1? item.product.price :item.product.wholesale_price}}
</div> </div>
<div class="broadcast_details_tit_no line1"> <div class="broadcast_details_tit_no line1">
{{item.product.store_name}} {{item.product.store_name}}
@ -612,7 +612,7 @@
</div> </div>
<div class="broadcast_details_picBox_no noPad"> <div class="broadcast_details_picBox_no noPad">
<div class="broadcast_details_pic"> <div class="broadcast_details_pic">
{{ item.product.price }} {{ saleType == 1? item.product.price :item.product.wholesale_price}}
</div> </div>
<div class="broadcast_details_tit_no line1"> <div class="broadcast_details_tit_no line1">
{{item.product.store_name}} {{item.product.store_name}}
@ -718,7 +718,7 @@
<div class="broadcast_details_tit">{{productInfo.store_name}}</div> <div class="broadcast_details_tit">{{productInfo.store_name}}</div>
<div class="acea-row row-between product_price"> <div class="acea-row row-between product_price">
<div class="broadcast_details_pic p-color"> <div class="broadcast_details_pic p-color">
{{ productInfo.price}} {{ saleType == 1 ? productInfo.price :productInfo.wholesale_price}}
</div> </div>
<div class="broadcast_details_btn product_btn" @click="sendProduct">发送商品</div> <div class="broadcast_details_btn product_btn" @click="sendProduct">发送商品</div>
</div> </div>
@ -957,7 +957,8 @@
httpUrl: '', httpUrl: '',
press: false, press: false,
index: 0, index: 0,
j: 0 j: 0,
saleType: ''
}; };
}, },
watch: { watch: {
@ -983,8 +984,9 @@
this.combinationId = parseInt(option.combinationId) || 0; this.combinationId = parseInt(option.combinationId) || 0;
this.orderId = option.order_id || "" this.orderId = option.order_id || ""
this.mer_id = option.mer_id || 0 this.mer_id = option.mer_id || 0
this.refund_order_id = option.refund_order_id || 0 this.refund_order_id = option.refund_order_id || 0;
this.userId = option.userId || 0 this.userId = option.userId || 0;
this.saleType = option.sale_type || '';
uni.getSystemInfo({ uni.getSystemInfo({
success: function(res) { success: function(res) {
self.windowH = res.windowHeight self.windowH = res.windowHeight
@ -1006,6 +1008,10 @@
}); });
}); });
// #endif // #endif
var isWholeSale = this.$store.state.app.userInfo?.mer_info?.wholesale
console.log(isWholeSale);
}, },
onReady() { onReady() {
this.httpUrl = `${HTTP_REQUEST_URL}/static/look.png`; this.httpUrl = `${HTTP_REQUEST_URL}/static/look.png`;
@ -1452,7 +1458,8 @@
sendProduct() { sendProduct() {
consultApi({ consultApi({
user_id: this.toUid, user_id: this.toUid,
product_id: this.productId product_id: this.productId,
sale_type: this.saleType
}) })
if (this.presellId || this.combinationId) { if (this.presellId || this.combinationId) {
if (this.presellId) { if (this.presellId) {

View File

@ -1,3 +1,292 @@
<template>
<view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
<!-- 顶部 -->
<view class="wholeSale-header">
<!-- 适配不同机 -->
<view style="height: var(--status-bar-height);background-color: #40af37;"></view>
<view style="display: flex;padding: 20rpx 28rpx;background-color: #40af37;color: #fff;">
<view style="display: flex;font-weight: bold;font-size: 32rpx;"><u-icon style="margin-right: 20rpx;"
name="arrow-left" size="20" color="#fff" @click="navBack"></u-icon>里海云仓</view>
</view>
</view>
<view :style="{height:'calc(' +wrapHeight+ 'rpx + 92rpx + var(--status-bar-height))'}"></view>
<!-- 分类区域 -->
<view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}">
<view class="wholeSale-nav">
<view @click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}`)"
hover-class="none" class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text" placeholder="搜索商品名称" :value="where.keyword"
placeholder-style="font-size: 30rpx;color:#999;" disabled style="pointer-events: none;">
</view>
</view>
</view>
<!-- 商品大分类 -->
<view class="category">
<scroll-view scroll-x="true" :scroll-into-view="scrollIndex">
<view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :id="'scroll' + index"
:class="{'category-item-active': index==cate_change}" @click="changeCate(index)">
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
<view class="category-all" v-if="store_category.length > 0" @click="onAllCategory">
<view style="margin-bottom: 10rpx;">全部</view>
<u-icon name="list"></u-icon>
</view>
</view>
<!-- 商品小分类 -->
<view class="cate" v-if="store_category_children.length>1">
<scroll-view scroll-x="true">
<view class="cate-wrap">
<block v-for="(item,index) in store_category_children" :key="index">
<view class="cate-item" :class="{'cate-item-active':index == cate_change_children}"
@click="changeChildrenCate(index)">
<text>{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
</view>
</view>
<!-- 内容 -->
<view class="wholeSale-con">
<!-- 流水瀑布 -->
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</view>
<!-- 弹框大分类 -->
<uni-popup ref="popup" type="top" border-radius="10px 10px 0 0" z-index="1000">
<view class="popup-wrap">
<view style="height: var(--status-bar-height);"></view>
<view class="popup-wrap-title">分类</view>
<view class="popup-wrap-category">
<view class="popup-wrap-category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="popup-wrap-category-item"
:class="{'popup-wrap-category-item-active': index==cate_change}"
@click="changeCate(index)">
<u--image class="popup-wrap-category-item-img" width="108rpx" :src="item.pic"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="popup-wrap-category-item-text">{{item.cate_name}}</text>
</view>
</block>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import {
goShopDetail
} from '@/libs/order.js'
import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
import {
getStoreCategory,
getProductslist
} from "@/api/store.js"
export default {
components: {
WaterfallsFlow
},
data() {
return {
hostProduct: [],
store_category: [], //
store_category_children: [], //
cate_change: 0,
cate_change_children: 0,
isLoading: 0,
isScroll: false,
where: {
page: 1,
limit: 20,
mer_type: 1, //1-, 2-, 3-
cate_pid: '',
keyword: '',
deduction_rate: '', //
rand: 1
},
wrapHeight: 300,
touchstarty: 0,
scrollIndex: ''
}
},
onLoad(option) {
this.getStoreCategory();
this.getProductslist(true);
},
onPageScroll() {
uni.$emit('scroll');
},
onPullDownRefresh() {
this.getProductslist(true);
},
onReachBottom() {
this.getProductslist();
},
methods: {
//
onTouchStart(e) {
this.touchstarty = e.touches[0].clientY;
},
//
onTouchMove(e) {
this.$nextTick(() => {
let deltaY = e.changedTouches[0].clientY - this.touchstarty;
if (deltaY <= 0) {
console.log("上滑")
this.wrapHeight = 0;
} else {
console.log('下滑');
if (this.where.cate_pid) this.wrapHeight = 360;
else this.wrapHeight = 300;
}
this.$forceUpdate();
})
},
onAllCategory() {
this.$refs.popup.open();
},
navTo(url) {
uni.navigateTo({
url: url,
success: () => {
uni.$once('searchValue', (e) => {
this.$nextTick(() => {
this.where.keyword = e;
this.getProductslist(true);
})
})
}
})
},
changeCate(e) {
this.cate_change = e;
this.store_category_children = [];
if (this.store_category[e].children) this.store_category_children = [...this.store_category[e].children];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
this.cate_change_children = 0;
this.where.cate_pid = this.store_category[e].store_category_id;
this.getProductslist(true);
if (this.where.cate_pid) this.wrapHeight = 360;
else this.wrapHeight = 300;
// scrollView
this.scrollIndex = 'scroll' + e;
this.$refs.popup && this.$refs.popup.close();
},
changeChildrenCate(e) {
this.cate_change_children = e;
this.where.cate_pid = this.store_category_children[e].store_category_id;
if (e == 0) this.where.cate_pid = this.store_category[this.cate_change]
.store_category_id; // , id
this.getProductslist(true);
},
getStoreCategory() {
getStoreCategory(259).then(res => {
this.store_category = [{
cate_name: '全部',
pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/0bc7a202404021652194310.png',
store_category_id: ''
}, ...res.data];
this.store_category_children = this.store_category[0].children || [];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
})
},
getProductslist(reLoad = false) {
if (reLoad) {
this.where.page = 1;
this.hostProduct = [];
this.isLoading = 0;
}
if (this.isLoading == -1) return;
this.isLoading = 1;
getProductslist(this.where).then(res => {
uni.stopPullDownRefresh();
this.where.limit = res.data.limit
this.where.page = res.data.page
this.hostProduct = [...this.hostProduct, ...res.data.list];
this.isLoading = 0;
if (res.data.list.length < this.where.limit) {
this.isLoading = -1;
}
this.where.page++;
}).catch(err => {
uni.stopPullDownRefresh();
})
},
goDetail(item) {
goShopDetail(item, this.uid).then(res => {
if (this.isLogin) {
initiateAssistApi(item.activity_id).then(res => {
let id = res.data.product_assist_set_id;
uni.hideLoading();
uni.navigateTo({
url: '/pages/activity/assist_detail/index?id=' + id
});
}).catch((err) => {
uni.showToast({
title: err,
icon: 'none'
})
});
} else {
toLogin();
}
})
},
navBack() {
uni.navigateBack();
}
}
}
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
page { page {
background-color: #f8fafb !important; background-color: #f8fafb !important;
@ -7,26 +296,28 @@
background-color: #f8fafb !important; background-color: #f8fafb !important;
.wholeSale-header { .wholeSale-header {
position: sticky; position: fixed;
top: 0; top: 0;
z-index: 9; z-index: 98;
width: 100%;
margin-bottom: 20rpx; margin-bottom: 20rpx;
background-color: #40AE36; background-color: #40AE36;
} }
.wholeSale-section { .wholeSale-section {
position: sticky; position: fixed;
top: calc(82rpx + var(--status-bar-height)); z-index: 97;
width: 100%;
top: calc(80rpx + var(--status-bar-height));
padding: 0rpx 20rpx; padding: 0rpx 20rpx;
background-color: #fff; background-color: #fff;
transition: height .5s; transition: height .5s;
overflow: hidden; overflow: hidden;
margin-bottom: 20rpx;
.wholeSale-nav { .wholeSale-nav {
display: flex; display: flex;
align-items: center; align-items: center;
padding-bottom: 20rpx; padding: 20rpx 0;
.icon { .icon {
margin-right: 20rpx; margin-right: 20rpx;
@ -124,17 +415,16 @@
right: 0; right: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
height: 100%; height: 101%;
background-color: #f3f3f3;
z-index: 10; z-index: 10;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
font-size: 24rpx; font-size: 24rpx;
border-radius: 4rpx;
width: 70rpx; width: 70rpx;
color: #919191; color: #919191;
box-shadow: 0px 0px 60rpx #c5c5c5;
} }
} }
@ -238,293 +528,3 @@
} }
} }
</style> </style>
<template>
<view class="wholeSale">
<!-- 顶部 -->
<view class="wholeSale-header">
<!-- 适配不同机 -->
<view style="height: var(--status-bar-height);background-color: #40af37;"></view>
<view style="display: flex;padding: 20rpx 28rpx;background-color: #40af37;color: #fff;">
<view style="display: flex;font-weight: bold;font-size: 32rpx;"><u-icon style="margin-right: 20rpx;"
name="arrow-left" size="20" color="#fff" @click="navBack"></u-icon>里海云仓</view>
</view>
</view>
<!-- 分类区域 -->
<view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}">
<view class="wholeSale-nav">
<view @click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}`)"
hover-class="none" class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text" placeholder="搜索商品名称" :value="where.keyword"
placeholder-style="font-size: 30rpx;color:#999;" disabled style="pointer-events: none;">
</view>
</view>
</view>
<!-- 商品大分类 -->
<view class="category">
<scroll-view scroll-x="true">
<view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
<view class="category-all" v-if="store_category.length > 0" @click="onAllCategory">
<view style="margin-bottom: 20rpx;">全部</view>
<u-icon name="list"></u-icon>
</view>
</view>
<!-- 商品小分类 -->
<view class="cate" v-if="store_category_children.length>1">
<scroll-view scroll-x="true">
<view class="cate-wrap">
<block v-for="(item,index) in store_category_children" :key="index">
<view class="cate-item" :class="{'cate-item-active':index == cate_change_children}"
@click="changeChildrenCate(index)">
<text>{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
</view>
</view>
<!-- 内容 -->
<view class="wholeSale-con"
:style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx '+(isShowSmall?' - 48rpx':'')+')'}">
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;"
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling"
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'>
<view>
<!-- 流水瀑布 -->
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</view>
</scroll-view>
</view>
<!-- 弹框大分类 -->
<uni-popup ref="popup" type="top" border-radius="10px 10px 0 0" z-index="1000">
<view class="popup-wrap">
<view style="height: var(--status-bar-height);"></view>
<view class="popup-wrap-title">分类</view>
<view class="popup-wrap-category">
<view class="popup-wrap-category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="popup-wrap-category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<u--image class="popup-wrap-category-item-img" width="108rpx" :src="item.pic"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="popup-wrap-category-item-text">{{item.cate_name}}</text>
</view>
</block>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import {
goShopDetail
} from '@/libs/order.js'
import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
import {
getStoreCategory,
getProductslist
} from "@/api/store.js"
export default {
components: {
WaterfallsFlow
},
data() {
return {
hostProduct: [],
store_category: [], //
store_category_children: [], //
cate_change: 0,
cate_change_children: 0,
isLoading: 0,
where: {
page: 1,
limit: 20,
mer_type: 1, //1-, 2-, 3-
cate_pid: '',
keyword: '',
deduction_rate: '', //
rand: 1
},
wrapHeight: 300,
isShowSmall: false,
scrollTop: 0,
isTriggered: true
}
},
onLoad(option) {
this.getStoreCategory();
this.getProductslist(true);
},
onPageScroll(e) {
uni.$emit('scroll');
},
watch: {
'where.cate_pid'(newVal, oldVal) {
if (newVal && !oldVal) {
this.wrapHeight = 300 + 48;
this.isShowSmall = true;
}
if (!newVal && oldVal) {
this.wrapHeight = 300;
this.isShowSmall = false;
}
}
},
methods: {
//
onPulling() {
if (!this.isTriggered) {
this.isTriggered = true;
this.getProductslist(true);
}
},
onRefresh(e) {
this.isTriggered = true;
},
onScrollBottom(e) {
this.getProductslist();
},
onAllCategory() {
this.$refs.popup.open();
},
onScroll(e) {
if (this.scrollTop > e.target.scrollTop) { //
this.wrapHeight = 300;
if (this.where.cate_pid) this.wrapHeight = this.wrapHeight + 48;
} else {
this.wrapHeight = 0;
}
this.scrollTop = e.target.scrollTop;
},
navTo(url) {
uni.navigateTo({
url: url,
success: () => {
uni.$once('searchValue', (e) => {
this.$nextTick(() => {
this.where.keyword = e;
this.getProductslist(true);
})
})
}
})
},
navBack() {
uni.navigateBack();
},
changeCate(e) {
this.cate_change = e;
this.store_category_children = [];
if (this.store_category[e].children) this.store_category_children = [...this.store_category[e].children];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
this.cate_change_children = 0;
this.where.cate_pid = this.store_category[e].store_category_id;
this.getProductslist(true);
this.$refs.popup && this.$refs.popup.close();
},
changeChildrenCate(e) {
this.cate_change_children = e;
this.where.cate_pid = this.store_category_children[e].store_category_id;
if (e == 0) this.where.cate_pid = this.store_category[this.cate_change]
.store_category_id; // , id
this.getProductslist(true);
},
getStoreCategory() {
getStoreCategory(259).then(res => {
this.store_category = [{
cate_name: '全部',
pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/0bc7a202404021652194310.png',
store_category_id: ''
}, ...res.data];
this.store_category_children = this.store_category[0].children || [];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
})
},
getProductslist(reLoad = false) {
if (reLoad) {
this.where.page = 1;
this.hostProduct = [];
this.isLoading = 0;
}
if (this.isLoading == -1) return;
this.isLoading = 1;
getProductslist(this.where).then(res => {
this.where.limit = res.data.limit
this.where.page = res.data.page
this.isTriggered = false;
this.hostProduct = [...this.hostProduct, ...res.data.list];
this.isLoading = 0;
if (res.data.list.length < this.where.limit) this.isLoading = -1;
this.where.page++;
}).catch(err => {
this.isTriggered = false;
})
},
goDetail(item) {
goShopDetail(item, this.uid).then(res => {
if (this.isLogin) {
initiateAssistApi(item.activity_id).then(res => {
let id = res.data.product_assist_set_id;
uni.hideLoading();
uni.navigateTo({
url: '/pages/activity/assist_detail/index?id=' + id
});
}).catch((err) => {
uni.showToast({
title: err,
icon: 'none'
})
});
} else {
toLogin();
}
})
}
}
}
</script>

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="wholeSale"> <view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
<!-- 适配不同机 --> <!-- 适配不同机 -->
<view class="wholeSale-header"> <view class="wholeSale-header">
@ -26,6 +26,8 @@
</view> </view>
</view> </view>
<view :style="{height:'calc(' + wrapHeight + 'rpx + 92rpx + var(--status-bar-height))'}"></view>
<!-- 分类区域 --> <!-- 分类区域 -->
<view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}"> <view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}">
<view class="wholeSale-nav"> <view class="wholeSale-nav">
@ -42,11 +44,11 @@
<!-- 商品大分类 --> <!-- 商品大分类 -->
<view class="category"> <view class="category">
<scroll-view scroll-x="true"> <scroll-view scroll-x="true" :scroll-into-view="scrollIndex">
<view class="category-wrap"> <view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index"> <block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}" <view class="category-item" :id="'scroll' + index"
@click="changeCate(index)"> :class="{'category-item-active': index==cate_change}" @click="changeCate(index)">
<u--image class="category-item-img" width="108rpx" :src="item.background" <u--image class="category-item-img" width="108rpx" :src="item.background"
height="108rpx" shape="circle"> height="108rpx" shape="circle">
<template v-slot:loading> <template v-slot:loading>
@ -67,55 +69,50 @@
</view> </view>
<!-- 列表 --> <!-- 列表 -->
<view class="goods_list" :style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx)'}"> <view class="goods_list">
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;" <view class="goods" v-for="(item, index) in goodsList" :key="index" @click="goStore(item.mer_id)">
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling" <view class="avatar">
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'> <u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
<view class="goods" v-for="(item, index) in goodsList" :key="index" @click="goStore(item.mer_id)"> <template v-slot:loading>
<view class="avatar"> <u-loading-icon color="#999" size="15" />
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill"> </template>
<template v-slot:loading> </u--image>
<u-loading-icon color="#999" size="15" /> </view>
</template> <view class="content">
</u--image> <view class="content-head">
<view class="title">{{item.mer_name}}</view>
<text style="font-size: 21.03rpx;color: #aaa;" v-if="item.sales>=100">月销{{item.sales}}</text>
</view> </view>
<view class="content"> <view class="content-two">
<view class="content-head"> <view class="score">
<view class="title">{{item.mer_name}}</view> <view class="star">
<text style="font-size: 21.03rpx;color: #aaa;" <view
v-if="item.sales>=100">月销{{item.sales}}</text> :style="{width: `${(item.service_score / 5 * 100).toFixed(0)}%`, backgroundImage: `url(${domain}/static/diy/score1${keyColor}.png)`}">
</view>
<view class="content-two">
<view class="score">
<view class="star">
<view
:style="{width: `${(item.service_score / 5 * 100).toFixed(0)}%`, backgroundImage: `url(${domain}/static/diy/score1${keyColor}.png)`}">
</view>
</view> </view>
</view> </view>
<text
style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
<text v-if="item.distance"
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</text>
<text style="margin-left:20rpx;" class="line1">{{item.category_name}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true"
src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image>
<text v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text class="address">{{item.mer_address}}</text>
</view> </view>
<text
style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
<text v-if="item.distance"
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</text>
<text style="margin-left:20rpx;" class="line1">{{item.category_name}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true"
src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image>
<text v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text class="address">{{item.mer_address}}</text>
</view> </view>
</view> </view>
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore> </view>
</scroll-view> <loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</view> </view>
<!-- 弹框大分类 --> <!-- 弹框大分类 -->
@ -181,6 +178,7 @@
cate_change: 0, cate_change: 0,
goodsList: [], goodsList: [],
isLoading: 0, isLoading: 0,
isScroll: false,
isShowAddress: false, isShowAddress: false,
street: '定位中', street: '定位中',
where: { where: {
@ -193,8 +191,8 @@
location: '' location: ''
}, },
wrapHeight: 300, wrapHeight: 300,
scrollTop: 0, touchstarty: 0,
isTriggered: false scrollIndex: ''
} }
}, },
computed: { computed: {
@ -206,6 +204,19 @@
hide_mer_status: '', hide_mer_status: '',
}, mapGetters(['viewColor', 'keyColor'])), }, mapGetters(['viewColor', 'keyColor'])),
}, },
onPageScroll() {
uni.$emit('scroll');
},
onPullDownRefresh() {
this.storeMerchantList(true);
},
onReachBottom() {
this.storeMerchantList();
},
onLoad(option) { onLoad(option) {
let getAddress = uni.getStorageSync('getAddress'); let getAddress = uni.getStorageSync('getAddress');
let closeShow = uni.getStorageSync('closeShow'); let closeShow = uni.getStorageSync('closeShow');
@ -221,39 +232,33 @@
this.merClassifly(); this.merClassifly();
this.storeMerchantList(); this.storeMerchantList();
}, },
onPageScroll() {
uni.$emit('scroll');
},
methods: { methods: {
//
onPulling() { //
if (!this.isTriggered) { onTouchStart(e) {
this.isTriggered = true; this.touchstarty = e.touches[0].clientY;
this.storeMerchantList(true);
}
}, },
onRefresh(e) { //
this.isTriggered = true; onTouchMove(e) {
}, this.$nextTick(() => {
let deltaY = e.changedTouches[0].clientY - this.touchstarty;
onScrollBottom(e) { if (deltaY <= 0) {
this.storeMerchantList(); console.log("上滑")
this.wrapHeight = 0;
} else {
console.log('下滑');
this.wrapHeight = 300;
}
this.$forceUpdate();
})
}, },
onAllCategory() { onAllCategory() {
this.$refs.popup.open(); this.$refs.popup.open();
}, },
onScroll(e) {
if (this.scrollTop > e.target.scrollTop) { //
this.wrapHeight = 300;
} else {
this.wrapHeight = 0;
}
this.scrollTop = e.target.scrollTop;
},
navTo(url) { navTo(url) {
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
@ -276,15 +281,20 @@
this.where.merchant_category_id = this.store_category[e].merchant_category_id; this.where.merchant_category_id = this.store_category[e].merchant_category_id;
this.storeMerchantList(true); this.storeMerchantList(true);
// scrollView
this.scrollIndex = 'scroll' + e;
this.$refs.popup && this.$refs.popup.close(); this.$refs.popup && this.$refs.popup.close();
this.$forceUpdate(); this.$forceUpdate();
}, },
// //
goStore(id) { goStore(id) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/store/home/index?id=${id}` url: `/pages/store/home/index?id=${id}`
}) })
}, },
merClassifly() { merClassifly() {
merClassifly().then(res => { merClassifly().then(res => {
this.store_category = [{ this.store_category = [{
@ -294,6 +304,7 @@
}, ...res.data]; }, ...res.data];
}) })
}, },
storeMerchantList(reLoad = false) { storeMerchantList(reLoad = false) {
if (reLoad) { if (reLoad) {
this.where.page = 1; this.where.page = 1;
@ -303,19 +314,21 @@
if (this.isLoading == -1) return; if (this.isLoading == -1) return;
this.isLoading = 1; this.isLoading = 1;
storeMerchantList(this.where).then(res => { storeMerchantList(this.where).then(res => {
this.isTriggered = false; uni.stopPullDownRefresh();
this.goodsList = [...this.goodsList, ...res.data.list]; this.goodsList = [...this.goodsList, ...res.data.list];
this.isLoading = 0; this.isLoading = 0;
if (res.data.list.length < this.where.limit) this.isLoading = -1; if (res.data.list.length < this.where.limit) this.isLoading = -1;
this.where.page++; this.where.page++;
}).catch(() => { }).catch(() => {
this.isTriggered = false; uni.stopPullDownRefresh();
}) })
}, },
closeShowAddress() { closeShowAddress() {
this.isShowAddress = false; this.isShowAddress = false;
uni.setStorageSync('closeShow', true); uni.setStorageSync('closeShow', true);
}, },
// //
changeMap() { changeMap() {
uni.navigateTo({ uni.navigateTo({
@ -347,6 +360,7 @@
} }
}) })
}, },
getLocation() { getLocation() {
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
@ -403,7 +417,7 @@
}) })
} }
}) })
}, }
} }
} }
</script> </script>
@ -421,33 +435,33 @@
} }
.wholeSale-header { .wholeSale-header {
position: sticky; position: fixed;
top: 0; top: 0;
z-index: 90; z-index: 90;
margin-bottom: 20rpx; width: 100%;
background-color: #40AE36; background-color: #40AE36;
} }
.wholeSale-section { .wholeSale-section {
position: sticky; position: fixed;
top: calc(82rpx + var(--status-bar-height)); z-index: 10;
top: calc(80rpx + var(--status-bar-height));
width: 100%;
padding: 0rpx 20rpx; padding: 0rpx 20rpx;
background-color: #fff; background-color: #fff;
transition: height .5s; transition: height .5s;
overflow: hidden; overflow: hidden;
margin-bottom: 20rpx;
.wholeSale-nav { .wholeSale-nav {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 40rpx; padding: 20rpx 0;
.icon { .icon {
margin-right: 20rpx; margin-right: 20rpx;
} }
.search_content { .search_content {
// margin-bottom: 40rpx;
flex: 1; flex: 1;
height: 70rpx; height: 70rpx;
padding: 2px 2px 2px 21.05rpx; padding: 2px 2px 2px 21.05rpx;
@ -540,16 +554,15 @@
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
height: 100%; height: 100%;
background-color: #f3f3f3;
z-index: 10; z-index: 10;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
font-size: 24rpx; font-size: 24rpx;
border-radius: 4rpx;
width: 70rpx; width: 70rpx;
color: #919191; color: #919191;
box-shadow: 0px 0px 60rpx #c5c5c5;
} }
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="wholeSale"> <view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
<!-- 适配不同机 --> <!-- 适配不同机 -->
<view class="wholeSale-header"> <view class="wholeSale-header">
<view style="height: var(--status-bar-height);background-color: #40af37;"></view> <view style="height: var(--status-bar-height);background-color: #40af37;"></view>
@ -9,6 +9,8 @@
</view> </view>
</view> </view>
<view :style="{height:'calc(' + wrapHeight + 'rpx + 92rpx + var(--status-bar-height))'}"></view>
<view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}"> <view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}">
<view class="wholeSale-nav"> <view class="wholeSale-nav">
<!-- 搜索 --> <!-- 搜索 -->
@ -24,11 +26,11 @@
<!-- 商品大分类 --> <!-- 商品大分类 -->
<view class="category"> <view class="category">
<scroll-view scroll-x="true"> <scroll-view scroll-x="true" :scroll-into-view="scrollIndex">
<view class="category-wrap"> <view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index"> <block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}" <view class="category-item" :id="'scroll' + index"
@click="changeCate(index)"> :class="{'category-item-active': index==cate_change}" @click="changeCate(index)">
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx" <u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
shape="circle"> shape="circle">
<template v-slot:loading> <template v-slot:loading>
@ -63,16 +65,10 @@
</view> </view>
<!-- 内容 --> <!-- 内容 -->
<view class="wholeSale-con" :style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx )'}"> <view class="wholeSale-con">
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;" <!-- 流水瀑布 -->
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling" <WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'> <loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
<view>
<!-- 流水瀑布 -->
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</view>
</scroll-view>
</view> </view>
<!-- 弹框大分类 --> <!-- 弹框大分类 -->
@ -123,6 +119,7 @@
cate_change: 0, cate_change: 0,
cate_change_children: 0, cate_change_children: 0,
isLoading: 0, isLoading: 0,
isScroll: false,
where: { where: {
page: 1, page: 1,
limit: 20, limit: 20,
@ -132,46 +129,53 @@
sale_type: 1, //1-, 2- sale_type: 1, //1-, 2-
}, },
wrapHeight: 300, wrapHeight: 300,
scrollTop: 0, touchstarty: 0,
isTriggered: true scrollIndex: ''
} }
}, },
onPageScroll() {
uni.$emit('scroll');
},
onPullDownRefresh() {
this.getProductslist(true);
},
onReachBottom() {
this.getProductslist();
},
onLoad(option) { onLoad(option) {
this.getCategoryIndexList(); this.getCategoryIndexList();
this.getProductslist(true); this.getProductslist(true);
}, },
onPageScroll() {
uni.$emit('scroll');
},
methods: { methods: {
// //
onPulling() { onTouchStart(e) {
if (!this.isTriggered) { this.touchstarty = e.touches[0].clientY;
this.isTriggered = true;
this.getProductslist(true);
}
},
onRefresh(e) {
this.isTriggered = true;
}, },
onScrollBottom(e) { //
this.getProductslist(); onTouchMove(e) {
this.$nextTick(() => {
let deltaY = e.changedTouches[0].clientY - this.touchstarty;
if (deltaY <= 0) {
console.log("上滑")
this.wrapHeight = 0;
} else {
console.log('下滑');
this.wrapHeight = 300;
}
this.$forceUpdate();
})
}, },
onAllCategory() { onAllCategory() {
this.$refs.popup.open(); this.$refs.popup.open();
}, },
onScroll(e) {
if (this.scrollTop > e.target.scrollTop) { //
this.wrapHeight = 300;
} else {
this.wrapHeight = 0;
}
this.scrollTop = e.target.scrollTop;
},
navTo(url) { navTo(url) {
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
@ -203,6 +207,9 @@
this.where.cate_pid = this.store_category[e].store_category_id; this.where.cate_pid = this.store_category[e].store_category_id;
this.getProductslist(true); this.getProductslist(true);
// scrollView
this.scrollIndex = 'scroll' + e;
this.$refs.popup && this.$refs.popup.close(); this.$refs.popup && this.$refs.popup.close();
this.$forceUpdate(); this.$forceUpdate();
}, },
@ -241,13 +248,13 @@
if (this.isLoading == -1) return; if (this.isLoading == -1) return;
this.isLoading = 1; this.isLoading = 1;
getProductslist(this.where).then(res => { getProductslist(this.where).then(res => {
this.isTriggered = false; uni.stopPullDownRefresh();
this.hostProduct = [...this.hostProduct, ...res.data.list]; this.hostProduct = [...this.hostProduct, ...res.data.list];
this.where.page++; this.where.page++;
this.isLoading = 0; this.isLoading = 0;
if (res.data.list.length < this.where.limit) this.isLoading = -1; if (res.data.list.length < this.where.limit) this.isLoading = -1;
}).catch(() => { }).catch(() => {
this.isTriggered = false; uni.stopPullDownRefresh();
}) })
}, },
goDetail(item) { goDetail(item) {
@ -282,27 +289,27 @@
.wholeSale { .wholeSale {
.wholeSale-header { .wholeSale-header {
position: sticky; position: fixed;
top: 0; top: 0;
z-index: 90; z-index: 90;
width: 100%;
background-color: #40AE36; background-color: #40AE36;
} }
.wholeSale-section { .wholeSale-section {
position: sticky; position: fixed;
top: calc(82rpx + var(--status-bar-height)); top: calc(80rpx + var(--status-bar-height));
width: 100%;
padding: 0rpx 20rpx; padding: 0rpx 20rpx;
background-color: #fff; background-color: #fff;
transition: height .5s; transition: height .5s;
overflow: hidden; overflow: hidden;
margin-bottom: 20rpx; z-index: 89;
padding-top: 20rpx;
z-index: 20;
.wholeSale-nav { .wholeSale-nav {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 40rpx; padding: 20rpx 0;
.icon { .icon {
margin-right: 20rpx; margin-right: 20rpx;
@ -401,16 +408,15 @@
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
height: 100%; height: 100%;
background-color: #f3f3f3;
z-index: 10; z-index: 10;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
font-size: 24rpx; font-size: 24rpx;
border-radius: 4rpx;
width: 70rpx; width: 70rpx;
color: #919191; color: #919191;
box-shadow: 0px 0px 60rpx #c5c5c5;
} }
} }
} }

View File

@ -893,9 +893,7 @@
getConfig() { getConfig() {
let self = this let self = this
// //
getconfig().then(res => { getconfig().then(res => {}).catch(err => {})
}).catch(err => {})
}, },
/**到货通知*/ /**到货通知*/
arrivalNotice() { arrivalNotice() {
@ -1504,7 +1502,7 @@
toLogin() toLogin()
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: `/pages/chat/customer_list/chat?mer_id=${that.storeInfo.mer_id}&uid=${that.uid}&productId=${that.id}` url: `/pages/chat/customer_list/chat?mer_id=${that.storeInfo.mer_id}&uid=${that.uid}&productId=${that.id}&sale_type=${that.sale_type}`
}); });
} }
}, },

View File

@ -69,7 +69,11 @@
} from '@/utils'; } from '@/utils';
import { import {
getGeocoder getGeocoder
} from "@/api/store.js" } from "@/api/store.js";
import {
AUTH_EXPIRE_TIME
} from "@/config/app.js";
import permission from '@/utils/permission';
export default { export default {
name: 'homeComb', name: 'homeComb',
props: { props: {
@ -135,7 +139,7 @@
isCategory: false, isCategory: false,
swiperTop: 0, swiperTop: 0,
isFixed: true, isFixed: true,
street: '' street: '',
}; };
}, },
watch: { watch: {
@ -230,9 +234,43 @@
methods: { methods: {
async scanQRcode() { async scanQRcode() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
let result = await this.$store.dispatch("permission/requestPermissions", let result = await this.$store.dispatch("permission/requestPermissions", 'CAMERA');
'CAMERA') console.log('权限状态:' + result);
if (result != -1) {
console.log('允许设置...');
uni.removeStorageSync('expireTimeCamera');
} else {
const expireTime = uni.getStorageSync('expireTimeCamera');
console.log('过期时间:' + expireTime);
if (expireTime) {
if ((expireTime + AUTH_EXPIRE_TIME) < +new Date()) {
console.log('时间过期了....')
uni.removeStorageSync('expireTimeCamera');
uni.showModal({
title: '提示',
content: '操作权限已被拒绝,请手动前往设置',
confirmText: "立即设置",
success: (res) => {
if (res.confirm) {
permission.gotoAppSetting();
} else {
//
console.log('重置过期时间');
uni.setStorageSync('expireTimeCamera', +new Date());
}
}
})
} else {
console.log('时间还没过期....');
}
} else {
//
uni.setStorageSync('expireTimeCamera', +new Date());
}
}
if (result !== 1) return; if (result !== 1) return;
//
uni.removeStorageSync('expireTimeCamera');
// #endif // #endif
uni.scanCode({ uni.scanCode({
success: (res) => { success: (res) => {

View File

@ -4,6 +4,7 @@
id="home"> id="home">
<skeleton :show="showSkeleton" :isNodes="isNodes" ref="skeleton" loading="chiaroscuro" selector="skeleton" <skeleton :show="showSkeleton" :isNodes="isNodes" ref="skeleton" loading="chiaroscuro" selector="skeleton"
bgcolor="transparent"></skeleton> bgcolor="transparent"></skeleton>
<view v-if="!errorNetwork" <view v-if="!errorNetwork"
:style="{visibility: showSkeleton ? 'hidden' : 'visible', pointerEvents: preview ? 'none' : 'auto'}"> :style="{visibility: showSkeleton ? 'hidden' : 'visible', pointerEvents: preview ? 'none' : 'auto'}">
<view class="page-index skeleton" :class="{ bgf: navIndex > 0 }"> <view class="page-index skeleton" :class="{ bgf: navIndex > 0 }">
@ -399,6 +400,7 @@
import { import {
showTab showTab
} from "@/utils/showTab.js"; } from "@/utils/showTab.js";
import permission from '../../utils/permission';
export default { export default {
computed: configMap({ computed: configMap({
hide_mer_status: 0, hide_mer_status: 0,
@ -576,7 +578,7 @@
this.isScrolled = false this.isScrolled = false
} }
// scrollTopeasy-loadimage // scrollTopeasy-loadimage
uni.$emit('scroll'); uni.$emit('scroll', e);
if (e.scrollTop >= 100) { if (e.scrollTop >= 100) {
uni.setTabBarItem({ uni.setTabBarItem({
@ -625,7 +627,7 @@
let curRoute = routes[routes.length - 1].route // let curRoute = routes[routes.length - 1].route //
this.activeRouter = '/' + curRoute this.activeRouter = '/' + curRoute
}, },
onLoad(options) { async onLoad(options) {
let that = this let that = this
this._options = options; this._options = options;
this.diyId = options.diyId || 0; this.diyId = options.diyId || 0;
@ -642,6 +644,16 @@
}) })
that.pageLoad(options); that.pageLoad(options);
this.$store.dispatch('INIT_CONFIG'); this.$store.dispatch('INIT_CONFIG');
// let result = await this.$store.dispatch("permission/requestPermissions",
// 'ACCESS_FINE_LOCATION')
// console.log(result)
// permission.gotoAppSetting();
}, },
onShow() { onShow() {
@ -662,6 +674,7 @@
that.isScrolled = res[0].top <= -60 that.isScrolled = res[0].top <= -60
}) })
}) })
this.isIndexClick = false; this.isIndexClick = false;
if (this.isLogin) { if (this.isLogin) {

View File

@ -2,8 +2,8 @@
<view> <view>
<view class='newsList'> <view class='newsList'>
<view class='swiper' v-if="imgUrls.length > 0" style="background-color: #fff;"> <view class='swiper' v-if="imgUrls.length > 0" style="background-color: #fff;">
<swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration" <swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval"
indicator-color="rgba(102,102,102,0.3)" indicator-active-color="#666"> :duration="duration" indicator-color="rgba(102,102,102,0.3)" indicator-active-color="#666">
<block v-for="(item,index) in imgUrls" :key="index"> <block v-for="(item,index) in imgUrls" :key="index">
<swiper-item> <swiper-item>
<navigator :url="'/pages/news_details/index?id='+item.id"> <navigator :url="'/pages/news_details/index?id='+item.id">
@ -13,10 +13,13 @@
</block> </block>
</swiper> </swiper>
</view> </view>
<view class='nav' v-if="navList.length > 0" style="background-color: #fff;margin-top: 0;padding-top: 30rpx;"> <view class='nav' v-if="navList.length > 0"
<scroll-view class="scroll-view_x" scroll-x scroll-with-animation :scroll-left="scrollLeft" style="width:auto;overflow:hidden;"> style="background-color: #fff;margin-top: 0;padding-top: 30rpx;">
<scroll-view class="scroll-view_x" scroll-x scroll-with-animation :scroll-left="scrollLeft"
style="width:auto;overflow:hidden;">
<block v-for="(item,index) in navList" :key="index"> <block v-for="(item,index) in navList" :key="index">
<view class='item' :class='active==item.article_category_id?"on":""' @click='tabSelect(item.article_category_id)'> <view class='item' :class='active==item.article_category_id?"on":""'
@click='tabSelect(item.article_category_id)'>
<view>{{item.title}}</view> <view>{{item.title}}</view>
<view class='line bg-color' v-if="active==item.article_category_id"></view> <view class='line bg-color' v-if="active==item.article_category_id"></view>
</view> </view>
@ -25,24 +28,29 @@
</view> </view>
<view class='list'> <view class='list'>
<block v-for="(item,index) in articleList" :key="index"> <block v-for="(item,index) in articleList" :key="index">
<navigator :url='"/pages/news_details/index?id="+item.article_id' hover-class='none' class='item acea-row row-between-wrapper my-card' <navigator :url='"/pages/news_details/index?id="+item.article_id' hover-class='none'
:class="{'my-card0': index==0}"> class='item acea-row row-between-wrapper my-card' :class="{'my-card0': index==0}">
<block v-if="index==0"> <block v-if="index==0">
<image lazy-load style="width: 100%;height: 100%;" :src='item.image_input' mode="aspectFill"></image> <image lazy-load style="width: 100%;height: 100%;" :src='item.image_input'
<view class="bottom-text"> mode="aspectFill"></image>
<view class='name line2'>{{item.title}}</view> <view class="bottom-text">
<view style="color: #C4C4C4;font-size: 24rpx;padding-top: 10rpx;">{{URLdate(item.create_time)}}</view> <view class='name line2'>{{item.title}}</view>
</view> <view style="color: #C4C4C4;font-size: 24rpx;padding-top: 10rpx;">
</block> {{URLdate(item.create_time)}}
</view>
</view>
</block>
<block v-else> <block v-else>
<view class='text acea-row row-column-between' style="height: 100%;width: 550rpx;"> <view class='text'
<view class='name line2'>{{item.title}}</view> style="height: 100%;width: 550rpx;display: flex;flex-direction: column;justify-content: space-between;">
<view>{{URLdate(item.create_time)}}</view> <view class='name line2'>{{item.title}}</view>
</view> <view>{{URLdate(item.create_time)}}</view>
<view class='pictrue'> </view>
<image lazy-load style="width: 100%;height: 100%;" :src='item.image_input' mode="aspectFill"></image> <view class='pictrue'>
</view> <image lazy-load style="width: 100%;height: 100%;" :src='item.image_input'
</block> mode="aspectFill"></image>
</view>
</block>
</navigator> </navigator>
</block> </block>
</view> </view>
@ -53,7 +61,6 @@
<view class="txt">暂无新闻信息~</view> <view class="txt">暂无新闻信息~</view>
</view> </view>
</view> </view>
<!-- <home></home> -->
</view> </view>
</template> </template>
@ -103,14 +110,13 @@
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onLoad: function(options) { onLoad: function(options) {
this.status = false; this.status = false;
this.page = 1; this.page = 1;
this.articleList = []; this.articleList = [];
if(options.type) { if (options.type) {
this.active=options.type; this.active = options.type;
this.getCidArticle(); this.getCidArticle();
} } else this.getArticleCate();
else this.getArticleCate();
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
@ -169,19 +175,19 @@
this.getCidArticle(); this.getCidArticle();
} }
}, },
URLdate(date){ URLdate(date) {
// Date // Date
const currentDate = new Date(date); const currentDate = new Date(date);
// //
const year = currentDate.getFullYear(); const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 01 const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 01
const day = String(currentDate.getDate()).padStart(2, '0'); const day = String(currentDate.getDate()).padStart(2, '0');
// xxxxxxxx // xxxxxxxx
const formattedDate = `${year}${month}${day}`; const formattedDate = `${year}${month}${day}`;
return formattedDate; return formattedDate;
} }
} }
} }
</script> </script>
@ -190,22 +196,26 @@
page { page {
background-color: #f8f9fa !important; background-color: #f8f9fa !important;
} }
.newsList .swiper { .newsList .swiper {
width: 100%; width: 100%;
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
padding: 0 30rpx; padding: 0 30rpx;
} }
.newsList .swiper swiper { .newsList .swiper swiper {
width: 100%; width: 100%;
height: 365rpx; height: 365rpx;
position: relative; position: relative;
} }
.newsList .swiper .slide-image { .newsList .swiper .slide-image {
width: 100%; width: 100%;
height: 335rpx; height: 335rpx;
border-radius: 6rpx; border-radius: 6rpx;
} }
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
.newsList .swiper .wx-swiper-dot { .newsList .swiper .wx-swiper-dot {
width: 12rpx !important; width: 12rpx !important;
@ -214,9 +224,11 @@
transform: rotate(-45deg); transform: rotate(-45deg);
transform-origin: 0 100%; transform-origin: 0 100%;
} }
.newsList .swiper .wx-swiper-dot~.wx-swiper-dot { .newsList .swiper .wx-swiper-dot~.wx-swiper-dot {
margin-left: 5rpx; margin-left: 5rpx;
} }
.newsList .swiper .wx-swiper-dots.wx-swiper-dots-horizontal { .newsList .swiper .wx-swiper-dots.wx-swiper-dots-horizontal {
margin-bottom: -15rpx; margin-bottom: -15rpx;
} }
@ -230,12 +242,15 @@
transform: rotate(-45deg); transform: rotate(-45deg);
transform-origin: 0 100%; transform-origin: 0 100%;
} }
.newsList .swiper .uni-swiper-dot~.uni-swiper-dot { .newsList .swiper .uni-swiper-dot~.uni-swiper-dot {
margin-left: 5rpx; margin-left: 5rpx;
} }
.newsList .swiper .uni-swiper-dots.uni-swiper-dots-horizontal { .newsList .swiper .uni-swiper-dots.uni-swiper-dots-horizontal {
margin-bottom: -15rpx; margin-bottom: -15rpx;
} }
// #endif // #endif
.newsList .nav { .newsList .nav {
padding: 0 30rpx; padding: 0 30rpx;
@ -244,6 +259,7 @@
box-sizing: border-box; box-sizing: border-box;
margin-top: 43rpx; margin-top: 43rpx;
} }
.newsList .nav .item { .newsList .nav .item {
display: inline-block; display: inline-block;
font-size: 32rpx; font-size: 32rpx;
@ -256,12 +272,15 @@
padding-bottom: 20rpx; padding-bottom: 20rpx;
text-align: center; text-align: center;
} }
.newsList .nav .item.on { .newsList .nav .item.on {
color: #282828; color: #282828;
} }
.newsList .nav .item~.item { .newsList .nav .item~.item {
margin-left: 46rpx; margin-left: 46rpx;
} }
.newsList .nav .item .line { .newsList .nav .item .line {
width: 24rpx; width: 24rpx;
height: 4rpx; height: 4rpx;
@ -272,93 +291,110 @@
left: 50%; left: 50%;
margin-left: -12rpx; margin-left: -12rpx;
} }
.newsList .list .item { .newsList .list .item {
margin: 0 30rpx; margin: 0 30rpx;
border-bottom: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
padding: 35rpx 0; padding: 35rpx 0;
} }
.newsList .list .item .pictrue { .newsList .list .item .pictrue {
width: 250rpx; width: 250rpx;
height: 156rpx; height: 156rpx;
} }
.newsList .list .item .pictrue image { .newsList .list .item .pictrue image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 6rpx; border-radius: 6rpx;
} }
.newsList .list .item .text { .newsList .list .item .text {
width: 420rpx; width: 420rpx;
height: 160rpx; height: 160rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }
.newsList .list .item .text .name { .newsList .list .item .text .name {
font-size: 30rpx; font-size: 30rpx;
color: #282828; color: #282828;
} }
.newsList .list .item .picList .pictrue { .newsList .list .item .picList .pictrue {
width: 335rpx; width: 335rpx;
height: 210rpx; height: 210rpx;
margin-top: 30rpx; margin-top: 30rpx;
} }
.newsList .list .item .picList.on .pictrue { .newsList .list .item .picList.on .pictrue {
width: 217rpx; width: 217rpx;
height: 136rpx; height: 136rpx;
} }
.newsList .list .item .picList .pictrue image { .newsList .list .item .picList .pictrue image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 6rpx; border-radius: 6rpx;
} }
.newsList .list .item .time { .newsList .list .item .time {
text-align: right; text-align: right;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
margin-top: 22rpx; margin-top: 22rpx;
} }
.noCommodity{
.noCommodity {
border: none; border: none;
} }
.empty-box{
.empty-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-top: 200rpx; margin-top: 200rpx;
image{
image {
width: 414rpx; width: 414rpx;
height: 240rpx; height: 240rpx;
} }
.txt{
.txt {
font-size: 26rpx; font-size: 26rpx;
color: #999; color: #999;
text-align: center; text-align: center;
} }
} }
.my-card{
background-color: #fff !important; .my-card {
margin: 20rpx !important; background-color: #fff !important;
padding: 20rpx !important; margin: 20rpx !important;
border-radius: 20rpx !important; padding: 20rpx !important;
overflow: hidden; border-radius: 20rpx !important;
height: 160rpx !important; overflow: hidden;
.pictrue{ height: 160rpx !important;
height: 116rpx !important;
width: 116rpx !important; .pictrue {
} height: 116rpx !important;
} width: 116rpx !important;
.my-card0{ }
padding: 0 !important; }
height: 478rpx !important;
position: relative; .my-card0 {
.bottom-text{ padding: 0 !important;
position: absolute; height: 478rpx !important;
bottom: 0; position: relative;
left: 0;
width: 100%; .bottom-text {
color: #fff; position: absolute;
background-color: rgba(0, 0, 0, 0.3); bottom: 0;
padding: 20rpx; left: 0;
} width: 100%;
} color: #fff;
background-color: rgba(0, 0, 0, 0.3);
padding: 20rpx;
}
}
</style> </style>

View File

@ -91,7 +91,7 @@
<view class="line1" style="max-width: 260rpx;"> <view class="line1" style="max-width: 260rpx;">
<text class="money-price">{{goods.productAttr.price}}</text> <text class="money-price">{{goods.productAttr.price}}</text>
<text <text
class="money-unit">/{{goods.productAttr.sku || goods.product.unit_name}}</text> class="money-unit">/{{goods.product.unit_name || goods.product.unit_name}}</text>
</view> </view>
</view> </view>
</view> </view>

View File

@ -516,6 +516,8 @@
}, },
watch: { watch: {
tabActive: function(value, old) { tabActive: function(value, old) {
if (!value || !old) return;
switch (value) { switch (value) {
case 1: case 1:
if (this.goods.length == 0 && this.isCoupon == 0) { if (this.goods.length == 0 && this.isCoupon == 0) {
@ -605,7 +607,8 @@
this.getMerClassifly(); this.getMerClassifly();
// //
this.getCart(); if (this.isLogin)
this.getCart();
}, },
/** /**

View File

@ -197,18 +197,21 @@
电话认证 电话认证
</view> </view>
<view class="card-cont"> <view class="card-cont">
<view class="card-cont-li"> <view class="card-cont-li" style="justify-content: flex-start;">
联系电话 {{formData.phone}} <text style="margin-right: 30rpx;width:120rpx;">联系电话</text>
<text>{{formData.phone}}</text>
</view> </view>
<u-line style="margin: 28rpx 0;"></u-line> <u-line style="margin: 28rpx 0;"></u-line>
<view class="card-cont-li"> <view class="card-cont-li">
<view class="" style="flex: 4;display: flex;align-items: center;"> <view class="" style="flex: 4;display: flex;align-items: center;">
验证码 <u--input style="margin-left: 40rpx;" border="none" v-model="formData.code"> <text
style="text-align-last: justify;width:108rpx;margin-right:40rpx;">验证码</text>
<u--input border="none" v-model="formData.code" placeholder="请输入验证码">
</u--input> </u--input>
</view> </view>
<view class="" style="flex: 1;"> <view class="" style="flex: 1;">
<u-button @click="handleVerify" type="success" shape="circle" :plain="true" <u-button @click="handleVerify" type="success" shape="circle" :plain="true"
:text="text"></u-button> :text="text" style="height: 60rpx;"></u-button>
</view> </view>
</view> </view>
</view> </view>
@ -258,7 +261,7 @@
<text style="color: #35BD3E;" @click="getConfig">入驻协议</text> <text style="color: #35BD3E;" @click="getConfig">入驻协议</text>
</view> </view>
<view class="submit-btn" v-if='step!=3'> <view class="submit-btn" v-if='step!=3'>
<u-button text="添加店铺" @click="submit" shape='circle' <u-button :text="step==1?'添加店铺':'资质认证'" @click="submit" shape='circle'
color=" linear-gradient( 132deg, #38BE41 0%, #20B128 100%)"></u-button> color=" linear-gradient( 132deg, #38BE41 0%, #20B128 100%)"></u-button>
</view> </view>

View File

@ -8,6 +8,7 @@
<image src="@/static/images/logo1.png" /> <image src="@/static/images/logo1.png" />
</view> </view>
</view> </view>
<view class="" style="margin-top: 10rpx;" v-if='formItem==2'> <view class="" style="margin-top: 10rpx;" v-if='formItem==2'>
<view style="text-align: center;font-size: 36rpx;color: #20B128;font-weight: 700;"> <view style="text-align: center;font-size: 36rpx;color: #20B128;font-weight: 700;">
重置密码 重置密码
@ -16,6 +17,7 @@
请输入手机号码和验证码找回密码重置 请输入手机号码和验证码找回密码重置
</view> </view>
</view> </view>
<view class="whiteBg" v-if="formItem == 0"> <view class="whiteBg" v-if="formItem == 0">
<view class="logon" style="display: flex;align-items: center;justify-content: center;" <view class="logon" style="display: flex;align-items: center;justify-content: center;"
@click="wxLogin"> @click="wxLogin">
@ -31,6 +33,7 @@
</checkbox-group> </checkbox-group>
</view> </view>
</view> </view>
<view class="whiteBg" v-else-if="formItem === 1"> <view class="whiteBg" v-else-if="formItem === 1">
<view class="title acea-row row-center-wrapper"> <view class="title acea-row row-center-wrapper">
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" <view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
@ -165,7 +168,7 @@
</checkbox-group> </checkbox-group>
</view> </view>
</view> </view>
<view class="footer-btn" v-if="formItem==2"> <view class="footer-btn" v-if="formItem==2 && isInstallWx">
<view class="login-type-btn" :class="{actLoginType:formItem==0}" style="margin-right: 70rpx;"> <view class="login-type-btn" :class="{actLoginType:formItem==0}" style="margin-right: 70rpx;">
<text v-if='formItem == 1||formItem==2' @click="formItem = 0">微信快捷登录</text> <text v-if='formItem == 1||formItem==2' @click="formItem = 0">微信快捷登录</text>
<text v-else @click="appOneClcik">本机一键登录</text> <text v-else @click="appOneClcik">本机一键登录</text>
@ -176,6 +179,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="bottom"></view> <view class="bottom"></view>
<view class="settlementAgreement" v-if="showAgreement"> <view class="settlementAgreement" v-if="showAgreement">
<view class="setAgCount"> <view class="setAgCount">
@ -188,7 +192,7 @@
</view> </view>
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<view class="footer-btns" v-if="formItem !=2"> <view class="footer-btns" v-if="formItem !=2 && isInstallWx">
<view class="login-type-btn" :class="{actLoginType:formItem==0}" style="margin-right: 70rpx;"> <view class="login-type-btn" :class="{actLoginType:formItem==0}" style="margin-right: 70rpx;">
<text v-if='formItem == 1||formItem==2' @click="formItem = 0">微信快捷登录</text> <text v-if='formItem == 1||formItem==2' @click="formItem = 0">微信快捷登录</text>
<text v-else @click="appOneClcik">本机一键登录</text> <text v-else @click="appOneClcik">本机一键登录</text>
@ -198,6 +202,12 @@
<text v-else @click="appOneClcik">本机一键登录</text> <text v-else @click="appOneClcik">本机一键登录</text>
</view> </view>
</view> </view>
<view class="footer-btns" v-if="!isInstallWx">
<view class="login-type-btn actLoginType" style="margin: 0 auto;">
<text @click="appOneClcik">{{formItem == 2?'更多登录方式':'本机一键登录'}}</text>
</view>
</view>
<!-- #endif --> <!-- #endif -->
</view> </view>
<form report-submit='true' v-if="auth_token"> <form report-submit='true' v-if="auth_token">
@ -240,6 +250,7 @@
</form> </form>
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }" <Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }"
ref="verify"></Verify> ref="verify"></Verify>
<!-- tips弹窗 --> <!-- tips弹窗 -->
<u-overlay :show="showTips"> <u-overlay :show="showTips">
<view class="tips"> <view class="tips">
@ -286,8 +297,6 @@
</view> </view>
</u-overlay> </u-overlay>
<!-- tips结束 --> <!-- tips结束 -->
</view> </view>
</template> </template>
<script> <script>
@ -405,7 +414,8 @@
keyLock: true, keyLock: true,
auth_token: '', auth_token: '',
codeVal: '', codeVal: '',
copyright: {} copyright: {},
isInstallWx: true
}; };
}, },
computed: configMap(['login_logo'], mapGetters(['viewColor'])), computed: configMap(['login_logo'], mapGetters(['viewColor'])),
@ -431,9 +441,25 @@
}); });
this.getVersion(); this.getVersion();
}, },
mounted: function() {
onShow() {
// #ifdef APP
//
if (plus.runtime.isApplicationExist({
pname: 'com.tencent.mm',
action: 'weixin://'
})) {
//
this.isInstallWx = true;
this.formItem = 0;
} else {
//
this.isInstallWx = false;
this.formItem = 1;
}
// #endif
}, },
onReady() { onReady() {
let that = this let that = this
// #ifdef MP // #ifdef MP
@ -1358,6 +1384,9 @@
}, },
// app // app
appOneClcik() { appOneClcik() {
if (this.formItem == 2) return this.formItem = 1;
let that = this let that = this
uni.preLogin({ uni.preLogin({
provider: 'univerify', provider: 'univerify',
@ -1382,22 +1411,9 @@
title: '登录失败,请稍后再试' title: '登录失败,请稍后再试'
}); });
}) })
// uniCloud.callFunction({
// name: 'oneClickLoginFn',
// data: {
// 'access_token': res.authResult
// .access_token,
// 'openid': res.authResult.openid
// }
// }).then(res => {
// console.log(res, 'res')
// }).catch(err => {
// console.log(err, 'ererre')
// })
}, },
fail(res) { // fail(res) { //
console.log(res.errCode) uni.closeAuthView()
console.log(res.errMsg)
} }
}) })
}, },

View File

@ -346,7 +346,7 @@
</image> </image>
</view> </view>
<view class='text acea-row row-between'> <view class='text acea-row row-between'>
<view class='name '> <view class='name'>
<view class='name line2' style="margin-bottom:12rpx;"> <view class='name line2' style="margin-bottom:12rpx;">
<text v-if="goods.product_type != 0 && goods.product_type != 10" <text v-if="goods.product_type != 0 && goods.product_type != 10"
:class="'font_bg-red type'+goods.product_type">{{goods.product_type == 1 ? "秒杀" : goods.product_type == 2 ? "预售" : goods.product_type == 3 ? "助力" : goods.product_type == 4 ? "拼团" : ""}}</text> :class="'font_bg-red type'+goods.product_type">{{goods.product_type == 1 ? "秒杀" : goods.product_type == 2 ? "预售" : goods.product_type == 3 ? "助力" : goods.product_type == 4 ? "拼团" : ""}}</text>
@ -355,10 +355,15 @@
<text <text
style="font-size: 22rpx;background-color: #ecfaed;color: #40ae36;border-radius: 40rpx;padding: 5rpx 10rpx;"> style="font-size: 22rpx;background-color: #ecfaed;color: #40ae36;border-radius: 40rpx;padding: 5rpx 10rpx;">
{{(item.merchant && item.merchant.cloud_warehouse) || ''}}</text> {{(item.merchant && item.merchant.cloud_warehouse) || ''}}</text>
<view style="margin-top: 10rpx;" class="t-color"> <view style="margin-top: 10rpx;" class="t-color">
{{goods.is_refund==1?'退款中':goods.is_refund==2?'部分退款':goods.is_refund==3?'全部退款':''}} {{goods.is_refund==1?'退款中':goods.is_refund==2?'部分退款':goods.is_refund==3?'全部退款':''}}
</view> </view>
<view>
{{goods.cart_info.productAttr.sku}}
</view>
</view> </view>
<view class='money' v-if="item.activity_type == 3"> <view class='money' v-if="item.activity_type == 3">
<view v-if="goods.cart_info.productAssistAttr"> <view v-if="goods.cart_info.productAssistAttr">
{{goods.cart_info.productAssistAttr.assist_price}}</view> {{goods.cart_info.productAssistAttr.assist_price}}</view>

View File

@ -66,12 +66,11 @@
} }
</style> </style>
<template> <template>
<view :style="viewColor"> <view :style="viewColor" style="position: relative;z-index: 1000000;background-color: #fff;">
<form @submit="formSubmit" report-submit='true'> <form @submit="formSubmit" report-submit='true'>
<view class='addAddress'> <view class='addAddress'>
<view class='list'> <view class='list'>
<view v-if="userAddress && userAddress.detail != ''" class="sel_addr_update-wrap">
<view v-if="userAddress.detail != ''" class="sel_addr_update-wrap">
<view class="sel_addr_update"> <view class="sel_addr_update">
<view class="sel_addr_wrap-l"> <view class="sel_addr_wrap-l">
<view class="sel_addr_wrap-l-addr line1">{{userAddress.detail}}</view> <view class="sel_addr_wrap-l-addr line1">{{userAddress.detail}}</view>
@ -170,6 +169,10 @@
getGeocoder getGeocoder
} from '@/api/store.js'; } from '@/api/store.js';
import authorize from '@/components/Authorize'; import authorize from '@/components/Authorize';
import permission from '@/utils/permission';
import {
AUTH_EXPIRE_TIME
} from "@/config/app.js"
export default { export default {
components: { components: {
areaWindow, areaWindow,
@ -205,7 +208,7 @@
longitude: '', longitude: '',
detail: '', //15 detail: '', //15
location: '', // location: '', //
timer: null
}; };
}, },
computed: { computed: {
@ -233,11 +236,18 @@
this.isShowAuth = true this.isShowAuth = true
} }
}, },
onShow() {
// if (this.timer) clearInterval(this.timer);
// this.timer = setInterval(() => {
// console.log(new Date().getSeconds())
// }, 1000)
},
methods: { methods: {
// //
handleToChoose() { async handleToChoose() {
let that = this; let that = this;
// #ifdef H5 // #ifdef H5
uni.navigateTo({ uni.navigateTo({
url: "/pages/select_address_n/select_address_n", url: "/pages/select_address_n/select_address_n",
@ -251,15 +261,78 @@
} }
}) })
// #endif // #endif
// #ifndef H5 // #ifndef H5
let result = await that.$store.dispatch("permission/requestPermissions", 'ACCESS_FINE_LOCATION');
console.log('权限状态:' + result);
if (result != -1) {
console.log('允许设置...');
uni.removeStorageSync('expireTime');
const isOpen = permission.isOpenGps();
if (isOpen) {
that.getLocation();
} else {
uni.showModal({
title: '提示',
content: '您未开启GPS定位可能导致不能获取准确定位是否继续',
confirmText: "继续",
success: (res) => {
if (res.confirm) {
that.getLocation();
}
}
})
}
} else {
const expireTime = uni.getStorageSync('expireTime');
console.log('过期时间:' + expireTime);
if (expireTime) {
if ((expireTime + AUTH_EXPIRE_TIME) < +new Date()) {
console.log('时间过期了....')
uni.removeStorageSync('expireTime');
uni.showModal({
title: '提示',
content: '操作权限已被拒绝,请手动前往设置',
confirmText: "立即设置",
success: (res) => {
if (res.confirm) {
permission.gotoAppSetting();
} else {
//
console.log('重置过期时间');
uni.setStorageSync('expireTime', +new Date());
}
}
})
} else {
console.log('时间还没过期....');
}
} else {
//
uni.setStorageSync('expireTime', +new Date());
}
}
// #endif
},
//
getLocation() {
let that = this;
uni.chooseLocation({ uni.chooseLocation({
success: function(res) { success: function(res) {
that.userAddress.detail = res.name that.userAddress.detail =
that.userAddress.address_detail = res.address; res.name
that.location = `${res.latitude},${res.longitude}`;; that.userAddress
.address_detail = res
.address;
that.location =
`${res.latitude},${res.longitude}`;;
},
fail(err) {
console.log(err);
} }
}); });
// #endif
}, },
OnChangeAddress(address) { OnChangeAddress(address) {

View File

@ -1,207 +1,202 @@
<template> <template>
<view class="wholeSale"> <view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
<!-- 顶部 --> <!-- 顶部 -->
<view class="wholeSale-header"> <view class="wholeSale-header">
<view class="wholeSale-header-wrap"> <!-- 适配不同机 -->
<!-- 适配不同机 --> <view style="height: var(--status-bar-height);"></view>
<view style="height: var(--status-bar-height);"></view>
<!-- 滚动tab --> <!-- 滚动tab -->
<scroll-view scroll-x="true" :scroll-top="100" :show-scrollbar="false" scroll-into-view="a1"> <scroll-view scroll-x="true" :scroll-top="100" :show-scrollbar="false" scroll-into-view="a1">
<view class="scrollview"> <view class="scrollview">
<block v-for="(item,indx) in tabsArr" :key="indx"> <block v-for="(item,indx) in tabsArr" :key="indx">
<view class="scrollview-item" :id="'a' + indx" <view class="scrollview-item" :id="'a' + indx"
:class="{'scrollview-active':tabsCurr == item.val}" @click="tabsChange(item.val)"> :class="{'scrollview-active':tabsCurr == item.val}" @click="tabsChange(item.val)">
{{item.name}} {{item.name}}
</view>
</block>
</view>
</scroll-view>
</view>
<!-- 占位 -->
<view :style="{height:'calc(' + wrapHeight + 'rpx + 108rpx + var(--status-bar-height))'}"></view>
<view class="wholeSale-header-search-wrap" :style="{height:wrapHeight + 'rpx'}">
<u-subsection v-if="tabsCurr==2" :list="subList" @change="changeSub" :current="subCurr" mode="subsection"
activeColor="#40ae36" fontSize="14" style="margin-top: 20rpx;"></u-subsection>
<view class="wholeSale-nav">
<view
@click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}&shop=${subCurr!=1 || (subCurr==1 && tabsCurr!=2) ? false : true}`)"
hover-class="none" class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text"
:placeholder="subCurr!=1 || (subCurr==1 && tabsCurr!=2) ? '搜索您需要批发进货的产品名称': '搜索店铺名称'"
:value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;" disabled
style="pointer-events: none;">
</view>
</view>
</view>
<!-- 商品大分类 -->
<view class="category">
<scroll-view scroll-x="true" :scroll-into-view="scrollIndex">
<view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :id="'scroll' + index"
:class="{'category-item-active': index==cate_change}" @click="changeCate(index)">
<block v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</block>
<block v-else>
<u--image class="category-item-img" width="108rpx" :src="item.background"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.category_name}}</text>
</block>
</view>
</block>
</view>
</scroll-view>
<view class="category-all" v-if="store_category.length > 0" @click="onAllCategory">
<view style="margin-bottom: 20rpx;">全部</view>
<u-icon name="list"></u-icon>
</view>
</view>
<!-- 商品小分类 -->
<view class="cate" v-if="store_category_children.length>1">
<scroll-view scroll-x="true">
<view class="cate-wrap">
<block v-for="(item,index) in store_category_children" :key="index">
<view class="cate-item" :class="{'cate-item-active':index == cate_change_children}"
@click="changeChildrenCate(index)">
<text>{{item.cate_name}}</text>
</view> </view>
</block> </block>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="wholeSale-header-search-wrap" :style="{height:wrapHeight + 'rpx'}"> <!-- 综合查询 -->
<u-subsection v-if="tabsCurr==2" :list="subList" @change="changeSub" :current="subCurr" <view class="comprehensive" v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
mode="subsection" activeColor="#40ae36" fontSize="14" style="margin-bottom: 24rpx;"></u-subsection> <view class="comprehensive-price" :class="{'comp-color': orderCurr==1}" @click="toOrder('price', 1)">
<text>价格</text>
<view class="wholeSale-nav"> <image v-if="orderCurr==1" style="width: 15rpx;height: 21rpx;"
<view :src="where.order == 'price_asc' ? domain+'/static/diy/up'+keyColor+'.png' : domain+'/static/diy/down'+keyColor+'.png'">
@click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}&shop=${subCurr!=1 || (subCurr==1 && tabsCurr!=2) ? false : true}`)" </image>
hover-class="none" class="search_content flex_a_c_j_sb"> <view v-else style="width: 15rpx;height: 21rpx;"></view>
<view class="flex_a_c search_content_wrap"> </view>
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view> <view class="comprehensive-sales_num" :class="{'comp-color': orderCurr==2}"
<input type="text" @click="toOrder('sales', 2)">
:placeholder="subCurr!=1 || (subCurr==1 && tabsCurr!=2) ? '搜索您需要批发进货的产品名称': '搜索店铺名称'" <text>销量</text>
:value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;" disabled </view>
style="pointer-events: none;"> <view class="comprehensive-discount" :class="{'comp-color': orderCurr==3}" v-if="tabsCurr!=1"
</view> @click="toOrder('', 3)">
</view> <text>综合</text>
</view> </view>
<!-- 商品大分类 --> <view class="comprehensive-discount" v-else @click="onChangeDeductionRate">
<view class="category"> <text>抵扣</text>
<scroll-view scroll-x="true"> <image class="loudou" src="@/static/new_define/loudou.png"></image>
<view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<block v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
<u--image class="category-item-img" width="108rpx" :src="item.pic"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</block>
<block v-else>
<u--image class="category-item-img" width="108rpx" :src="item.background"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.category_name}}</text>
</block>
</view>
</block>
</view>
</scroll-view>
<view class="category-all" v-if="store_category.length > 0" @click="onAllCategory">
<view style="margin-bottom: 20rpx;">全部</view>
<u-icon name="list"></u-icon>
</view>
</view> </view>
</view>
<!-- 商品小分类 --> <!-- 综合查询 -->
<view class="cate" v-if="store_category_children.length>1"> <view class="comprehensive" v-if="deduction_rate && tabsCurr==1">
<scroll-view scroll-x="true"> <view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate==''}"
<view class="cate-wrap"> @click="changeDeduction('')">
<block v-for="(item,index) in store_category_children" :key="index"> <text>全部</text>
<view class="cate-item" :class="{'cate-item-active':index == cate_change_children}"
@click="changeChildrenCate(index)">
<text>{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
</view> </view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='10'}"
<!-- 综合查询 --> @click="changeDeduction('10')">
<view class="comprehensive" v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)"> <text>1:9</text>
<view class="comprehensive-price" :class="{'comp-color': orderCurr==1}"
@click="toOrder('price', 1)">
<text>价格</text>
<image v-if="orderCurr==1" style="width: 15rpx;height: 21rpx;"
:src="where.order == 'price_asc' ? domain+'/static/diy/up'+keyColor+'.png' : domain+'/static/diy/down'+keyColor+'.png'">
</image>
<view v-else style="width: 15rpx;height: 21rpx;"></view>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': orderCurr==2}"
@click="toOrder('sales', 2)">
<text>销量</text>
</view>
<view class="comprehensive-discount" :class="{'comp-color': orderCurr==3}" v-if="tabsCurr!=1"
@click="toOrder('', 3)">
<text>综合</text>
</view>
<view class="comprehensive-discount" v-else @click="deduction_rate=!deduction_rate;">
<text>抵扣</text>
<image class="loudou" src="@/static/new_define/loudou.png"></image>
</view>
</view> </view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='15'}"
<!-- 综合查询 --> @click="changeDeduction('15')">
<view class="comprehensive" v-if="deduction_rate && tabsCurr==1"> <text>2:8</text>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate==''}" </view>
@click="changeDeduction('')"> <view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='20'}"
<text>全部</text> @click="changeDeduction('20')">
</view> <text>3:7</text>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='10'}" </view>
@click="changeDeduction('10')"> <view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='25'}"
<text>1:9</text> @click="changeDeduction('25')">
</view> <text>4:6</text>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='15'}"
@click="changeDeduction('15')">
<text>2:8</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='20'}"
@click="changeDeduction('20')">
<text>3:7</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='25'}"
@click="changeDeduction('25')">
<text>4:6</text>
</view>
</view> </view>
</view> </view>
</view> </view>
<!-- 内容 --> <!-- 内容 -->
<view class="wholeSale-con" <view class="wholeSale-con">
:style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx '+(isShowSmall?' - 48rpx':'')+')'}"> <!-- 流水瀑布 -->
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;" <WaterfallsFlow v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)" :wfList='hostProduct' @itemTap="goDetail"
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling" :type="0" :sale_type="2" />
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'>
<!-- 流水瀑布 -->
<WaterfallsFlow v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)" :wfList='hostProduct'
@itemTap="goDetail" :type="0" :sale_type="2" />
<!-- 列表 --> <!-- 列表 -->
<view class="goods_list" v-else> <view class="goods_list" v-else>
<view class="goods" v-for="(item, index) in shopList" :key="index" @click="goStore(item.mer_id)"> <view class="goods" v-for="(item, index) in shopList" :key="index" @click="goStore(item.mer_id)">
<view class="avatar"> <view class="avatar">
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill"> <u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
<template v-slot:loading> <template v-slot:loading>
<u-loading-icon color="#999" size="15" /> <u-loading-icon color="#999" size="15" />
</template> </template>
</u--image> </u--image>
</view>
<view class="content">
<view class="content-head">
<view class="title">{{item.mer_name}}</view>
<text style="font-size: 21.03rpx;color: #aaa;"
v-if="item.sales>=100">月销{{item.sales}}</text>
</view> </view>
<view class="content"> <view class="content-two">
<view class="content-head"> <view class="score">
<view class="title">{{item.mer_name}}</view> <view class="star">
<text style="font-size: 21.03rpx;color: #aaa;" <view
v-if="item.sales>=100">月销{{item.sales}}</text> :style="{width: `${(item.service_score / 5 * 100).toFixed(0)}%`, backgroundImage: `url(${domain}/static/diy/score1${keyColor}.png)`}">
</view>
<view class="content-two">
<view class="score">
<view class="star">
<view
:style="{width: `${(item.service_score / 5 * 100).toFixed(0)}%`, backgroundImage: `url(${domain}/static/diy/score1${keyColor}.png)`}">
</view>
</view> </view>
</view> </view>
<text </view>
style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text> <text
<text v-if="item.distance" style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</text> <text v-if="item.distance"
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</text>
<text style="margin-left: 20rpx;" class="line1">{{item.category_name}}</text> <text style="margin-left: 20rpx;" class="line1">{{item.category_name}}</text>
</view> </view>
<view class="content-two"> <view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx" <u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image> height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text> <text> {{item.service_phone}}</text>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true" <u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true"
src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image> src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image>
<text <text v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text> </view>
</view> <view class="content-two">
<view class="content-two"> <u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx" height="33.85rpx"></u--image>
height="33.85rpx"></u--image> <text class="address">{{item.mer_address}}</text>
<text class="address">{{item.mer_address}}</text>
</view>
</view> </view>
</view> </view>
</view> </view>
</view>
<loadmore :type="isLoading" v-if="isLoading || hostProduct.length > 0" style="padding: 12rpx 0;"> <loadmore :type="isLoading" v-if="isLoading || hostProduct.length > 0" style="padding: 12rpx 0;">
</loadmore> </loadmore>
<view class='pictrue' v-if="!isLoading && hostProduct.length == 0"> <view class='pictrue' v-if="!isLoading && hostProduct.length == 0">
<image :src="`${domain}/static/images/noCart.png`"></image> <image :src="`${domain}/static/images/noCart.png`"></image>
<view>暂无商品看点别的吧</view> <view>暂无商品看点别的吧</view>
</view> </view>
</scroll-view>
</view> </view>
<!-- 弹框大分类 --> <!-- 弹框大分类 -->
@ -320,10 +315,9 @@
bigTypeDomInfo: null, bigTypeDomInfo: null,
smallTypeDomInfo: null, smallTypeDomInfo: null,
categoryWrapHeight: 0, categoryWrapHeight: 0,
wrapHeight: 332, wrapHeight: 360,
isShowSmall: false, touchstarty: 0,
scrollTop: 0, scrollIndex: ''
isTriggered: false
} }
}, },
computed: { computed: {
@ -366,54 +360,54 @@
index: 1, index: 1,
text: "批发", text: "批发",
selectedIconPath: "/static/tabbar_icon/b-a.png" selectedIconPath: "/static/tabbar_icon/b-a.png"
}) });
} }
}, },
watch: { // watch: {
'where.cate_pid'(newVal, oldVal) { // 'where.cate_pid'(newVal, oldVal) {
if (newVal && !oldVal) { // if (newVal && !oldVal) {
this.wrapHeight = this.tabsCurr == 2 ? 400 : (332 + 48); // this.isShowSmall = true;
this.isShowSmall = true; // }
} // if (!newVal && oldVal) {
if (!newVal && oldVal) { // this.isShowSmall = false;
this.wrapHeight = this.tabsCurr == 2 ? 400 : 332; // }
this.isShowSmall = false; // }
} // },
}
onPullDownRefresh() {
this.initData(true, true);
},
onReachBottom() {
this.initData(false, true);
}, },
methods: { methods: {
//
// onTouchStart(e) {
onPulling() { this.touchstarty = e.touches[0].clientY;
if (!this.isTriggered) {
this.isTriggered = true;
this.initData(true, true);
}
},
onRefresh(e) {
this.isTriggered = true;
}, },
onScrollBottom(e) { //
this.initData(false, true); onTouchMove(e) {
this.$nextTick(() => {
let deltaY = e.changedTouches[0].clientY - this.touchstarty;
if (deltaY <= 0) {
console.log("上滑")
this.wrapHeight = 0;
} else {
console.log('下滑');
this.getHeight();
}
this.$forceUpdate();
})
}, },
onAllCategory() { onAllCategory() {
this.$refs.popup.open(); this.$refs.popup.open();
}, },
onScroll(e) {
if (this.scrollTop >= e.target.scrollTop) { //
this.wrapHeight = this.tabsCurr == 2 ? 400 : 332;
if (this.where.cate_pid) this.wrapHeight = this.wrapHeight + 48;
} else {
this.wrapHeight = 0;
}
this.scrollTop = e.target.scrollTop;
},
initData(re = false, stop = false) { initData(re = false, stop = false) {
if (!stop) this.getStoreCategory(); if (!stop) this.getStoreCategory();
if (this.tabsCurr == 2 && this.subCurr == 1) this.storeMerchantList(re, stop); if (this.tabsCurr == 2 && this.subCurr == 1) this.storeMerchantList(re, stop);
@ -435,6 +429,7 @@
this.cate_change = 0; this.cate_change = 0;
this.cate_change_children = 0; this.cate_change_children = 0;
this.initData(true); this.initData(true);
this.getHeight()
}, },
toOrder(type, index = -1) { toOrder(type, index = -1) {
if (this.where.order == type) { if (this.where.order == type) {
@ -484,9 +479,58 @@
this.cate_change = 0; this.cate_change = 0;
this.cate_change_children = 0; this.cate_change_children = 0;
if (this.tabsCurr != 2 || (this.tabsCurr == 2 && this.subCurr != 1)) this.where.mer_type = e; if (this.tabsCurr != 2 || (this.tabsCurr == 2 && this.subCurr != 1)) this.where.mer_type = e;
this.wrapHeight = this.tabsCurr == 2 ? 400 : this.where.cate_pid ? (332 + 48) : 332;
this.getHeight();
this.initData(true); this.initData(true);
}, },
//
getHeight() {
console.log(this.store_category_children);
if (this.tabsCurr == 1) {
if (this.where.cate_pid) {
if (this.deduction_rate) {
this.wrapHeight = 460;
} else {
this.wrapHeight = 410;
}
} else {
if (this.deduction_rate) {
this.wrapHeight = 410;
} else {
this.wrapHeight = 360;
}
}
// if (this.store_category_children.length > 1 && this.deduction_rate) {
// this.wrapHeight = 460;
// } else if (this.store_category_children.length == 1 || !this.deduction_rate) {
// this.wrapHeight = 410;
// } else {
// if (this.cate_change || this.deduction_rate) {
// this.wrapHeight = 410;
// } else {
// this.wrapHeight = 360;
// }
// }
} else if (this.tabsCurr == 2) {
if (this.subCurr == 1) {
this.wrapHeight = 400;
} else {
this.wrapHeight = 440;
}
} else {
this.wrapHeight = 360;
}
},
onChangeDeductionRate() {
this.deduction_rate = !this.deduction_rate;
this.getHeight()
},
changeCate(e) { changeCate(e) {
this.cate_change = e; this.cate_change = e;
this.store_category_children = []; this.store_category_children = [];
@ -507,8 +551,14 @@
this.where.cate_pid = this.store_category[e].store_category_id; this.where.cate_pid = this.store_category[e].store_category_id;
this.where.cate_id = ""; this.where.cate_id = "";
} }
this.getProductslist(true); this.getProductslist(true);
this.getHeight();
// scrollView
this.scrollIndex = 'scroll' + e;
// popup // popup
this.$refs.popup && this.$refs.popup.close(); this.$refs.popup && this.$refs.popup.close();
}, },
@ -564,9 +614,9 @@
if (this.where.order) this.where.rand = 0; if (this.where.order) this.where.rand = 0;
else this.where.rand = 1; else this.where.rand = 1;
getProductslist(this.where, true).then(res => { getProductslist(this.where, true).then(res => {
uni.stopPullDownRefresh();
this.where.limit = res.data.limit this.where.limit = res.data.limit
this.where.page = res.data.page this.where.page = res.data.page
this.isTriggered = false;
if (reLoad) this.hostProduct = []; if (reLoad) this.hostProduct = [];
this.hostProduct = [...this.hostProduct, ...res.data.list]; this.hostProduct = [...this.hostProduct, ...res.data.list];
this.isLoading = 0; this.isLoading = 0;
@ -583,7 +633,6 @@
if (this.isLoading == -1) return; if (this.isLoading == -1) return;
this.isLoading = 1; this.isLoading = 1;
storeMerchantList(this.where).then(res => { storeMerchantList(this.where).then(res => {
this.isTriggered = false;
this.shopList = [...this.shopList, ...res.data.list]; this.shopList = [...this.shopList, ...res.data.list];
this.isLoading = 0; this.isLoading = 0;
if (res.data.list.length < this.where.limit) this.isLoading = -1; if (res.data.list.length < this.where.limit) this.isLoading = -1;
@ -627,23 +676,11 @@
.wholeSale { .wholeSale {
.wholeSale-header { .wholeSale-header {
position: sticky; position: fixed;
top: 0; top: 0;
z-index: 90; z-index: 90;
margin-bottom: 20rpx; background-color: #40AE36;
width: 100%;
.wholeSale-header-wrap {
background-color: #40AE36;
}
.wholeSale-header-search-wrap {
position: sticky;
top: calc(82rpx + var(--status-bar-height));
transition: height .5s;
overflow: hidden;
padding: 30rpx 20rpx 0;
background-color: #fff;
}
.scrollview { .scrollview {
display: flex; display: flex;
@ -678,43 +715,59 @@
} }
} }
.wholeSale-header-search-wrap {
position: fixed;
top: calc(98rpx + var(--status-bar-height));
z-index: 89;
width: 100%;
transition: height .5s;
overflow: hidden;
padding: 0rpx 20rpx;
background-color: #fff;
}
.wholeSale-con { .wholeSale-con {
position: relative;
z-index: index;
margin: 0 10px; margin: 0 10px;
} }
.search_content { .wholeSale-nav {
margin-bottom: 40rpx; padding: 20rpx 0;
height: 70rpx;
padding: 2px 2px 2px 21.05rpx;
border-radius: 80rpx;
background: #EDEFF2;
position: relative;
box-sizing: border-box;
.search_content_wrap { .search_content {
width: 100%; height: 70rpx;
padding: 2px 2px 2px 21.05rpx;
border-radius: 80rpx;
background: #EDEFF2;
position: relative;
box-sizing: border-box;
.icon-sousuo { .search_content_wrap {
font-size: 26.32rpx; width: 100%;
font-weight: bold;
color: #c8c7c6; .icon-sousuo {
margin-right: 17.54rpx; font-size: 26.32rpx;
font-weight: bold;
color: #c8c7c6;
margin-right: 17.54rpx;
}
input {
width: 80%;
}
} }
input { .search_btn {
width: 80%; width: 106rpx;
height: 60rpx;
line-height: 60rpx;
background: #40AE36;
border-radius: 100px;
font-size: 28rpx;
color: #fff;
} }
} }
.search_btn {
width: 106rpx;
height: 60rpx;
line-height: 60rpx;
background: #40AE36;
border-radius: 100px;
font-size: 28rpx;
color: #fff;
}
} }
.category { .category {
@ -774,23 +827,22 @@
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
height: 100%; height: 100%;
background-color: #f3f3f3;
z-index: 10; z-index: 10;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
font-size: 24rpx; font-size: 24rpx;
border-radius: 4rpx;
width: 70rpx; width: 70rpx;
color: #919191; color: #919191;
box-shadow: 0px 0px 60rpx #c5c5c5;
} }
} }
.cate { .cate {
width: 100%; width: 100%;
overflow: auto; overflow: auto;
margin-bottom: 30rpx; // margin-bottom: 30rpx;
.cate-wrap { .cate-wrap {
display: flex; display: flex;
@ -883,7 +935,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 20rpx 50rpx; padding: 10rpx 50rpx;
[class^=comprehensive-] { [class^=comprehensive-] {
display: flex; display: flex;

View File

@ -1,249 +1,249 @@
// 权限说明 // 权限说明
const state = { const state = {
WRITE_EXTERNAL_STORAGE: false, WRITE_EXTERNAL_STORAGE: false,
READ_EXTERNAL_STORAGE: false, READ_EXTERNAL_STORAGE: false,
CAMERA: false, CAMERA: false,
CALL_PHONE: false, CALL_PHONE: false,
ACCESS_FINE_LOCATION: false, ACCESS_FINE_LOCATION: false,
/* #ifdef APP-PLUS */ /* #ifdef APP-PLUS */
isIos: plus.os.name == "iOS", isIos: plus.os.name == "iOS",
/* #endif */ /* #endif */
mapping: { mapping: {
'WRITE_EXTERNAL_STORAGE': { 'WRITE_EXTERNAL_STORAGE': {
title: "存储空间/照片权限说明", title: "存储空间/照片权限说明",
content: "便于您使用该功能上传您的照片/图片/视频及用于更换头像、发布评论/分享、下载、与客服沟通等场景中读取和写入相册和文件内容。", content: "便于您使用该功能上传您的照片/图片/视频及用于更换头像、发布评论/分享、下载、与客服沟通等场景中读取和写入相册和文件内容。",
methods: 'SET_WRITE_EXTERNAL_STORAGE' methods: 'SET_WRITE_EXTERNAL_STORAGE'
}, },
'READ_EXTERNAL_STORAGE': { 'READ_EXTERNAL_STORAGE': {
title: "存储空间/照片权限说明", title: "存储空间/照片权限说明",
content: "便于您使用该功能上传您的照片/图片/视频及用于更换头像、发布评论/分享、下载、与客服沟通等场景中读取和写入相册和文件内容。", content: "便于您使用该功能上传您的照片/图片/视频及用于更换头像、发布评论/分享、下载、与客服沟通等场景中读取和写入相册和文件内容。",
methods: 'SET_READ_EXTERNAL_STORAGE' methods: 'SET_READ_EXTERNAL_STORAGE'
}, },
'CAMERA': { 'CAMERA': {
title: "相机/存储空间/照片权限说明", title: "相机/存储空间/照片权限说明",
content: "便于您使用该功能上传您的照片/图片/视频及用于更换头像、发布评论/分享、下载、扫描二维码、与客服沟通等场景中读取和写入相册和文件内容。", content: "便于您使用该功能上传您的照片/图片/视频及用于更换头像、发布评论/分享、下载、扫描二维码、与客服沟通等场景中读取和写入相册和文件内容。",
methods: 'SET_CAMERA' methods: 'SET_CAMERA'
}, },
'CALL_PHONE': { 'CALL_PHONE': {
title: "拨打/管理电话权限说明", title: "拨打/管理电话权限说明",
content: "便于您使用该功能联系商家或者商家与您联系等场景", content: "便于您使用该功能联系商家或者商家与您联系等场景",
methods: 'SET_CALL_PHONE' methods: 'SET_CALL_PHONE'
}, },
'ACCESS_FINE_LOCATION': { 'ACCESS_FINE_LOCATION': {
title: "获取位置权限说明", title: "获取位置权限说明",
content: "便于您使用该功能查看附近店铺/附近商品/店铺所在位置等场景", content: "便于您使用该功能查看附近店铺/附近商品/店铺所在位置等场景",
methods: 'SET_ACCESS_FINE_LOCATION' methods: 'SET_ACCESS_FINE_LOCATION'
} }
} }
} }
const mutations = { const mutations = {
SET_WRITE_EXTERNAL_STORAGE(state, val) { SET_WRITE_EXTERNAL_STORAGE(state, val) {
state.WRITE_EXTERNAL_STORAGE = val state.WRITE_EXTERNAL_STORAGE = val
}, },
SET_CALL_PHONE(state, val) { SET_CALL_PHONE(state, val) {
state.CALL_PHONE = val state.CALL_PHONE = val
}, },
SET_READ_EXTERNAL_STORAGE(state, val) { SET_READ_EXTERNAL_STORAGE(state, val) {
state.READ_EXTERNAL_STORAGE = val state.READ_EXTERNAL_STORAGE = val
}, },
SET_CAMERA(state, val) { SET_CAMERA(state, val) {
state.CAMERA = val state.CAMERA = val
}, },
SET_ACCESS_FINE_LOCATION(state, val) { SET_ACCESS_FINE_LOCATION(state, val) {
state.ACCESS_FINE_LOCATION = val state.ACCESS_FINE_LOCATION = val
}, },
} }
const actions = { const actions = {
//权限获取 //权限获取
async requestPermissions({ async requestPermissions({
state, state,
dispatch, dispatch,
commit commit
}, permissionID) { }, permissionID) {
try { try {
if (!state[permissionID] && !state.isIos) { if (!state[permissionID] && !state.isIos) {
var viewObj = await dispatch('nativeObjView', permissionID); var viewObj = await dispatch('nativeObjView', permissionID);
viewObj.show(); viewObj.show();
} }
console.log('android.permission.' + permissionID, '当前手机权限'); console.log('android.permission.' + permissionID, '当前手机权限');
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
//苹果不需要这个 //苹果不需要这个
if(state.isIos){ if (state.isIos) {
resolve(1); resolve(1);
return return
} }
// Android权限查询 // Android权限查询
function requestAndroidPermission(permissionID_) { function requestAndroidPermission(permissionID_) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
plus.android.requestPermissions( plus.android.requestPermissions(
[ [
permissionID_ permissionID_
], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装 ], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
function (resultObj) { function(resultObj) {
var result = 0; var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) { for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i]; var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:' + grantedPermission); console.log('已获取的权限:' + grantedPermission);
result = 1 result = 1
} }
for (var i = 0; i < resultObj.deniedPresent for (var i = 0; i < resultObj.deniedPresent
.length; i++) { .length; i++) {
var deniedPresentPermission = resultObj var deniedPresentPermission = resultObj
.deniedPresent[ .deniedPresent[
i]; i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission); console.log('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0 result = 0
} }
for (var i = 0; i < resultObj.deniedAlways for (var i = 0; i < resultObj.deniedAlways
.length; i++) { .length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[ var deniedAlwaysPermission = resultObj.deniedAlways[
i]; i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission); console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1 result = -1
} }
resolve(result); resolve(result);
}, },
function (error) { function(error) {
console.log('申请权限错误:' + error.code + " = " + error console.log('申请权限错误:' + error.code + " = " + error
.message); .message);
resolve({ resolve({
code: error.code, code: error.code,
message: error.message message: error.message
}); });
} }
); );
}); });
} }
const result = await requestAndroidPermission( const result = await requestAndroidPermission(
'android.permission.' + permissionID 'android.permission.' + permissionID
); );
if (result === 1) { if (result === 1) {
//'已获得授权' //'已获得授权'
commit(state.mapping[permissionID].methods, true) commit(state.mapping[permissionID].methods, true)
} else if (result === 0) { } else if (result === 0) {
//'未获得授权' //'未获得授权'
commit(state.mapping[permissionID].methods, false) commit(state.mapping[permissionID].methods, false)
} else { } else {
commit(state.mapping[permissionID].methods, true) commit(state.mapping[permissionID].methods, true)
uni.showModal({ // uni.showModal({
title: '提示', // title: '提示',
content: '操作权限已被拒绝,请手动前往设置', // content: '操作权限已被拒绝,请手动前往设置',
confirmText: "立即设置", // confirmText: "立即设置",
success: (res) => { // success: (res) => {
if (res.confirm) { // if (res.confirm) {
dispatch('gotoAppPermissionSetting') // dispatch('gotoAppPermissionSetting')
} // }
} // }
}) // })
} }
if (viewObj) viewObj.close() if (viewObj) viewObj.close()
resolve(result); resolve(result);
}); });
} catch (error) { } catch (error) {
console.log(error); console.log(error);
reject(error); reject(error);
} }
}, },
//提示框 //提示框
nativeObjView({ nativeObjView({
state state
}, permissionID) { }, permissionID) {
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
const statusBarHeight = systemInfo.statusBarHeight; const statusBarHeight = systemInfo.statusBarHeight;
const navigationBarHeight = systemInfo.platform === 'android' ? 48 : const navigationBarHeight = systemInfo.platform === 'android' ? 48 :
44; // Set the navigation bar height based on the platform 44; // Set the navigation bar height based on the platform
const totalHeight = statusBarHeight + navigationBarHeight; const totalHeight = statusBarHeight + navigationBarHeight;
let view = new plus.nativeObj.View('per-modal', { let view = new plus.nativeObj.View('per-modal', {
top: '0px', top: '0px',
left: '0px', left: '0px',
width: '100%', width: '100%',
backgroundColor: '#444', backgroundColor: '#444',
//opacity: .5; //opacity: .5;
}) })
view.drawRect({ view.drawRect({
color: '#fff', color: '#fff',
radius: '5px' radius: '5px'
}, { }, {
top: totalHeight + 'px', top: totalHeight + 'px',
left: '5%', left: '5%',
width: '90%', width: '90%',
height: "100px", height: "100px",
}) })
view.drawText(state.mapping[permissionID].title, { view.drawText(state.mapping[permissionID].title, {
top: totalHeight + 5 + 'px', top: totalHeight + 5 + 'px',
left: "8%", left: "8%",
height: "30px" height: "30px"
}, { }, {
align: "left", align: "left",
color: "#000", color: "#000",
}, { }, {
onClick: function (e) { onClick: function(e) {
console.log(e); console.log(e);
} }
}) })
view.drawText(state.mapping[permissionID].content, { view.drawText(state.mapping[permissionID].content, {
top: totalHeight + 35 + 'px', top: totalHeight + 35 + 'px',
height: "60px", height: "60px",
left: "8%", left: "8%",
width: "84%" width: "84%"
}, { }, {
whiteSpace: 'normal', whiteSpace: 'normal',
size: "14px", size: "14px",
align: "left", align: "left",
color: "#656563" color: "#656563"
}) })
function show() { function show() {
view = plus.nativeObj.View.getViewById('per-modal'); view = plus.nativeObj.View.getViewById('per-modal');
view.show() view.show()
view = null//展示的时候也得清空,不然影响下次的关闭,不知道为啥 view = null //展示的时候也得清空,不然影响下次的关闭,不知道为啥
} }
function close() { function close() {
view = plus.nativeObj.View.getViewById('per-modal'); view = plus.nativeObj.View.getViewById('per-modal');
view.close(); view.close();
view = null view = null
} }
return { return {
show, show,
close close
} }
}, },
// 跳转到**应用**的权限页面 // 跳转到**应用**的权限页面
gotoAppPermissionSetting({ gotoAppPermissionSetting({
state state
}) { }) {
if (state.isIos) { if (state.isIos) {
var UIApplication = plus.ios.import("UIApplication"); var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication(); var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL"); var NSURL2 = plus.ios.import("NSURL");
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES"); // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
var setting2 = NSURL2.URLWithString("app-settings:"); var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2); application2.openURL(setting2);
plus.ios.deleteObject(setting2); plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2); plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2); plus.ios.deleteObject(application2);
} else { } else {
// console.log(plus.device.vendor); // console.log(plus.device.vendor);
var Intent = plus.android.importClass("android.content.Intent"); var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings"); var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri"); var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity(); var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent(); var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null); var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri); intent.setData(uri);
mainActivity.startActivity(intent); mainActivity.startActivity(intent);
} }
} }
} }
export default { export default {
namespaced: true, namespaced: true,
state, state,
mutations, mutations,
actions actions
}; };

View File

@ -11,243 +11,252 @@
var isIOS var isIOS
function album() { function album() {
var result = 0; var result = 0;
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary"); var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
var authStatus = PHPhotoLibrary.authorizationStatus(); var authStatus = PHPhotoLibrary.authorizationStatus();
if (authStatus === 0) { if (authStatus === 0) {
result = null; result = null;
} else if (authStatus == 3) { } else if (authStatus == 3) {
result = 1; result = 1;
} else { } else {
result = 0; result = 0;
} }
plus.ios.deleteObject(PHPhotoLibrary); plus.ios.deleteObject(PHPhotoLibrary);
return result; return result;
} }
function camera() { function camera() {
var result = 0; var result = 0;
var AVCaptureDevice = plus.ios.import("AVCaptureDevice"); var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide'); var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
if (authStatus === 0) { if (authStatus === 0) {
result = null; result = null;
} else if (authStatus == 3) { } else if (authStatus == 3) {
result = 1; result = 1;
} else { } else {
result = 0; result = 0;
} }
plus.ios.deleteObject(AVCaptureDevice); plus.ios.deleteObject(AVCaptureDevice);
return result; return result;
} }
function location() { function location() {
var result = 0; var result = 0;
var cllocationManger = plus.ios.import("CLLocationManager"); var cllocationManger = plus.ios.import("CLLocationManager");
var enable = cllocationManger.locationServicesEnabled(); var enable = cllocationManger.locationServicesEnabled();
var status = cllocationManger.authorizationStatus(); var status = cllocationManger.authorizationStatus();
if (!enable) { if (!enable) {
result = 2; result = 2;
} else if (status === 0) { } else if (status === 0) {
result = null; result = null;
} else if (status === 3 || status === 4) { } else if (status === 3 || status === 4) {
result = 1; result = 1;
} else { } else {
result = 0; result = 0;
} }
plus.ios.deleteObject(cllocationManger); plus.ios.deleteObject(cllocationManger);
return result; return result;
} }
function push() { function push() {
var result = 0; var result = 0;
var UIApplication = plus.ios.import("UIApplication"); var UIApplication = plus.ios.import("UIApplication");
var app = UIApplication.sharedApplication(); var app = UIApplication.sharedApplication();
var enabledTypes = 0; var enabledTypes = 0;
if (app.currentUserNotificationSettings) { if (app.currentUserNotificationSettings) {
var settings = app.currentUserNotificationSettings(); var settings = app.currentUserNotificationSettings();
enabledTypes = settings.plusGetAttribute("types"); enabledTypes = settings.plusGetAttribute("types");
if (enabledTypes == 0) { if (enabledTypes == 0) {
result = 0; result = 0;
console.log("推送权限没有开启"); console.log("推送权限没有开启");
} else { } else {
result = 1; result = 1;
console.log("已经开启推送功能!") console.log("已经开启推送功能!")
} }
plus.ios.deleteObject(settings); plus.ios.deleteObject(settings);
} else { } else {
enabledTypes = app.enabledRemoteNotificationTypes(); enabledTypes = app.enabledRemoteNotificationTypes();
if (enabledTypes == 0) { if (enabledTypes == 0) {
result = 3; result = 3;
console.log("推送权限没有开启!"); console.log("推送权限没有开启!");
} else { } else {
result = 4; result = 4;
console.log("已经开启推送功能!") console.log("已经开启推送功能!")
} }
} }
plus.ios.deleteObject(app); plus.ios.deleteObject(app);
plus.ios.deleteObject(UIApplication); plus.ios.deleteObject(UIApplication);
return result; return result;
} }
function contact() { function contact() {
var result = 0; var result = 0;
var CNContactStore = plus.ios.import("CNContactStore"); var CNContactStore = plus.ios.import("CNContactStore");
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0); var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
if (cnAuthStatus === 0) { if (cnAuthStatus === 0) {
result = null; result = null;
} else if (cnAuthStatus == 3) { } else if (cnAuthStatus == 3) {
result = 1; result = 1;
} else { } else {
result = 0; result = 0;
} }
plus.ios.deleteObject(CNContactStore); plus.ios.deleteObject(CNContactStore);
return result; return result;
} }
function record() { function record() {
var result = null; var result = null;
var avaudiosession = plus.ios.import("AVAudioSession"); var avaudiosession = plus.ios.import("AVAudioSession");
var avaudio = avaudiosession.sharedInstance(); var avaudio = avaudiosession.sharedInstance();
var status = avaudio.recordPermission(); var status = avaudio.recordPermission();
console.log("permissionStatus:" + status); console.log("permissionStatus:" + status);
if (status === 1970168948) { if (status === 1970168948) {
result = null; result = null;
} else if (status === 1735552628) { } else if (status === 1735552628) {
result = 1; result = 1;
} else { } else {
result = 0; result = 0;
} }
plus.ios.deleteObject(avaudiosession); plus.ios.deleteObject(avaudiosession);
return result; return result;
} }
function calendar() { function calendar() {
var result = null; var result = null;
var EKEventStore = plus.ios.import("EKEventStore"); var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0); var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
if (ekAuthStatus == 3) { if (ekAuthStatus == 3) {
result = 1; result = 1;
console.log("日历权限已经开启"); console.log("日历权限已经开启");
} else { } else {
console.log("日历权限没有开启"); console.log("日历权限没有开启");
} }
plus.ios.deleteObject(EKEventStore); plus.ios.deleteObject(EKEventStore);
return result; return result;
} }
function memo() { function memo() {
var result = null; var result = null;
var EKEventStore = plus.ios.import("EKEventStore"); var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1); var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
if (ekAuthStatus == 3) { if (ekAuthStatus == 3) {
result = 1; result = 1;
console.log("备忘录权限已经开启"); console.log("备忘录权限已经开启");
} else { } else {
console.log("备忘录权限没有开启"); console.log("备忘录权限没有开启");
} }
plus.ios.deleteObject(EKEventStore); plus.ios.deleteObject(EKEventStore);
return result; return result;
} }
function requestIOS(permissionID) { function requestIOS(permissionID) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
switch (permissionID) { switch (permissionID) {
case "push": case "push":
resolve(push()); resolve(push());
break; break;
case "location": case "location":
resolve(location()); resolve(location());
break; break;
case "record": case "record":
resolve(record()); resolve(record());
break; break;
case "camera": case "camera":
resolve(camera()); resolve(camera());
break; break;
case "album": case "album":
resolve(album()); resolve(album());
break; break;
case "contact": case "contact":
resolve(contact()); resolve(contact());
break; break;
case "calendar": case "calendar":
resolve(calendar()); resolve(calendar());
break; break;
case "memo": case "memo":
resolve(memo()); resolve(memo());
break; break;
default: default:
resolve(0); resolve(0);
break; break;
} }
}); });
} }
function requestAndroid(permissionID) { function requestAndroid(permissionID) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
plus.android.requestPermissions( plus.android.requestPermissions(
[permissionID], [permissionID],
function(resultObj) { function(resultObj) {
var result = 0; var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) { for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i]; var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:' + grantedPermission); console.log('已获取的权限:' + grantedPermission);
result = 1 result = 1
} }
for (var i = 0; i < resultObj.deniedPresent.length; i++) { for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i]; var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission); console.log('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0 result = 0
} }
for (var i = 0; i < resultObj.deniedAlways.length; i++) { for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i]; var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission); console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1 result = -1
} }
resolve(result); resolve(result);
}, },
function(error) { function(error) {
console.log('result error: ' + error.message) console.log('result error: ' + error.message)
resolve({ resolve({
code: error.code, code: error.code,
message: error.message message: error.message
}); });
} }
); );
}); });
} }
function gotoAppPermissionSetting() { function gotoAppPermissionSetting() {
if (permission.isIOS) { if (permission.isIOS) {
var UIApplication = plus.ios.import("UIApplication"); var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication(); var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL"); var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("app-settings:"); var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2); application2.openURL(setting2);
plus.ios.deleteObject(setting2); plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2); plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2); plus.ios.deleteObject(application2);
} else { } else {
var Intent = plus.android.importClass("android.content.Intent"); var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings"); var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri"); var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity(); var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent(); var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null); var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri); intent.setData(uri);
mainActivity.startActivity(intent); mainActivity.startActivity(intent);
} }
}
function isOpenGps() {
var context = plus.android.importClass("android.content.Context");
var locationManager = plus.android.importClass("android.location.LocationManager");
var main = plus.android.runtimeMainActivity();
var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
return mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
} }
const permission = { const permission = {
get isIOS(){ get isIOS() {
return typeof isIOS === 'boolean' ? isIOS : (isIOS = uni.getSystemInfoSync().platform === 'ios') return typeof isIOS === 'boolean' ? isIOS : (isIOS = uni.getSystemInfoSync().platform === 'ios')
}, },
requestIOS: requestIOS, requestIOS: requestIOS,
requestAndroid: requestAndroid, requestAndroid: requestAndroid,
gotoAppSetting: gotoAppPermissionSetting gotoAppSetting: gotoAppPermissionSetting,
isOpenGps
} }
module.exports = permission module.exports = permission

View File

@ -33,6 +33,30 @@ export default {
}) })
}, },
/*app
key:授权值
time:过期时间
*/
isOverTime: (key, time) => {
let FLAG = false;
const AUTH_TYPE = uni.getStorageSync(key);
// 当前时间
const CURR_TIME = +new Date();
if (!AUTH_TYPE) {
uni.setStorageSync(key, time + CURR_TIME);
FLAG = false;
} else {
// 判断两天时间是否过期
if (CURR_TIME < AUTH_TYPE) { //未过期
FLAG = false;
} else {
FLAG = true;
}
}
return FLAG;
},
//复制 //复制
uniCopy: ({ uniCopy: ({
content, content,
@ -865,7 +889,9 @@ export default {
if (typeof list != 'object') return []; if (typeof list != 'object') return [];
if (sp === undefined) sp = []; if (sp === undefined) sp = [];
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
sp.push(list[i]); let product = sp.find(item => item.product_id == list[i].product_id);
if (!product)
sp.push(list[i]);
} }
return sp; return sp;
}, },