This commit is contained in:
2023-10-10 14:10:32 +08:00
parent e36d60d015
commit 2f788956c6
8 changed files with 1597 additions and 1509 deletions

View File

@@ -36,9 +36,9 @@
], ],
"author": "", "author": "",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.22.15", "@babel/runtime": "^7.23.1",
"@nutui/icons-vue-taro": "^0.0.9", "@nutui/icons-vue-taro": "^0.0.9",
"@nutui/nutui-taro": "^4.1.5", "@nutui/nutui-taro": "^4.1.6",
"@qiun/vue-ucharts": "2.5.0-20230101", "@qiun/vue-ucharts": "2.5.0-20230101",
"@tarojs/components": "3.6.16", "@tarojs/components": "3.6.16",
"@tarojs/helper": "3.6.16", "@tarojs/helper": "3.6.16",
@@ -54,24 +54,24 @@
"@tarojs/runtime": "3.6.16", "@tarojs/runtime": "3.6.16",
"@tarojs/shared": "3.6.16", "@tarojs/shared": "3.6.16",
"@tarojs/taro": "3.6.16", "@tarojs/taro": "3.6.16",
"dayjs": "^1.11.9", "dayjs": "^1.11.10",
"pinia": "^2.1.6", "pinia": "^2.1.6",
"vue": "^3.3.4" "vue": "^3.3.4"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.17", "@babel/core": "^7.23.0",
"@tarojs/cli": "3.6.16", "@tarojs/cli": "3.6.16",
"@tarojs/taro-loader": "3.6.16", "@tarojs/taro-loader": "3.6.16",
"@tarojs/webpack5-runner": "3.6.16", "@tarojs/webpack5-runner": "3.6.16",
"@types/node": "^18.17.15", "@types/node": "^18.18.4",
"@types/webpack-env": "^1.18.1", "@types/webpack-env": "^1.18.2",
"@typescript-eslint/eslint-plugin": "^6.7.0", "@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.0", "@typescript-eslint/parser": "^6.7.4",
"@vue/babel-plugin-jsx": "^1.1.5", "@vue/babel-plugin-jsx": "^1.1.5",
"@vue/compiler-sfc": "^3.3.4", "@vue/compiler-sfc": "^3.3.4",
"babel-preset-taro": "3.6.16", "babel-preset-taro": "3.6.16",
"css-loader": "3.4.2", "css-loader": "3.4.2",
"eslint": "^8.49.0", "eslint": "^8.51.0",
"eslint-config-taro": "3.6.16", "eslint-config-taro": "3.6.16",
"eslint-plugin-vue": "^9.17.0", "eslint-plugin-vue": "^9.17.0",
"style-loader": "1.3.0", "style-loader": "1.3.0",
@@ -79,7 +79,7 @@
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"unplugin-vue-components": "^0.23.0", "unplugin-vue-components": "^0.23.0",
"vue-loader": "^17.2.2", "vue-loader": "^17.3.0",
"webpack": "^5.88.2" "webpack": "^5.88.2"
} }
} }

2711
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,81 +1,81 @@
export default defineAppConfig({ export default defineAppConfig({
pages: [ pages: [
"pages/index/index", 'pages/index/index',
"pages/category/index", 'pages/category/index',
"pages/cart/index", 'pages/cart/index',
"pages/user/index", 'pages/user/index'
], ],
subPackages: [ subPackages: [
{ {
root: "pages/users", root: 'pages/users',
pages: [ pages: [
"order_list/index", 'order_list/index',
"setting/index", 'setting/index',
"user_setting/index", 'user_setting/index',
"settled_mer/index", 'settled_mer/index',
"order_list_detail/index", 'order_list_detail/index',
"account/index", 'account/index',
"distribution/index", 'distribution/index',
"distribution/integral/index", 'distribution/integral/index',
"distribution/userlist/index", 'distribution/userlist/index',
"login/index", 'login/index',
"bindPhone/index", 'bindPhone/index'
], ]
}, },
{ {
root: "pages/goods", root: 'pages/goods',
pages: [ pages: [
"goods_detail/index", 'goods_detail/index',
"order_create/index", 'order_create/index',
"order_status/index", 'order_status/index'
], ]
}, },
{ {
root: "pages/admin", root: 'pages/admin',
pages: [ pages: [
"verify/index", 'verify/index',
"order_manage/index", 'order_manage/index',
"order_manage/list/index", 'order_manage/list/index',
"order_manage/detail/index", 'order_manage/detail/index',
"verify/verify_list/index", 'verify/verify_list/index',
"statistics/index", 'statistics/index',
"withdrawal/index", 'withdrawal/index'
], ]
}, },
{ {
root: "pages/product", root: 'pages/product',
pages: ["list/index", "addGoods/index"], pages: ['list/index', 'addGoods/index']
}, },
{ {
root: "pages/game", root: 'pages/game',
pages: ["gamehome/index", "gamedetail/index", "gameview/index"], pages: ['gamehome/index', 'gamedetail/index', 'gameview/index']
}, },
{ {
root: "pages/hotGoods", root: 'pages/hotGoods',
pages: ["index/index", "hot_list/index"], pages: ['index/index', 'hot_list/index']
}, },
{ {
root: "pages/mer", root: 'pages/mer',
pages: ["mer_detail/index"], pages: ['mer_detail/index']
}, }
], ],
window: { window: {
backgroundTextStyle: "light", backgroundTextStyle: 'light',
navigationBarBackgroundColor: "#fff", navigationBarBackgroundColor: '#fff',
navigationBarTitleText: "WeChat", navigationBarTitleText: 'WeChat',
navigationBarTextStyle: "black", navigationBarTextStyle: 'black'
}, },
tabBar: { tabBar: {
color: "#666666", color: '#666666',
selectedColor: "#ff0000", selectedColor: '#ff0000',
backgroundColor: "#ffffff", backgroundColor: '#ffffff',
borderStyle: "white", borderStyle: 'white',
list: [ list: [
{ {
pagePath: "pages/index/index", pagePath: 'pages/index/index',
iconPath: "static/tabbar/1-001.png", iconPath: 'static/tabbar/1-001.png',
selectedIconPath: "static/tabbar/1-002.png", selectedIconPath: 'static/tabbar/1-002.png',
text: "首页", text: '首页'
}, },
// { // {
// pagePath: "pages/category/index", // pagePath: "pages/category/index",
@@ -90,20 +90,20 @@ export default defineAppConfig({
// text: "购物车", // text: "购物车",
// }, // },
{ {
pagePath: "pages/user/index", pagePath: 'pages/user/index',
iconPath: "static/tabbar/4-001.png", iconPath: 'static/tabbar/4-001.png',
selectedIconPath: "static/tabbar/4-002.png", selectedIconPath: 'static/tabbar/4-002.png',
text: "我的", text: '我的'
}, }
], ]
}, },
permission: { permission: {
"scope.userLocation": { 'scope.userLocation': {
desc: "你的位置信息将用于小程序位置接口的效果展示", desc: '你的位置信息将用于小程序位置接口的效果展示'
}
}, },
}, requiredBackgroundModes: ['audio', 'location'],
requiredBackgroundModes: ["audio", "location"],
// @ts-ignore // @ts-ignore
requiredPrivateInfos: ["getLocation"], requiredPrivateInfos: ['getLocation'],
lazyCodeLoading: "requiredComponents", lazyCodeLoading: 'requiredComponents'
}); });

View File

@@ -6,7 +6,7 @@
:headers="config.headers" :headers="config.headers"
@success="success" @success="success"
@failure="failure" @failure="failure"
:multiple="false" :multiple="multiple"
> >
</nut-uploader> </nut-uploader>
</template> </template>
@@ -24,22 +24,26 @@ const props = defineProps({
max: { max: {
type: Number, type: Number,
default: 1 default: 1
},
multiple: {
type: Boolean,
default: false
} }
}) });
const emits = defineEmits(['update:list']) const emits = defineEmits(['update:list'])
const fileList = computed({ const fileList = computed({
get: () => props.list, get: () => props.list,
set: (val) => emits('update:list', val) set: (val) => emits('update:list', val)
}) });
const config = ref({ const config = ref({
url: `${BASE_URL}/upload`, url: `${BASE_URL}/upload`,
headers: { headers: {
token: Taro.getStorageSync('token') token: Taro.getStorageSync('token')
} },
}) });
const success = (res: any) => { const success = (res: any) => {
const data = JSON.parse(res.responseText.data) const data = JSON.parse(res.responseText.data)
@@ -47,15 +51,15 @@ const success = (res: any) => {
Taro.showToast({ Taro.showToast({
title: '上传成功', title: '上传成功',
icon: 'success' icon: 'success'
}) });
} };
const failure = () => { const failure = () => {
Taro.showToast({ Taro.showToast({
title: '上传失败', title: '上传失败',
icon: 'error' icon: 'error'
}) });
} };
</script> </script>
<style lang="scss"></style> <style lang="scss"></style>

View File

@@ -125,11 +125,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro'
import { Find, Locationg3 } from "@nutui/icons-vue-taro"; import {Find, Locationg3} from '@nutui/icons-vue-taro'
import { ref } from "vue"; import {ref} from 'vue'
import { calculateDistance } from "../../../utils"; import {calculateDistance} from '../../../utils'
import { getMerCategory, getGoodList } from "../../../api/goods"; import {getGoodList, getMerCategory} from '../../../api/goods'
const swiperList = ref([]); const swiperList = ref([]);
@@ -160,7 +160,7 @@ Taro.useLoad(() => {
const clickPhone = () => { const clickPhone = () => {
Taro.makePhoneCall({ Taro.makePhoneCall({
phoneNumber: mer_info.value.phone, phoneNumber: mer_info.value.mobile
}); });
}; };

View File

@@ -1,9 +0,0 @@
const obj = {
a: 1,
b: 3,
c: 10,
};
Object.keys(obj).forEach((item, index) => {
console.log(obj[item]);
});

View File

@@ -12,6 +12,9 @@
<view class="dot"></view> <view class="dot"></view>
</view> </view>
</view> </view>
<view v-if="goodInfo.status === 1" class="timeBox">
订单剩余{{ timeStr }}过期,请尽快核销
</view>
<!-- 商家信息 --> <!-- 商家信息 -->
<view class="mer-info"> <view class="mer-info">
<view class="left"> <view class="left">
@@ -27,11 +30,11 @@
</view> </view>
<view class="right"> <view class="right">
<view class="icon" @click="toPhone"> <view class="icon" @click="toPhone">
<Service /> <Service/>
<text>电话</text> <text>电话</text>
</view> </view>
<view class="icon" @click="toAdder"> <view class="icon" @click="toAdder">
<Find /> <Find/>
<text>导航</text> <text>导航</text>
</view> </view>
</view> </view>
@@ -43,7 +46,7 @@
<nut-cell> <nut-cell>
<template #default> <template #default>
<view class="top"> <view class="top">
<image :src="goodInfo.BindGoods?.cover" /> <image :src="goodInfo.BindGoods?.cover"/>
<view class="title" <view class="title"
>{{ goodInfo.BindGoods?.name }} >{{ goodInfo.BindGoods?.name }}
</view> </view>
@@ -86,7 +89,9 @@
<template #default> <template #default>
<view style="text-align: right; width: 100%"> <view style="text-align: right; width: 100%">
<view <view
>实付款({{ type === "1" ? "元" : "积分" }}): >{{
goodInfo.status === 0 ? '应付款' : '实付款'
}}({{ type === '1' ? '元' : '积分' }}):
<nut-price <nut-price
:price="goodInfo.number" :price="goodInfo.number"
size="normal" size="normal"
@@ -148,96 +153,123 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { import Taro from '@tarojs/taro'
useLoad, import {Find, Service} from '@nutui/icons-vue-taro'
getStorageSync, import {ref} from 'vue'
makePhoneCall, import dayjs from 'dayjs'
openLocation, import duration from 'dayjs/plugin/duration'
showToast, import Pay from '@/components/Pay.vue'
} from "@tarojs/taro";
import { Service, Find } from "@nutui/icons-vue-taro";
import { ref } from "vue";
import dayjs from "dayjs";
const goodInfo = ref<any>({}); dayjs.extend(duration)
const goodInfo = ref<any>({})
const statusList = ref([ const statusList = ref([
{ {
id: 0, id: 0,
text: "待付款", text: '待付款'
}, },
{ {
id: 1, id: 1,
text: "待使用", text: '待使用'
}, },
{ {
id: 2, id: 2,
text: "已使用", text: '已使用'
}, },
{ {
id: 3, id: 3,
text: "已失效", text: '已失效'
}, }
]); ])
const isShowCode = ref(false); const isShowCode = ref(false)
const isShowPay = ref(false); const isShowPay = ref(false)
const jfInfo = ref<any>({}); const jfInfo = ref<any>({})
const type = ref(""); const type = ref('')
const url = ref(""); const url = ref('')
useLoad((options) => { Taro.useLoad((options) => {
type.value = options.type; type.value = options.type
goodInfo.value = getStorageSync("item"); goodInfo.value = Taro.getStorageSync('item')
}); if (goodInfo.value.status === 1) {
startTime()
}
})
const toPhone = () => { const toPhone = () => {
makePhoneCall({ Taro.makePhoneCall({
phoneNumber: goodInfo.value.BindStore.phone, phoneNumber: goodInfo.value.BindStore.mobile
}); })
}; }
const toAdder = () => { const toAdder = () => {
openLocation({ Taro.openLocation({
latitude: Number(goodInfo.value.BindStore.lat), latitude: Number(goodInfo.value.BindStore.lat),
longitude: Number(goodInfo.value.BindStore.lon), longitude: Number(goodInfo.value.BindStore.lon),
scale: 18, scale: 18
}); })
}; }
const openPay = () => { const openPay = () => {
isShowPay.value = true; isShowPay.value = true
jfInfo.value = getStorageSync("item"); jfInfo.value = Taro.getStorageSync('item')
}; }
const errPay = () => { const errPay = () => {
isShowPay.value = false; isShowPay.value = false
showToast({ Taro.showToast({
title: "支付失败", title: '支付失败',
icon: "none", icon: 'none'
}); })
jfInfo.value = {}; jfInfo.value = {}
}; }
const closePay = () => { const closePay = () => {
isShowPay.value = false; isShowPay.value = false
showToast({ Taro.showToast({
title: "支付取消", title: '支付取消',
icon: "none", icon: 'none'
}); })
jfInfo.value = {}; jfInfo.value = {}
}; }
const openCode = () => { const openCode = () => {
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`; url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`
isShowCode.value = true; isShowCode.value = true
}; }
const closed = () => { const closed = () => {
isShowCode.value = false; isShowCode.value = false
url.value = ""; url.value = ''
}; }
let timeId: any
const timeStr = ref('????')
const startTime = () => {
const nowTime = dayjs()
const endTime = dayjs(goodInfo.value.expires * 1000)
// 计算剩余时间的持续时间对象
const duration = dayjs.duration(endTime.diff(nowTime))
// 格式化剩余时间
timeStr.value = duration.format('D天H小时m分钟s秒')
if (goodInfo.value.expires - dayjs().unix() > 0) {
clearInterval(timeId)
timeId = setTimeout(() => {
startTime()
}, 1000)
}
}
Taro.useUnload(() => {
clearTimeout(timeId)
})
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -248,6 +280,13 @@ page {
position: relative; position: relative;
} }
.timeBox {
text-align: center;
font-weight: bold;
font-size: 30px;
padding: 30px;
}
.step-bar { .step-bar {
width: 100%; width: 100%;
height: 100px; height: 100px;

View File

@@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro'
import { ref } from "vue"; import {ref} from 'vue'
import { getVerifyCode, applyMer, getMerTypeList } from "@/api/user"; import {applyMer, getMerTypeList, getVerifyCode} from '@/api/user'
import Upload from "@/components/Upload.vue"; import Upload from '@/components/Upload.vue'
const visible = ref(false); const visible = ref(false);
@@ -91,7 +91,7 @@ const onOk = async () => {
icon: "none", icon: "none",
}); });
setTimeout(() => { setTimeout(() => {
Taro.redirectTo({ Taro.switchTab({
url: "/pages/index/index", url: "/pages/index/index",
}); });
}, 3000); }, 3000);
@@ -222,6 +222,25 @@ const submit = () => {
placeholder="请输入联系电话" placeholder="请输入联系电话"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item
:rules="[
{
required: true,
message: '请输入正确的店铺号码',
regex: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
},
]"
label="店铺号码"
prop="phone"
required
>
<input
v-model="formValue.mobile"
:maxlength="11"
placeholder="请输入店铺号码"
type="text"
/>
</nut-form-item>
<nut-form-item <nut-form-item
required required
label="验证码" label="验证码"
@@ -470,7 +489,7 @@ const submit = () => {
}, },
]" ]"
> >
<Upload v-model:list="formValue.img" :max="5" /> <Upload v-model:list="formValue.img" :max="5" multiple/>
</nut-form-item> </nut-form-item>
<view class="btn"> <view class="btn">