Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
groupPurchase-miniapp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭佳妮(贵阳日报)
groupPurchase-miniapp
Commits
504a8ec6
Commit
504a8ec6
authored
Aug 09, 2024
by
刘玉宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
列表
parent
2d193102
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
125 additions
and
123 deletions
+125
-123
address.js
src/api/address.js
+6
-11
manifest.json
src/manifest.json
+50
-42
addressEdit.vue
src/pages/address/addressEdit.vue
+68
-69
index.vue
src/pages/storeEntry/index.vue
+1
-1
yarn.lock
yarn.lock
+0
-0
No files found.
src/api/address.js
View file @
504a8ec6
import
{
request
}
from
'../utils/request'
;
export
function
groupBuyList
()
{
return
request
({
url
:
'/sgyrdd/category/groupBuyList'
,
method
:
'GET'
,
});
}
// 新增收货地址
export
async
function
addAddress
()
{
export
async
function
addAddress
(
data
)
{
return
request
({
url
:
'/sgyrdd/useraddr/add'
,
method
:
'GET'
,
method
:
'post'
,
data
,
});
}
// 修改收货地址
export
async
function
updateAddress
()
{
export
async
function
updateAddress
(
data
)
{
return
request
({
url
:
'/sgyrdd/useraddr/update'
,
method
:
'GET'
,
method
:
'post'
,
data
,
});
}
// 删除收货地址
...
...
src/manifest.json
View file @
504a8ec6
{
"name"
:
""
,
"appid"
:
""
,
"description"
:
""
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
"name"
:
""
,
"appid"
:
""
,
"description"
:
""
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
/*
5
+App特有相关
*/
"app-plus"
:
{
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
"compilerVersion"
:
3
,
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
true
,
"waiting"
:
true
,
"autoclose"
:
true
,
"delay"
:
0
"app-plus"
:
{
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
"compilerVersion"
:
3
,
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
true
,
"waiting"
:
true
,
"autoclose"
:
true
,
"delay"
:
0
},
/*
模块配置
*/
"modules"
:
{},
"modules"
:
{},
/*
应用发布信息
*/
"distribute"
:
{
"distribute"
:
{
/*
android打包配置
*/
"android"
:
{
"permissions"
:
[
"android"
:
{
"permissions"
:
[
"<uses-permission android:name=
\"
android.permission.CHANGE_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
...
...
@@ -41,43 +41,50 @@
]
},
/*
ios打包配置
*/
"ios"
:
{},
"ios"
:
{},
/*
SDK配置
*/
"sdkConfigs"
:
{}
"sdkConfigs"
:
{}
}
},
/*
快应用特有相关
*/
"quickapp"
:
{},
"quickapp"
:
{},
/*
小程序特有相关
*/
"mp-weixin"
:
{
"appid"
:
""
,
"setting"
:
{
"urlCheck"
:
false
"mp-weixin"
:
{
"appid"
:
""
,
"setting"
:
{
"urlCheck"
:
false
},
"usingComponents"
:
true
"usingComponents"
:
true
},
"mp-alipay"
:
{
"usingComponents"
:
true
"mp-alipay"
:
{
"usingComponents"
:
true
},
"mp-baidu"
:
{
"usingComponents"
:
true
"mp-baidu"
:
{
"usingComponents"
:
true
},
"mp-toutiao"
:
{
"usingComponents"
:
true
"mp-toutiao"
:
{
"usingComponents"
:
true
},
"uniStatistics"
:
{
"enable"
:
false
},
"vueVersion"
:
"3"
,
"h5"
:
{
"router"
:
{
"base"
:
"./"
,
"mode"
:
"hash"
"vueVersion"
:
"3"
,
"h5"
:
{
"router"
:
{
"base"
:
"./"
,
"mode"
:
"hash"
},
"optimization"
:
{
"treeShaking"
:
{
"enable"
:
true
"optimization"
:
{
"treeShaking"
:
{
"enable"
:
true
}
},
"sdkConfigs"
:
{
"maps"
:
{
"qqmap"
:
{
"key"
:
"MN4BZ-7JXKW-2RYRD-32QGF-AHONV-PAFUN"
}
}
}
}
}
}
\ No newline at end of file
src/pages/address/addressEdit.vue
View file @
504a8ec6
...
...
@@ -3,13 +3,13 @@
<Header
:title=
"newAddressFlag ? '新增收货地址' : '编辑收货地址'"
></Header>
<view
class=
"content"
>
<wd-form
ref=
"
form"
:model=
"model
"
id=
"form"
>
<wd-form
ref=
"
reForm"
:model=
"forMData
"
id=
"form"
>
<wd-cell-group>
<wd-input
label=
"联系人"
label-width=
"80px"
prop=
"receiver"
v-model=
"
model
.receiver"
v-model=
"
forMData
.receiver"
placeholder=
"请输入联系人姓名"
:rules=
"[
{ required: false, validator: fieldNotEmpty, message: '姓名不能为空' }]"
/>
...
...
@@ -17,43 +17,36 @@
label=
"手机号"
label-width=
"80px"
prop=
"mobile"
v-model=
"
model
.mobile"
v-model=
"
forMData
.mobile"
placeholder=
"请输入联系人手机号"
:rules=
"[
{ required: false, pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' }]"
/>
<wd-cell
title=
"所在地区"
title-width=
"80px"
>
<view
class=
"area"
>
<view
class=
"area_l"
>
<view
class=
"area_lt"
>
当前定位
</view>
<view
class=
"area_lb"
>
{{
forMData
.
city
}}
</view>
</view>
<view
class=
"area_r"
>
<wd-icon
name=
"location"
size=
"22px"
@
tap=
"changeLocation"
/>
</view>
</view>
</wd-cell>
<wd-input
label=
"详细地址"
label-width=
"80px"
prop=
"addr"
v-model=
"
model
.addr"
v-model=
"
forMData
.addr"
placeholder=
"请输入详细地址"
:rules=
"[
{ required: false, validator: fieldNotEmpty, message: '详细地址不能为空' }]"
/>
<wd-checkbox-group>
<wd-cell
title=
"所在地区"
title-width=
"80px"
>
<view
class=
"area"
>
<view
class=
"area_l"
@
tap=
"changeLocation"
>
<view
class=
"area_lt"
>
这是当前定位
</view>
<view
class=
"area_lb"
>
这是定位的详细地址点击可跳转地图选择
</view>
</view>
<view
class=
"area_r"
>
<wd-icon
name=
"location"
size=
"22px"
@
tap=
"changeLocation"
></wd-icon>
</view>
</view>
</wd-cell>
</wd-checkbox-group>
<wd-checkbox-group
v-model=
"model.commonAddr"
size=
"large"
>
<wd-cell
title=
"设置为默认地址"
center
clickable
@
tap=
"setDefaultAddress"
>
<view>
<wd-checkbox
modelValuee=
"1"
ref=
"checkBoxAdress"
checked-color=
"#fa5151"
custom-style=
"margin-right:-18rpx"
></wd-checkbox>
</view>
</wd-cell>
</wd-checkbox-group>
<wd-cell
title=
"设置为默认地址"
center
>
<view>
<wd-checkbox
v-model=
"forMData.commonAddr"
prop=
"commonAddr"
/>
</view>
</wd-cell>
</wd-cell-group>
<view
class=
"footer"
>
...
...
@@ -67,63 +60,54 @@
<
script
setup
>
import
Header
from
'@/pages/order/components/Header/index.vue'
;
import
{
addAddress
,
updateAddress
,
deleteAddress
}
from
'@/api/address'
;
const
fileDomain
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
;
const
newAddressFlag
=
ref
(
false
);
const
f
orm
=
ref
();
const
reF
orm
=
ref
();
const
checkBoxAdress
=
ref
();
const
model
=
ref
({
name
:
''
,
phone
:
''
,
detailAddress
:
''
,
isDefaultAddress
:
[],
const
forMData
=
ref
({
receiver
:
''
,
mobile
:
''
,
province
:
''
,
city
:
''
,
area
:
''
,
addr
:
''
,
lng
:
''
,
lat
:
''
,
commonAddr
:
false
,
});
onLoad
((
options
)
=>
{
newAddressFlag
.
value
=
options
.
new
;
if
(
newAddressFlag
.
value
)
{
model
.
value
=
ref
({
name
:
''
,
phone
:
''
,
detailAddress
:
''
,
isDefaultAddress
:
[],
});
}
else
{
model
.
value
.
name
=
''
;
model
.
value
.
phone
=
''
;
model
.
value
.
detailAddress
=
''
;
model
.
value
.
isDefaultAddress
=
[
'1'
];
}
});
function
setDefaultAddress
()
{
// checkBoxAdress.value && checkBoxAdress.value.toggle();
console
.
log
(
model
.
value
.
isDefaultAddress
);
}
function
fieldNotEmpty
(
val
)
{
if
(
String
(
val
)
.
length
>=
1
)
{
if
(
val
.
length
>=
1
)
{
return
true
;
}
else
{
return
false
;
}
}
const
submit
=
async
()
=>
{
const
res
=
await
addAddress
(
model
.
value
);
console
.
log
(
res
);
const
hdSubmit
=
async
()
=>
{
await
addAddress
({
...
forMData
.
value
,
commonAddr
:
forMData
.
value
.
commonAddr
?
1
:
0
,
});
};
function
handleSubmit
()
{
form
.
value
console
.
log
(
'model的值'
,
reForm
.
value
);
reForm
.
value
.
validate
()
.
then
(({
valid
,
errors
})
=>
{
.
then
(({
valid
})
=>
{
if
(
valid
)
{
xma
.
showToast
({
title
:
'更新成功'
,
duration
:
2000
,
success
:
function
()
{
console
.
log
(
'数据更新后跳转地址列表页'
);
},
});
hdSubmit
();
// xma.showToast({
// title: '提交成功',
// duration: 2000,
// success: function () {
// console.log('数据更新后跳转地址列表页');
// },
// });
}
})
.
catch
((
error
)
=>
{
...
...
@@ -131,8 +115,23 @@ function handleSubmit() {
});
}
// 重新定位收货地址
function
changeLocation
()
{
console
.
log
(
'aaa'
);
async
function
changeLocation
()
{
uni
.
chooseLocation
({
success
:
function
(
res
)
{
forMData
.
value
.
city
=
res
.
address
;
forMData
.
value
.
addr
=
res
.
address
;
forMData
.
value
.
lng
=
res
.
longitude
;
forMData
.
value
.
lat
=
res
.
latitude
;
console
.
log
(
'位置信息:'
+
JSON
.
stringify
(
res
));
console
.
log
(
'位置名称:'
+
res
.
name
);
console
.
log
(
'详细地址:'
+
res
.
address
);
console
.
log
(
'纬度:'
+
res
.
latitude
);
console
.
log
(
'经度:'
+
res
.
longitude
);
},
});
const
res
=
(
'26.56806'
,
'106.714304'
);
console
.
log
(
'地址转换结果:'
+
res
);
}
</
script
>
...
...
src/pages/storeEntry/index.vue
View file @
504a8ec6
...
...
@@ -72,7 +72,7 @@ const getList = async () => {
};
const
shopGto
=
(
item
)
=>
{
xma
.
navigateTo
({
url
:
`/pages/storeEntry/detail
${
item
?
`?content=
0
`
:
''
}
`
,
url
:
`/pages/storeEntry/detail
${
item
?
`?content=
${
item
}
`
:
''
}
`
,
success
:
function
(
res
)
{
// 通过eventChannel向被打开页面传送数据
res
.
eventChannel
.
emit
(
'acceptDataFromOpenerPage'
,
{
data
:
item
});
...
...
yarn.lock
View file @
504a8ec6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment