收银台

This commit is contained in:
cun-nan 2023-11-27 18:28:41 +08:00
parent bcb44f5e91
commit f30a3556e3
12 changed files with 202 additions and 30 deletions

View File

@ -538,7 +538,7 @@ export default {
name: '',
gradeId: '',
status: '',
storeIds: '',
storeId: '',
official:'',
cardBalance:'',
},

View File

@ -15,9 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
/**
* 支付配置信息 业务层
@ -78,14 +76,18 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
public void ruleCycle(String ruleCycle) {
// 如果是单日的话则开启定时任务
if (ruleCycle.equals("singleDay")){
try {
// 86400000
// Thread.sleep(20000);
// System.out.println(1);
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
// 在这里编写需要执行的方法
merchantConfigService.updateMerchIsOpen("0");
}catch (Exception e){
e.printStackTrace();
}
};
// 设置延迟时间为24小时86400000毫秒
long delay = 86400000;
timer.schedule(task, delay);
}
}

View File

@ -10,6 +10,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/business/storeInformation/store")
@ -46,4 +47,14 @@ public class LJStoreController extends BaseController {
public ResponseObject edit(@Validated @RequestBody LJStore store){
return getSuccessResult(storeService.updateStore(store));
}
/**
* 计算距离当前位置最近的油站
* @param map
* @return
*/
@PostMapping("/recentlyStore")
public ResponseObject recentlyStore(@Validated @RequestBody Map<String,String> map){
return getSuccessResult(storeService.selectStoreByPosition(map));
}
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.storeInformation.entity.LJStore;
import java.util.List;
import java.util.Map;
/**
* 店铺信息 业务层
@ -15,6 +16,12 @@ public interface ILJStoreService extends IService<LJStore> {
*/
public LJStore selectStoreById();
/**
* 根据定位查询距离最近的店铺信息
* @return
*/
public Map<String,Object> selectStoreByPosition(Map<String,String> map);
/**
* 查询店铺信息
* @return

View File

@ -5,10 +5,14 @@ import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.mapper.LJStoreMapper;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 店铺信息 业务层
@ -27,6 +31,53 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
return store;
}
@Override
public Map<String,Object> selectStoreByPosition(Map<String,String> map) {
// 经度
Double lon = Double.valueOf(map.get("lon"));
Double lat = Double.valueOf(map.get("lat"));
List<LJStore> list = baseMapper.selectList(null);
LJStore ljStore = new LJStore();
Double distance = 0.0;
double earthRadius = 6371; // 地球半径单位为公里
double dLat = Math.toRadians(Double.parseDouble(list.get(0).getLatitude()) - lat);
double dLon = Math.toRadians(Double.parseDouble(list.get(0).getLongitude()) - lon);
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(Math.toRadians(lat)) * Math.cos(Math.toRadians(Double.parseDouble(list.get(0).getLatitude()))) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
double min = earthRadius * c;
// 计算最小距离
for (int i = 0; i < list.size(); i++){
if (StringUtils.isNotEmpty(list.get(i).getLatitude()) && StringUtils.isNotEmpty(list.get(i).getLongitude())){
double dLat1 = Math.toRadians(Double.parseDouble(list.get(i).getLatitude()) - lat);
double dLon1 = Math.toRadians(Double.parseDouble(list.get(i).getLongitude()) - lon);
double a1 = Math.sin(dLat1 / 2) * Math.sin(dLat1 / 2) +
Math.cos(Math.toRadians(lat)) * Math.cos(Math.toRadians(Double.parseDouble(list.get(i).getLatitude()))) *
Math.sin(dLon1 / 2) * Math.sin(dLon1 / 2);
double c1 = 2 * Math.atan2(Math.sqrt(a1), Math.sqrt(1 - a1));
if ((earthRadius * c1) < min){
min = earthRadius * c1;
ljStore = list.get(i);
}
}
}
distance = min;
Map<String,Object> map1 = new HashMap<>();
map1.put("distance",distance);
map1.put("store",ljStore);
return map1;
}
/**
* 查询店铺信息
* @return

View File

@ -12,6 +12,9 @@
<if test="user.storeId != null and user.storeId != ''">
and mu.store_id = #{user.storeId}
</if>
<if test="user.storeId == 0">
and mu.store_id = #{user.storeId}
</if>
<if test="user.mobile != null and user.mobile != ''">
and mu.mobile like concat('%', #{user.mobile}, '%')
</if>

View File

@ -37,6 +37,8 @@ public class ShiroConfig {
filterMap.put("/static/**","anon");
//会员模板导出
filterMap.put("/excel/export","anon");
//根据地理位置获取最近的店铺信息
filterMap.put("/business/storeInformation/store/recentlyStore","anon");
filterMap.put("/**","commonFilter");
filter.setFilterChainDefinitionMap(filterMap);
filter.setLoginUrl("/login");

View File

@ -480,6 +480,7 @@
<div v-if="payType != 'CASH'">
<div>
<el-input v-model="authCode"
v-focus
autofocus="autofocus"
@keydown.enter.native="collection"
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
@ -501,6 +502,7 @@
<div v-else>
<div>
<el-input v-model="authCode"
v-focus
autofocus="autofocus"
@input="changeSeekZero"
@keydown.enter.native="collection"
@ -831,6 +833,19 @@ import {listReturnRecord, returnRecordByOrderNo, returnRecordInfo} from "@/api/c
this.getPayList();
this.getLists();
},
directives: {
// v-focus
focus: {
//
inserted: function (el) {
//
el.querySelector('input').focus()
// this.$nextTick( () =>{
// this.$refs.getFocus.focus()
// })
},
},
},
methods:{
getPayMeth(list,val){
let name = "";

View File

@ -491,7 +491,8 @@
<div v-if="map.payType != 'CASH'">
<div>
<el-input v-model="authCode"
:autofocus="true"
v-focus
autofocus
@keydown.enter.native="collection"
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
<i
@ -511,7 +512,8 @@
<div v-else>
<div>
<el-input v-model="authCode"
:autofocus="true"
v-focus ref="getFocus"
autofocus
@input="changeSeekZero"
@keydown.enter.native="collection"
placeholder="请输入收款金额">
@ -1072,6 +1074,19 @@
this.getCouponList();
this.getUnitList();
},
directives: {
// v-focus
focus: {
//
inserted: function (el) {
//
el.querySelector('input').focus()
// this.$nextTick( () =>{
// this.$refs.getFocus.focus()
// })
},
},
},
methods:{
clear(){
this.dialogVisiblej = false
@ -1887,6 +1902,9 @@
if (response.data.length>0){
_this.fullReduceDiscount = []
response.data.forEach(item => {
if (item.participationCondition==1){
_this.exclusion = 0
}
let discount = {type:item.name,full:0,reduce:0,discount:0,exclusion:item.participationCondition}
let activeList = item.activeDiscountChildList;
for (let i = 1;i<=activeList.length;i++){

View File

@ -73,5 +73,16 @@
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "2"
"vueVersion" : "2",
"h5" : {
"sdkConfigs" : {
"maps" : {
"amap" : {
"key" : "b5abec514cab7c71cb0572765131e6fc",
"securityJsCode" : "6e7d904a9f6e98a02fe4f0bb8f276f98",
"serviceHost" : "6e7d904a9f6e98a02fe4f0bb8f276f98"
}
}
}
}
}

View File

@ -27,13 +27,13 @@
</view>
<view class="jg-size">本站活动</view>
</view>
<view class="jg-box" @click="gocard()">
<view class="jg-box" @click="goCard()">
<view class="jg-img">
<image src="../../static/imgs/ykcz.png" mode=""></image>
</view>
<view class="jg-size">油卡充值</view>
</view>
<view class="jg-box" @click="gomall()">
<view class="jg-box" @click="goMall()">
<view class="jg-img">
<image src="../../static/imgs/jfsc.png" mode=""></image>
</view>
@ -70,15 +70,17 @@
<view class="station">
<view class="station-box">
<view class="station-title">顺通石化加油站(工业南路站)</view>
<view class="bule-icon">全天营业</view>
<view class="station-title">{{store.name}}{{store.description ? "("+store.description+")" : ""}}</view><!--顺通石化加油站(工业南路站)-->
<view style="display: flex;">
<view class="bule-icon" v-if="welfare.length!=0" v-for="(item,index) in welfare" :key="index">{{item}}</view>
</view>
<view class="dis-bt">
<view class="">
<view class="hui1">济南市历城区工业南路</view>
<view class="hui2">891.9km</view>
<view class="hui1">{{ store.address }}</view>
<view class="hui2">{{ distance }}km</view>
</view>
<view class="lananniu" @click="gogogo"> <uni-icons type="paperplane-filled" color="#195ADA"
size="16"></uni-icons> 984.6</view>
<view class="lananniu" @click="goGoGo"> <uni-icons type="paperplane-filled" color="#195ADA"
size="16"></uni-icons> {{ distance*1000 }}</view>
</view>
<!-- <scroll-view scroll-x="true">
<view class="scrollbox" >
@ -87,7 +89,7 @@
</scroll-view> -->
<u-swiper :list="list3" previousMargin="30" nextMargin="30" circular :autoplay="false" radius="5"
bgColor="#ffffff"></u-swiper>
<view class="juanniu" @click="gooil()">
<view class="juanniu" @click="goOil()">
<view class="">一键加油</view>
</view>
@ -107,6 +109,7 @@
<script>
import tabbar from "../../components/tabbar/tabbar.vue"
export default {
data() {
return {
@ -121,15 +124,64 @@
'http://47.95.206.185:83/centerbj.png',
'https://cdn.uviewui.com/uview/swiper/swiper1.png',
],
//
longitude:"",
//
latitude:"",
//
store:{},
//
welfare:[],
distance: "",
}
},
onLoad() {
},
onShow() {
this.getAddress();
},
components: {
tabbar
},
methods: {
//
getAddress(){
let _this = this;
uni.getLocation({
// 使wgs84 使gcj02
type: 'wgs84', // 使
success: function(res) {
_this.longitude = res.longitude;
_this.latitude = res.latitude
// console.log(': ' + res.longitude);
// console.log(': ' + res.latitude);
uni.request({
url: "http://localhost:8080/business/storeInformation/store/recentlyStore",
method: "POST",
data: {
"lon": res.longitude,
"lat": res.latitude
},
success: function(response){
_this.distance = (response.data.data.distance).toFixed(1)
_this.store = response.data.data.store
let welfare = response.data.data.store.welfare
if (welfare != undefined && welfare!=null && welfare!=""){
if (welfare.includes(",")){
_this.welfare = response.data.data.store.welfare.split(",")
}else {
_this.welfare.push(response.data.data.store.welfare)
}
}
}
})
},
fail: function(err) {
console.log('获取位置信息失败: ' + err.errMsg);
}
});
},
confirm(e) {
console.log('选中的油号', e);
this.show = false
@ -143,22 +195,22 @@
url: '/pagesHome/Activity/index'
})
},
gocard() {
goCard() {
uni.navigateTo({
url: '/pagesHome/MyCard/MyCard'
})
},
gooil() {
goOil() {
uni.navigateTo({
url: '/pages/refuel/refuel'
})
},
gomall() {
goMall() {
uni.navigateTo({
url: '/pagesHome/PointsMall/PointsMall'
})
},
gogogo() {
goGoGo() {
uni.openLocation({
latitude: 36.651441,
longitude: 116.901224,
@ -371,7 +423,7 @@
justify-content: center;
border: 1px solid #195ADA;
border-radius: 4px;
margin: 5px 0px;
margin: 5px 3px;
}
.dis-bt {

View File

@ -17,7 +17,7 @@ export const request = (params) => {
// 定义公共的url
// const baseUrl="https://jfsc.lmweixin.com/";
const baseUrl = "http://192.168.1.159:8080/";
const baseUrl = "http://192.168.1.4:8080/";
return new Promise((resolve, reject) => {
wx.request({
...params,