源文件

This commit is contained in:
gyq
2024-05-23 14:39:33 +08:00
commit a1128dd791
2997 changed files with 500069 additions and 0 deletions

View File

@@ -0,0 +1,246 @@
<template>
<view class="page-wrapper global-wrapper bgF2">
<JHeaderTitle :title="storeInfo.storeId ? '编辑门店信息' : '创建门店'" bgColor="#f2f2f2" />
<JMainCard pd="0" wrapPd="30rpx" v-if="!storeInfo.storeId">
<view class="select-wrapper" @tap="jumpPage('mch')">
<view class="select-mch" v-if="mchInfo.mchNo == undefined"> 请选择商户 </view>
<view class="mch-info" v-else>
<image src="/static/equipmentImg/mch-list.svg" mode="scaleToFill" />
<view
>{{ mchInfo.mchName }} <text>{{ mchInfo.mchNo }}</text>
</view>
</view>
<image src="/static/iconImg/right-arrow.svg" mode="scaleToFill" />
</view>
</JMainCard>
<JMainCard wrapPd=" 0 30rpx" pd="0">
<JInput
v-model:value="storeInfo.storeName"
name="门店名称"
place="请输入门店名称"
:rules="{ name: 'storeName', rule: 'REG_NotNUll' }"
:isBorder="true"
></JInput>
<JInput v-model:value="storeInfo.contactPhone" name="联系人手机号" place="请输入联系人手机号"></JInput>
</JMainCard>
<JMainCard pd="0" wrapPd="30rpx">
<JUpLoad name="门店logo" v-model:value="storeInfo.storeLogo" borderNone />
<JUpLoad name="门头照" v-model:value="storeInfo.storeOuterImg" />
<JUpLoad name="门店内景照" v-model:value="storeInfo.storeInnerImg" />
</JMainCard>
<JMainCard wrapPd=" 0 30rpx" pd="0">
<JInput name="门店地址" :isBorder="true">
<view @tap="getAddress" class="place-text address" v-if="!storeInfo.address"
>请选择位置 <view class="gps-img"> <image src="/static/iconImg/icon-gps.svg" mode="scaleToFill" /></view
></view>
<view @tap="getAddress" v-else class="place-text address" style="color: #000"
>{{ storeInfo.address }}
<view class="gps-img"> <image src="/static/iconImg/icon-gps.svg" mode="scaleToFill" /></view>
</view>
</JInput>
</JMainCard>
<JMainCard pd="0" wrapPd="30rpx">
<JInput name="省市区">
<uni-data-picker
:localdata="address"
@change="dataPickerChange($event, 'areaCode')"
v-slot:default="{ data, error, options }"
>
<view class="place-text" v-if="storeInfo.areaCode.length == 0"
>请选择省市区
<image src="/static/iconImg/icon-right-jiantou.svg" mode="scaleToFill" />
</view>
<view v-else style="font-size: 33rpx">{{ storeInfo.addressInfo || "请选择省市区" }}</view>
</uni-data-picker>
</JInput>
<JInput name="经纬度">
<view class="place-text" v-if="!storeInfo.lng">选择位置后自动生成</view>
<view style="font-size: 33rpx" v-else>{{ storeInfo.lng }},{{ storeInfo.lat }}</view>
</JInput>
</JMainCard>
<JButton pd="0 30rpx 50rpx" pdTop="0" @HandleTouch="saveStore">{{
storeInfo.storeId ? "保存" : "创建门店"
}}</JButton>
</view>
</template>
<script setup>
import { ref } from "vue"
import { onShow, onLoad } from "@dcloudio/uni-app"
import { $addMchStore, $updateMchStore, $storeDetails, $mapKey } from "@/http/apiManager.js"
import tool from "@/util/tool.js" // 工具类函数
import JHeaderTitle from "@/components/newComponents/JHeaderTitle/JHeaderTitle.vue" //自定义导航栏
import JInput from "@/components/newComponents/JInput/JInput.vue"
import JButton from "@/components/newComponents/JButton/JButton.vue" //自定义按钮
import JMainCard from "@/components/newComponents/JMainCard/JMainCard.vue"
import JUpLoad from "@/components/newComponents/JUpLoad/JUpLoad.vue"
import address from "@/components/applyJson/address.json" // 地址
import { getMapKey } from "@/hooks/mapInfo.js"
import useStore from "@/hooks/useStore.js"
import { validateArray } from "@/hooks/rules"
const { getStore, clearItem } = useStore()
onLoad((options) => {
if (options.id) return getStoreInf(options.id)
})
onShow(() => {
if (getStore("mch")?.mchNo) {
mchInfo.value = getStore("mch")
storeInfo.value.mchNo = getStore("mch").mchNo
clearItem("mch")
}
})
const title = ref("创建门店")
const mchInfo = ref({})
const storeInfo = ref({
state: 1,
areaCode: [],
addressInfo: "", //只做数据回显使用非必传值
})
const switchState = (e, v) => {
agentInfo[v] = e.detail.value ? 1 : 0
}
const dataPickerChange = (e, name) => {
storeInfo.value.addressInfo = ""
storeInfo.value.areaCode = []
e.detail.value.forEach((v, i) => {
storeInfo.value.areaCode.push(v.value)
storeInfo.value.addressInfo += i == e.detail.value.length - 1 ? v.text : v.text + "/"
})
const address = storeInfo.value.addressInfo.split("/").join("")
getMapKey(address, 1).then((res) => {
storeInfo.value.lng = parseFloat(res.lon).toFixed(6)
storeInfo.value.lat = parseFloat(res.lat).toFixed(6)
storeInfo.value.address = address
})
}
function getAddress() {
uni.chooseLocation({
latitude: storeInfo.value.lat || undefined,
longitude: storeInfo.value.lng || undefined,
success: (res) => {
storeInfo.value.lng = res.longitude.toFixed(6)
storeInfo.value.lat = res.latitude.toFixed(6)
storeInfo.value.location = res.longitude + "/" + res.latitude
storeInfo.value.address = res.address
getMapKey(res.address, 0).then((res) => {
storeInfo.value.addressInfo = res.text
storeInfo.value.areaCode = res.code
})
},
fail: (err) => {
console.log(err, "error")
},
})
}
const saveStore = () => {
if (validateArray(storeInfo.value)) {
if (!storeInfo.value.addressInfo) {
uni.showToast({ title: "请选省市区", icon: "error" })
return
} else {
if (!storeInfo.value.storeId) {
$addMchStore(storeInfo.value).then(() => {
uni.showToast({
title: "新增成功",
})
uni.navigateBack()
})
} else {
$updateMchStore(storeInfo.value.storeId, storeInfo.value).then(() => {
uni.showToast({
title: "修改成功",
})
uni.navigateBack()
})
}
}
}
}
// 请求门店详情
const getStoreInf = (val) => {
$storeDetails(val).then(({ bizData }) => {
storeInfo.value = bizData
storeInfo.value.addressInfo = tool.addressBack(storeInfo.value.areaCode, address)
})
}
// 跳转到通用选择页面
const jumpPage = (val) => {
uni.navigateTo({
url: `/pageWork/SelectedList/SelectedList?title=${val}&selected=${storeInfo.value.mchNo}`,
})
}
</script>
<style lang="scss" scoped>
.page-wrapper {
.select-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
.select-mch {
margin: 20rpx;
}
.mch-info {
display: flex;
image {
width: 93rpx;
height: 93rpx;
margin-right: 10rpx;
}
view {
display: flex;
flex-direction: column;
font-size: 33rpx;
font-weight: 700;
text {
margin-top: 15rpx;
color: #8c8c8c;
font-size: 25rpx;
font-weight: 500;
}
}
}
image {
width: 40rpx;
height: 40rpx;
}
.img-wrapper {
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
width: 93rpx;
height: 93rpx;
margin-right: 20rpx;
image {
width: 60rpx;
height: 66rpx;
}
}
}
.place-text {
font-size: 33rpx;
color: #a6a6a6;
image {
width: 40rpx;
height: 40rpx;
}
}
}
.address {
align-self: flex-start;
display: flex;
justify-content: flex-end;
align-items: center;
.gps-img {
align-self: flex-start;
display: flex;
justify-content: center;
align-items: center;
width: 50rpx;
height: 100%;
}
}
</style>

