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

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: "主扫收款",
key: "scanPayAmount",
key: "backScanPayAmount",
payAmount: 0,
bgcolor: "#FF5C6D",
},

View File

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