|
@@ -4,14 +4,14 @@
|
|
<view class="module-con first-con">
|
|
<view class="module-con first-con">
|
|
<text class="info-tit">门店名称:</text>
|
|
<text class="info-tit">门店名称:</text>
|
|
<view class="info-main">
|
|
<view class="info-main">
|
|
- <text class="location-addr">常青二路店</text>
|
|
|
|
|
|
+ <text class="location-addr">{{ stores && stores.name }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 定位 -->
|
|
<!-- 定位 -->
|
|
<view class="module-con">
|
|
<view class="module-con">
|
|
<text class="info-tit">当前位置:</text>
|
|
<text class="info-tit">当前位置:</text>
|
|
<view class="info-main" @click="getLocation">
|
|
<view class="info-main" @click="getLocation">
|
|
- <text class="location-addr">{{location}}</text>
|
|
|
|
|
|
+ <text class="location-addr">{{ location }}</text>
|
|
<u-icon name="map" color="#2979ff" size="34" class="location-icon"></u-icon>
|
|
<u-icon name="map" color="#2979ff" size="34" class="location-icon"></u-icon>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -31,141 +31,149 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
- import { clzConfirm } from '@/libs/tools.js'
|
|
|
|
- export default{
|
|
|
|
- data(){
|
|
|
|
- return{
|
|
|
|
- location: '', // 当前位置
|
|
|
|
- photograph: '', // 拍照
|
|
|
|
- }
|
|
|
|
|
|
+import { clzConfirm } from '@/libs/tools.js';
|
|
|
|
+import { validTaskPosition } from '@/api/task.js';
|
|
|
|
+export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ stores: null,
|
|
|
|
+ location: '', // 当前位置地址
|
|
|
|
+ photograph: '', // 拍照
|
|
|
|
+ position: null // 位置信息
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ onShow() {
|
|
|
|
+ this.init();
|
|
|
|
+ },
|
|
|
|
+ onLoad(opts) {
|
|
|
|
+ this.stores = JSON.parse(opts.item);
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 初始化
|
|
|
|
+ init() {
|
|
|
|
+ this.getLocation();
|
|
},
|
|
},
|
|
- onShow() {
|
|
|
|
- this.init()
|
|
|
|
|
|
+ // 获取当前位置
|
|
|
|
+ getLocation() {
|
|
|
|
+ const _this = this;
|
|
|
|
+ uni.getLocation({
|
|
|
|
+ type: 'gcj02',
|
|
|
|
+ geocode: true,
|
|
|
|
+ success: function(res) {
|
|
|
|
+ console.log(res);
|
|
|
|
+ // _this.location = res.address.province + res.address.city + res.address.district + res.address.street + res.address.streetNum +'靠近' + res.address.poiName
|
|
|
|
+ // console.log(_this.location, '城市编码 ', res.address.cityCode)
|
|
|
|
+ this.position = res;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- methods: {
|
|
|
|
- // 初始化
|
|
|
|
- init(){
|
|
|
|
- this.getLocation()
|
|
|
|
- },
|
|
|
|
- // 获取当前位置
|
|
|
|
- getLocation(){
|
|
|
|
- const _this = this
|
|
|
|
- uni.getLocation({
|
|
|
|
- type: 'gcj02',
|
|
|
|
- geocode: true,
|
|
|
|
- success: function (res) {
|
|
|
|
- console.log(res)
|
|
|
|
- _this.location = res.address.province + res.address.city + res.address.district + res.address.street + res.address.streetNum +'靠近' + res.address.poiName
|
|
|
|
- console.log(_this.location, '城市编码 ', res.address.cityCode)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 签到拍照
|
|
|
|
- goPhotograph(){
|
|
|
|
- const _this = this
|
|
|
|
- uni.chooseImage({
|
|
|
|
- count: 1, //最多可以选择的图片张数,默认9
|
|
|
|
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
|
- sourceType: ['camera'], //album 从相册选图,camera 使用相机,默认二者都有
|
|
|
|
- success: function (res) {
|
|
|
|
- // tempFilePaths 图片的本地文件路径列表,tempFiles 图片的本地文件列表,每一项是一个 File 对象
|
|
|
|
- console.log(JSON.stringify(res.tempFilePaths))
|
|
|
|
- _this.photograph = res.tempFilePaths[0]
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 签到
|
|
|
|
- signInFun(){
|
|
|
|
- // 判断是否超出签到范围
|
|
|
|
- const outRange = false
|
|
|
|
- if(outRange){
|
|
|
|
- this.isOutRange()
|
|
|
|
- }else{
|
|
|
|
|
|
+ // 签到拍照
|
|
|
|
+ goPhotograph() {
|
|
|
|
+ const _this = this;
|
|
|
|
+ uni.chooseImage({
|
|
|
|
+ count: 1, //最多可以选择的图片张数,默认9
|
|
|
|
+ sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
|
+ sourceType: ['camera'], //album 从相册选图,camera 使用相机,默认二者都有
|
|
|
|
+ success: function(res) {
|
|
|
|
+ // tempFilePaths 图片的本地文件路径列表,tempFiles 图片的本地文件列表,每一项是一个 File 对象
|
|
|
|
+ console.log(JSON.stringify(res.tempFilePaths));
|
|
|
|
+ _this.photograph = res.tempFilePaths[0];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 签到
|
|
|
|
+ signInFun() {
|
|
|
|
+ // 判断是否超出签到范围
|
|
|
|
+ validTaskPosition({
|
|
|
|
+ storeId: this.stores.id,
|
|
|
|
+ lat: this.position.latitude,
|
|
|
|
+ lng: this.position.longitude
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
// 跳转 开始巡店
|
|
// 跳转 开始巡店
|
|
- uni.redirectTo({
|
|
|
|
- url: '/pages/shopTourOver/shopTourOver'
|
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/shopTour/shopTour?storeId=' + this.stores.id + '&types=scene'
|
|
})
|
|
})
|
|
|
|
+ } else {
|
|
|
|
+ this.isOutRange();
|
|
}
|
|
}
|
|
- },
|
|
|
|
- // 超出范围 提示
|
|
|
|
- isOutRange(){
|
|
|
|
- clzConfirm({
|
|
|
|
- title: '提示',
|
|
|
|
- content: '您所在的位置超出门店签到范围,无法开启巡店!',
|
|
|
|
- showCancel: false,
|
|
|
|
- success: function (res) {
|
|
|
|
- if (res.confirm||res.index==0) {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 预览签到图
|
|
|
|
- previewPictures(){
|
|
|
|
- const photograph = [this.photograph]
|
|
|
|
- uni.previewImage({
|
|
|
|
- urls: photograph
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 删除签到图
|
|
|
|
- cancelPhotograph(){
|
|
|
|
- setTimeout(()=>{
|
|
|
|
- this.photograph = ''
|
|
|
|
- },500)
|
|
|
|
- }
|
|
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 超出范围 提示
|
|
|
|
+ isOutRange() {
|
|
|
|
+ clzConfirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '您所在的位置超出门店签到范围,无法开启巡店!',
|
|
|
|
+ showCancel: false,
|
|
|
|
+ success: function(res) {
|
|
|
|
+ if (res.confirm || res.index == 0) {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 预览签到图
|
|
|
|
+ previewPictures() {
|
|
|
|
+ const photograph = [this.photograph];
|
|
|
|
+ uni.previewImage({
|
|
|
|
+ urls: photograph
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 删除签到图
|
|
|
|
+ cancelPhotograph() {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.photograph = '';
|
|
|
|
+ }, 500);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
- page{
|
|
|
|
- background-color: #f8f8f8;
|
|
|
|
- height: calc(100vh - 44px);
|
|
|
|
- }
|
|
|
|
- .signIn-wrap{
|
|
|
|
- height: 100%;
|
|
|
|
- .module-con{
|
|
|
|
- padding: 0 30upx 20upx;
|
|
|
|
- .info-main{
|
|
|
|
- margin-top: 14upx;
|
|
|
|
- padding: 20upx;
|
|
|
|
|
|
+page {
|
|
|
|
+ background-color: #f8f8f8;
|
|
|
|
+ height: calc(100vh - 44px);
|
|
|
|
+}
|
|
|
|
+.signIn-wrap {
|
|
|
|
+ height: 100%;
|
|
|
|
+ .module-con {
|
|
|
|
+ padding: 0 30upx 20upx;
|
|
|
|
+ .info-main {
|
|
|
|
+ margin-top: 14upx;
|
|
|
|
+ padding: 20upx;
|
|
|
|
+ border-radius: 12upx;
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ .location-icon {
|
|
|
|
+ padding-left: 10upx;
|
|
|
|
+ vertical-align: bottom;
|
|
|
|
+ }
|
|
|
|
+ .photograph-con {
|
|
|
|
+ border: 2upx dashed #bfbfbf;
|
|
border-radius: 12upx;
|
|
border-radius: 12upx;
|
|
- background-color: #fff;
|
|
|
|
- .location-addr{
|
|
|
|
- font-size: 24upx;
|
|
|
|
- }
|
|
|
|
- .location-icon{
|
|
|
|
- padding-left: 10upx;
|
|
|
|
- vertical-align: bottom;
|
|
|
|
|
|
+ width: 160upx;
|
|
|
|
+ height: 160upx;
|
|
|
|
+ text-align: center;
|
|
|
|
+ position: relative;
|
|
|
|
+ .photograph-icon {
|
|
|
|
+ display: inline-block;
|
|
|
|
+ padding-top: 48upx;
|
|
}
|
|
}
|
|
- .photograph-con{
|
|
|
|
- border: 2upx dashed #bfbfbf;
|
|
|
|
- border-radius: 12upx;
|
|
|
|
- width: 160upx;
|
|
|
|
- height: 160upx;
|
|
|
|
- text-align: center;
|
|
|
|
- position: relative;
|
|
|
|
- .photograph-icon{
|
|
|
|
- display: inline-block;
|
|
|
|
- padding-top: 48upx;
|
|
|
|
- }
|
|
|
|
- .close-circle-icon{
|
|
|
|
- background-color: #fff;
|
|
|
|
- border-radius: 50%;
|
|
|
|
- position: absolute;
|
|
|
|
- right: -23upx;
|
|
|
|
- top: -23upx;
|
|
|
|
- z-index: 9;
|
|
|
|
- }
|
|
|
|
|
|
+ .close-circle-icon {
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+ position: absolute;
|
|
|
|
+ right: -23upx;
|
|
|
|
+ top: -23upx;
|
|
|
|
+ z-index: 9;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- .first-con{
|
|
|
|
- padding-top: 30upx;
|
|
|
|
- }
|
|
|
|
- .submit-btn{
|
|
|
|
- width: 80%;
|
|
|
|
- margin-top: 50upx;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
+ .first-con {
|
|
|
|
+ padding-top: 30upx;
|
|
|
|
+ }
|
|
|
|
+ .submit-btn {
|
|
|
|
+ width: 80%;
|
|
|
|
+ margin-top: 50upx;
|
|
|
|
+ }
|
|
|
|
+}
|
|
</style>
|
|
</style>
|