View File

@@ -0,0 +1,266 @@
<template>
<view class="page-wrapper">
<JHeaderTitle title="门店详情" :bgColor="headerBgColor" color="#fff" imgUrl="/static/iconImg/left-white.svg" />
<image src="/static/iconImg/store-bg-img.svg" class="bg-image" mode="scaleToFill" />
<view class="expand-header">
<image src="/static/iconImg/icon-store-img.svg" mode="scaleToFill" />
<view class="expand-title">{{ storeInfo.storeName }}</view>
<view class="expand-phone">{{ storeInfo.storeId }}</view>
<view class="expand-edit bgF bdR10" @tap="editStore">
<image src="/static/iconImg/expand-edit.svg" mode="scaleToFill" />
编辑信息
</view>
</view>
<JMainCard pd="0" wrapPd="0 50rpx" bgColor="rgba(0,0,0,0.1)">
<JUpLoad
name="门店logo"
pdLeft="0"
pd="40rpx"
:imgUrl="storeInfo.storeLogo || imgUrl"
borderNone
textColor="rgba(255,255,255,0.6)"
/>
<JInput name="门店名称" pd="0 40rpx 40rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ storeInfo.storeName }}</text></JInput
>
<JInput name="门店ID" pd="0 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ storeInfo.storeId }}</text></JInput
>
<JInput name="所属商户" pd="40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ storeInfo.mchName }}</text></JInput
>
<JInput name="用户号" pd="0 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ storeInfo.mchNo }}</text></JInput
>
<JInput name="联系人手机号" pd="40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ storeInfo.contactPhone }}</text></JInput
>
<JInput name="门店地址" pd="0 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ storeInfo.address }}</text></JInput
>
<JInput name="经纬度" pd="40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ storeInfo.lng }}/{{ storeInfo.lat }}</text></JInput
>
<JUpLoad
name="门头照"
pd="0 40rpx"
pdLeft="0"
:imgUrl="storeInfo.storeOuterImg || imgUrl"
borderNone
textColor="rgba(255,255,255,0.6)"
/>
<JUpLoad
name="门店内景照"
pd="40rpx"
pdLeft="0"
:imgUrl="storeInfo.storeInnerImg || imgUrl"
borderNone
textColor="rgba(255,255,255,0.6)"
/>
<JInput name="创建时间" pd="0 40rpx 40rpx 40rpx" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<text class="right-color">{{ storeInfo.createdAt?.split("-").join("/") }}</text></JInput
>
</JMainCard>
<JMainCard pd="0" wrapPd="30rpx 50rpx 0 50rpx" bgColor="rgba(0,0,0,0.1)">
<JInput name="是否默认门店" textColor="rgba(255,255,255,0.6)" :isBorder="true">
<view class="tips" v-if="storeInfo.defaultFlag == 1"
><text
class="tips-color"
:style="{ backgroundColor: storeInfo.defaultFlag == 1 ? '#FFCA80' : 'rgba(255, 255, 255, 0.3)' }"
></text
></view>
<view v-else>
<switch
:checked="storeInfo.defaultFlag"
style="margin-left: 20rpx; transform: scale(1.2)"
color="#BF80FF"
@change="change"
/>
</view>
</JInput>
</JMainCard>
<JButton color="#FF4D6A" bgColor="rgba(255,255,255,0.85)" size="max" pdTop="0" @HandleTouch="deletedTips.open()"
>删除门店</JButton
>
</view>
<JDeletedTips ref="deletedTips" @confirm="deleted" />
<JDeletedTips ref="switchState" @confirm="confirm" @cancel="cancel" />
<!-- 更改状态对话框 -->
</template>
<script setup>
import { nextTick, ref } from "vue"
import { onLoad, onShow, onPageScroll } from "@dcloudio/uni-app"
import { $storeDetails, $delStore, $updateMchStore } from "@/http/apiManager.js"
import { formatData } from "@/hooks/formatData"
import JHeaderTitle from "@/components/newComponents/JHeaderTitle/JHeaderTitle"
import JMainCard from "@/components/newComponents/JMainCard/JMainCard"
import JInput from "@/components/newComponents/JInput/JInput"
import JButton from "@/components/newComponents/JButton/JButton"
import JUpLoad from "@/components/newComponents/JUpLoad/JUpLoad"
import JDeletedTips from "@/components/newComponents/JDeletedTips/JDeletedTips"
onLoad((option) => {
storeId = option?.id || storeId
})
onShow(() => {
getStoreInfo(storeId)
})
let storeId = undefined
const storeInfo = ref({})
const switchState = ref(null)
const imgUrl = ref("/static/iconImg/defaultImg.svg")
const deletedTips = ref(null)
const deleted = () => {
$delStore(storeInfo.value.storeId).then((res) => {
uni.showToast({
title: "删除成功",
icon: "success",
})
uni.navigateBack()
})
}
const getStoreInfo = (val) => {
$storeDetails(val).then(({ bizData }) => {
formatData(bizData)
storeInfo.value = bizData
})
}
let flag = undefined
const change = (e) => {
flag = true
storeInfo.value.defaultFlag = Number(e.detail.value)
switchState.value.open("是否修改门店为默认门店?")
}
const confirm = () => {
flag = false
$updateMchStore(storeInfo.value.storeId, { defaultFlag: storeInfo.value.defaultFlag }).then((res) => {
uni.showToast({
title: "修改成功",
icon: "none",
})
})
}
const cancel = () => {
if (!flag) return
storeInfo.value.defaultFlag = Number(!storeInfo.value.defaultFlag)
}
const editStore = () => {
uni.navigateTo({
url: "./addOrEditStore?id=" + storeInfo.value.storeId,
})
}
const headerBgColor = ref("transparent")
onPageScroll((data) => {
if (data.scrollTop > 20) {
headerBgColor.value = "$primaryColor"
} else {
headerBgColor.value = "transparent"
}
})
</script>
<style lang="scss" scoped>
.page-wrapper {
position: relative;
width: 100%;
min-height: 100%;
background-color: $primaryColor;
text {
color: #fff;
font-weight: 400;
}
.bg-image {
position: absolute;
top: -40rpx;
right: 0;
width: 100%;
height: 650rpx;
}
.expand-header {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50rpx;
image {
width: 93rpx;
height: 93rpx;
}
.expand-title {
margin-top: 20rpx;
font-size: 33rpx;
font-weight: 700;
color: #fff;
}
.expand-phone {
margin: 30rpx 0;
color: rgba(255, 255, 255, 0.6);
font-size: 25rpx;
}
.expand-edit {
position: relative;
z-index: 40;
padding: 20rpx 41rpx;
margin-bottom: 48rpx;
font-size: 28rpx;
color: $primaryColor;
image {
width: 26.25rpx;
height: 26.25rpx;
}
}
}
.right-color {
color: #fff;
font-size: 30rpx;
}
.page-title {
margin: 50rpx 0 30rpx 0;
text-align: center;
font-size: 33rpx;
color: #fff;
}
.mch-info {
border-top: 1rpx solid rgba(0, 0, 0, 0.1);
padding: 60rpx;
view {
display: flex;
flex-direction: column;
}
text {
margin-bottom: 20rpx;
color: rgba(255, 255, 255, 0.6);
font-size: 25rpx;
font-weight: 500;
}
.mch-many {
color: #fff;
font-size: 56rpx;
font-weight: 700;
}
.mch-footer {
display: flex;
flex-direction: row;
margin-top: 50rpx;
view {
flex: 1;
font-size: 33rpx;
font-weight: 700;
color: #fff;
}
}
}
}
.tips {
color: #fff;
.tips-color {
display: inline-block;
width: 35rpx;
height: 35rpx;
margin-left: 10rpx;
vertical-align: middle;
border-radius: 50%;
}
}
</style>

