增加电子围栏开关,店铺配置增加修改配置弹窗提醒

This commit is contained in:
2025-11-25 09:57:02 +08:00
parent 0d13ae2e9e
commit 4faa482380
2 changed files with 566 additions and 470 deletions

View File

@@ -121,7 +121,7 @@ const pageData = reactive({
}, },
{ {
payType: "主扫收款", payType: "主扫收款",
key: "scanPayAmount", key: "backScanPayAmount",
payAmount: 0, payAmount: 0,
bgcolor: "#FF5C6D", bgcolor: "#FF5C6D",
}, },

View File

@@ -3,19 +3,39 @@
<view class="page-cell"> <view class="page-cell">
<view class="label">头像</view> <view class="label">头像</view>
<view class="right"> <view class="right">
<up-avatar class="fileImg" :src="vdata.shopInfo.coverImg ? vdata.shopInfo.coverImg : ''" mode="aspectFill"></up-avatar> <up-avatar
class="fileImg"
:src="vdata.shopInfo.coverImg ? vdata.shopInfo.coverImg : ''"
mode="aspectFill"
></up-avatar>
<view class="file" @tap="chooseAndUploadAvatar('coverImg')"></view> <view class="file" @tap="chooseAndUploadAvatar('coverImg')"></view>
</view> </view>
</view> </view>
<!-- <view class="page-cell m" @tap="updateValue('商户名称','shopName',vdata.shopInfo.shopName)"> --> <!-- <view class="page-cell m" @tap="updateValue('商户名称','shopName',vdata.shopInfo.shopName)"> -->
<view class="page-cell m" @tap="go.to('PAGES_SHOP_EDITVAL', { name: 'shopName', value: vdata.shopInfo.shopName })"> <view
class="page-cell m"
@tap="
go.to('PAGES_SHOP_EDITVAL', {
name: 'shopName',
value: vdata.shopInfo.shopName,
})
"
>
<view class="label">商户名称</view> <view class="label">商户名称</view>
<view class="right"> <view class="right">
<view>{{ vdata.shopInfo.shopName }}</view> <view>{{ vdata.shopInfo.shopName }}</view>
<up-icon name="arrow-right" color="#999999" size="15"></up-icon> <up-icon name="arrow-right" color="#999999" size="15"></up-icon>
</view> </view>
</view> </view>
<view class="page-cell m" @tap="go.to('PAGES_SHOP_EDITVAL', { name: 'phone', value: vdata.shopInfo.phone })"> <view
class="page-cell m"
@tap="
go.to('PAGES_SHOP_EDITVAL', {
name: 'phone',
value: vdata.shopInfo.phone,
})
"
>
<view class="label">商户电话</view> <view class="label">商户电话</view>
<view class="right"> <view class="right">
<view>{{ vdata.shopInfo.phone }}</view> <view>{{ vdata.shopInfo.phone }}</view>
@@ -29,7 +49,14 @@
<view class="page-cell m"> <view class="page-cell m">
<view class="label">营业状态</view> <view class="label">营业状态</view>
<view class="right"> <view class="right">
<up-switch v-model="vdata.shopInfo.status" size="20" :inactiveValue="2" :activeValue="1" activeColor="#0FC161" @change="switchChange('status')"></up-switch> <up-switch
v-model="vdata.shopInfo.status"
size="20"
:inactiveValue="2"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('status')"
></up-switch>
</view> </view>
</view> </view>
<view class="page-cell m" @tap="showMap"> <view class="page-cell m" @tap="showMap">
@@ -45,7 +72,14 @@
</view> --> </view> -->
<view class="page-cell"> <view class="page-cell">
<view class="label">允许打包</view> <view class="label">允许打包</view>
<view class="right"><up-switch v-model="vdata.takeout" size="20" activeColor="#0FC161" @change="switchChange('eatModel')"></up-switch></view> <view class="right"
><up-switch
v-model="vdata.takeout"
size="20"
activeColor="#0FC161"
@change="switchChange('eatModel')"
></up-switch
></view>
</view> </view>
<view class="page-cell m"> <view class="page-cell m">
<view class="label">是否开启会员余额支付</view> <view class="label">是否开启会员余额支付</view>
@@ -60,7 +94,26 @@
></up-switch> ></up-switch>
</view> </view>
</view> </view>
<view class="page-cell m"> <view class="page-cell m" style="display: block">
<view class="u-flex u-row-between">
<view class="label">点餐电子围栏</view>
<view class="right"
><up-switch
v-model="vdata.shopInfo.isOrderFence"
size="20"
:inactiveValue="0"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('isOrderFence')"
></up-switch
></view>
</view>
<view class="u-m-t-6 color-666 u-font-24"
>开启后用户只能在店铺附近两公里范围内点餐</view
>
</view>
<!-- <view class="page-cell m">
<view class="label">是否开启会员价支付</view> <view class="label">是否开启会员价支付</view>
<view class="right"> <view class="right">
<up-switch <up-switch
@@ -72,18 +125,33 @@
@change="switchChange('isMemberPrice')" @change="switchChange('isMemberPrice')"
></up-switch> ></up-switch>
</view> </view>
</view> </view> -->
<view class="page-cell"> <view class="page-cell">
<view class="label"> <view class="label">
桌位费 桌位费
<view v-if="!vdata.isTableFee" class="tableFee" @tap="go.to('PAGES_SHOP_EDITVAL', { name: 'tableFee', value: vdata.shopInfo.tableFee })"> <view
v-if="!vdata.isTableFee"
class="tableFee"
@tap="
go.to('PAGES_SHOP_EDITVAL', {
name: 'tableFee',
value: vdata.shopInfo.tableFee,
})
"
>
{{ vdata.shopInfo.tableFee }} {{ vdata.shopInfo.tableFee }}
</view> </view>
</view> </view>
<view class="right"> <view class="right">
<view> <view>
<up-checkbox-group> <up-checkbox-group>
<up-checkbox label="免桌位费" v-model:checked="vdata.isTableFee" activeColor="#0FC161" shape="circle" @change="isTableFeeChange"></up-checkbox> <up-checkbox
label="免桌位费"
v-model:checked="vdata.isTableFee"
activeColor="#0FC161"
shape="circle"
@change="isTableFeeChange"
></up-checkbox>
</up-checkbox-group> </up-checkbox-group>
</view> </view>
</view> </view>
@@ -121,9 +189,18 @@
</up-radio-group> </up-radio-group>
</view> </view>
</view> </view>
<view class="page-cell" @tap="go.to('PAGES_SHOP_QRCODE', { paymentQrcode: vdata.shopInfo.paymentQrcode })"> <view
class="page-cell"
@tap="
go.to('PAGES_SHOP_QRCODE', {
paymentQrcode: vdata.shopInfo.paymentQrcode,
})
"
>
<view class="label">店铺收款码</view> <view class="label">店铺收款码</view>
<view class="right"><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view> <view class="right"
><up-icon name="arrow-right" color="#999999" size="15"></up-icon
></view>
</view> </view>
<!-- <view class="cutShop" @tap="go.to('PAGES_SHOP_LIST')">切换门店</view> --> <!-- <view class="cutShop" @tap="go.to('PAGES_SHOP_LIST')">切换门店</view> -->
@@ -131,31 +208,36 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue'; import { ref, reactive, onMounted } from "vue";
import { onShow } from '@dcloudio/uni-app'; import { onShow } from "@dcloudio/uni-app";
import go from '@/commons/utils/go.js'; import go from "@/commons/utils/go.js";
import { uploadFile } from '@/http/api/index.js'; import { uploadFile } from "@/http/api/index.js";
import { getShopInfo, editShopInfo, getShopExtend, editShopExtend } from '@/http/api/shop.js'; import {
getShopInfo,
editShopInfo,
getShopExtend,
editShopExtend,
} from "@/http/api/shop.js";
const vdata = reactive({ const vdata = reactive({
shopInfo: { shopInfo: {
status: 2, status: 2,
isAccountPay: 0, isAccountPay: 0,
isMemberPrice: 0 isMemberPrice: 0,
}, },
extendList: [], extendList: [],
registerTypeList: [ registerTypeList: [
{ name: '先付费', value: 'before' }, { name: "先付费", value: "before" },
{ name: '后付费', value: 'after' } { name: "后付费", value: "after" },
], ],
extendIndex: 0, extendIndex: 0,
extendInfo: {}, extendInfo: {},
dineIn: false, dineIn: false,
takeout: false, takeout: false,
isTableFee: false, isTableFee: false,
label: '', label: "",
type: '', type: "",
inputValue: '' inputValue: "",
}); });
onMounted(() => { onMounted(() => {
shopExtend(); shopExtend();
@@ -163,7 +245,7 @@ onMounted(() => {
onShow(() => { onShow(() => {
shopInfo(); shopInfo();
uni.$on('refreshPreviousPage', (params) => { uni.$on("refreshPreviousPage", (params) => {
// 这里执行刷新数据的操作例如重新调用API获取数据 // 这里执行刷新数据的操作例如重新调用API获取数据
refreshData(params); refreshData(params);
}); });
@@ -174,24 +256,24 @@ onShow(() => {
*/ */
let refreshData = (e) => { let refreshData = (e) => {
let params = { let params = {
id: vdata.shopInfo.id id: vdata.shopInfo.id,
}; };
params[e.name] = e.value; params[e.name] = e.value;
vdata.type = e.name; vdata.type = e.name;
vdata.inputValue = e.value; vdata.inputValue = e.value;
updateShopInfo(params, 'input'); updateShopInfo(params, "input");
}; };
/** /**
* 获取店铺信息 * 获取店铺信息
*/ */
const shopInfo = () => { const shopInfo = () => {
getShopInfo({ id: uni.getStorageSync('shopInfo').id }).then((res) => { getShopInfo({ id: uni.getStorageSync("shopInfo").id }).then((res) => {
vdata.isTableFee = res.isTableFee == 1 ? true : false; vdata.isTableFee = res.isTableFee == 1 ? true : false;
if (res.eatModel.split(',').indexOf('dine-in') != -1) { if (res.eatModel.split(",").indexOf("dine-in") != -1) {
vdata.dineIn = true; vdata.dineIn = true;
} }
if (res.eatModel.split(',').indexOf('take-out') != -1) { if (res.eatModel.split(",").indexOf("take-out") != -1) {
vdata.takeout = true; vdata.takeout = true;
} }
vdata.shopInfo = res; vdata.shopInfo = res;
@@ -215,7 +297,7 @@ let shopExtend = () => {
function tableClearChange(n) { function tableClearChange(n) {
let params = { let params = {
id: vdata.shopInfo.id, id: vdata.shopInfo.id,
tableClearType: n tableClearType: n,
}; };
updateShopInfo(params); updateShopInfo(params);
} }
@@ -226,7 +308,7 @@ function tableClearChange(n) {
let radioChange = (n) => { let radioChange = (n) => {
let params = { let params = {
id: vdata.shopInfo.id, id: vdata.shopInfo.id,
registerType: n registerType: n,
}; };
updateShopInfo(params); updateShopInfo(params);
}; };
@@ -236,7 +318,18 @@ let radioChange = (n) => {
*/ */
let updateShopInfo = (params, type) => { let updateShopInfo = (params, type) => {
editShopInfo(params).then((res) => { editShopInfo(params).then((res) => {
if (type && type == 'input') { if (res) {
uni.showToast({
title: "修改成功",
icon: "none",
});
} else {
uni.showToast({
title: "修改失败",
icon: "none",
});
}
if (type && type == "input") {
vdata.shopInfo[vdata.type] = vdata.inputValue; vdata.shopInfo[vdata.type] = vdata.inputValue;
} }
}); });
@@ -248,7 +341,7 @@ let updateShopInfo = (params, type) => {
let updateShopExtend = () => { let updateShopExtend = () => {
editShopExtend({ editShopExtend({
autokey: vdata.extendInfo.autoKey, autokey: vdata.extendInfo.autoKey,
value: vdata.extendInfo.value value: vdata.extendInfo.value,
}).then((res) => {}); }).then((res) => {});
}; };
@@ -259,21 +352,21 @@ let chooseAndUploadAvatar = (type) => {
// 选择图片 // 选择图片
uni.chooseImage({ uni.chooseImage({
count: 1, // 默认为1只选择一张图片 count: 1, // 默认为1只选择一张图片
sizeType: ['original', 'compressed'], // 图片质量,原图或压缩 sizeType: ["original", "compressed"], // 图片质量,原图或压缩
sourceType: ['album', 'camera'], // 图片来源,相册或相机 sourceType: ["album", "camera"], // 图片来源,相册或相机
success: (res) => { success: (res) => {
let file = res.tempFiles[0]; let file = res.tempFiles[0];
uploadFile(file) uploadFile(file)
.then((res) => { .then((res) => {
if (type == 'coverImg') { if (type == "coverImg") {
vdata.shopInfo.coverImg = res; vdata.shopInfo.coverImg = res;
let params = { let params = {
id: vdata.shopInfo.id, id: vdata.shopInfo.id,
coverImg: vdata.shopInfo.coverImg coverImg: vdata.shopInfo.coverImg,
}; };
updateShopInfo(params); updateShopInfo(params);
} }
if (type == 'extendUp') { if (type == "extendUp") {
vdata.extendInfo.value = res; vdata.extendInfo.value = res;
updateShopExtend(); updateShopExtend();
} }
@@ -281,16 +374,16 @@ let chooseAndUploadAvatar = (type) => {
.catch((res) => { .catch((res) => {
if (res.errMsg) { if (res.errMsg) {
uni.showToast({ uni.showToast({
title: '图片大小超出限制', title: "图片大小超出限制",
icon: 'error' icon: "error",
}); });
} }
}); });
}, },
fail: (chooseImageError) => { fail: (chooseImageError) => {
// 选择图片失败处理逻辑 // 选择图片失败处理逻辑
console.log('choose image fail:', chooseImageError); console.log("choose image fail:", chooseImageError);
} },
}); });
}; };
@@ -311,7 +404,7 @@ let isTableFeeChange = (e) => {
} else { } else {
vdata.isTableFee = false; vdata.isTableFee = false;
} }
switchChange('isTableFee'); switchChange("isTableFee");
}; };
/** /**
@@ -319,40 +412,43 @@ let isTableFeeChange = (e) => {
*/ */
let switchChange = (type) => { let switchChange = (type) => {
let params = { let params = {
id: vdata.shopInfo.id id: vdata.shopInfo.id,
}; };
switch (type) { switch (type) {
case 'address': case "address":
params.lng = vdata.shopInfo.lng; params.lng = vdata.shopInfo.lng;
params.lat = vdata.shopInfo.lat; params.lat = vdata.shopInfo.lat;
params.address = vdata.shopInfo.address; params.address = vdata.shopInfo.address;
break; break;
case 'status': case "status":
params.status = vdata.shopInfo.status; params.status = vdata.shopInfo.status;
break; break;
case 'eatModel': case "eatModel":
params.eatModel = []; params.eatModel = [];
if (vdata.dineIn) { if (vdata.dineIn) {
params.eatModel.push('dine-in'); params.eatModel.push("dine-in");
} }
if (vdata.takeout) { if (vdata.takeout) {
params.eatModel.push('take-out'); params.eatModel.push("take-out");
} }
params.eatModel = params.eatModel.join(','); params.eatModel = params.eatModel.join(",");
break; break;
case 'isAccountPay': case "isAccountPay":
params.isAccountPay = vdata.shopInfo.isAccountPay; params.isAccountPay = vdata.shopInfo.isAccountPay;
break; break;
case 'isMemberPrice': case "isMemberPrice":
params.isMemberPrice = vdata.shopInfo.isMemberPrice; params.isMemberPrice = vdata.shopInfo.isMemberPrice;
break; break;
case 'isTableFee': case "isTableFee":
if (vdata.isTableFee) { if (vdata.isTableFee) {
params.isTableFee = 1; params.isTableFee = 1;
} else { } else {
params.isTableFee = 0; params.isTableFee = 0;
} }
break; break;
case "isOrderFence":
params.isOrderFence = vdata.shopInfo.isOrderFence;
break;
} }
updateShopInfo(params); updateShopInfo(params);
}; };
@@ -370,7 +466,7 @@ let showMap = () => {
vdata.shopInfo.lng = res.longitude.toFixed(6); // IOS 小程序中: 经纬度12位。 vdata.shopInfo.lng = res.longitude.toFixed(6); // IOS 小程序中: 经纬度12位。
vdata.shopInfo.lat = res.latitude.toFixed(6); vdata.shopInfo.lat = res.latitude.toFixed(6);
vdata.shopInfo.address = res.name; vdata.shopInfo.address = res.name;
switchChange('address'); switchChange("address");
}, },
fail: function (err) { fail: function (err) {
console.log(err); console.log(err);
@@ -378,7 +474,7 @@ let showMap = () => {
// title:err, // title:err,
// icon:'error' // icon:'error'
// }) // })
} },
}); });
}; };
</script> </script>