View File

@@ -0,0 +1,92 @@
<template>
<view class="store-wrapper global-wrapper bgF2">
<view class="mch-header">
<JHeaderTitle title="门店管理" bgColor="#f2f2f2" />
<JSearchInput @search="searchList" @resetSearch="searchList" ref="search" place="搜索门店名称、ID">
</JSearchInput>
</view>
<block v-for="v in useDataResult.dataList" :key="v.agentNo">
<JPreview
:title="v.storeName"
:qrcId="v.storeId"
:img="imgList[1]"
:isLast="useDataResult.dataList.length - 1 == i"
@tap="toStoreDetails(v.storeId)"
></JPreview>
</block>
<jeepayListNull :isShow="true" :list="useDataResult.dataList.length" />
<view class="button-block"></view>
<view class="mch-footers ButtonBor">
<JButton pd="30rpx 30rpx 50rpx 30rpx" pdTop="0" @HandleTouch="addOrEditStore">创建门店</JButton>
</view>
</view>
</template>
<script setup>
import { ref, reactive, watch, onMounted } from "vue"
import { onBackPress, onShow } from "@dcloudio/uni-app"
import { $getMchStoreList } from "@/http/apiManager.js"
import useGetList from "@/hooks/useList.js"
import JHeaderTitle from "@/components/newComponents/JHeaderTitle/JHeaderTitle.vue" //自定义导航栏
import JSearchInput from "@/components/newComponents/JSearchInput/JSearchInput.vue" //自定义搜索框
import JButton from "@/components/newComponents/JButton/JButton.vue" //自定义按钮
import JPreview from "@/components/newComponents/JPreview/JPreview.vue" //列表展示
import jeepayListNull from "@/components/jeepayListNull/jeepayListNull" //最后一条数据提示
const { useDataResult, getList } = useGetList({
requestFun: $getMchStoreList,
})
// 图片列表
const imgList = reactive(["/static/navImg/disable-mendian.svg", "/static/navImg/nav-mendian.svg"])
// 返回前清除搜索数据
const search = ref()
onBackPress(() => {
if (search.value.searchText != "") {
search.value.searchText = ""
list(search.value.searchText)
return true
} else {
return false
}
})
// 搜索回调
const searchList = (data) => {
if (data === "reset") data = ""
getList({ unionStoreInfo: data })
}
const addOrEditStore = () => {
uni.navigateTo({
url: "./addOrEditStore",
})
}
const toStoreDetails = (storeId) => {
uni.navigateTo({
url: "./storeDetails?id=" + storeId,
})
}
</script>
<style lang="scss" scoped>
.store-wrapper {
.mch-header {
position: sticky;
top: 0;
z-index: 100;
background-color: #f2f2f2;
}
.button-block {
height: 210rpx;
}
.mch-footers {
position: fixed;
left: 0;
right: 0;
bottom: 0;
backdrop-filter: blur(30px);
border-top: 1px solid rgba($color: #000000, $alpha: 0.1);
}
}
</style>