mylocation.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view style="margin-top: 160rpx;"></view>
  6. <view>
  7. <!-- 收货地址 -->
  8. <view class="card" style="margin-top: 6%;" v-for="item in list">
  9. <view class="">
  10. <view class="" style="display: flex;justify-content:space-around;align-items: center;">
  11. <view class="">
  12. <image class="head-img" :src="picture.icon_loc" mode="">
  13. </image>
  14. </view>
  15. <view class="" style="padding-left: 3%;padding-right: 3%;width: 80%;">
  16. <view style="display: flex;">
  17. <p class='ipon' style="padding-right: 200rpx;">{{item.receiver_name}}</p>
  18. <p class='ipon'>{{item.phone_number}}</p>
  19. </view>
  20. <p class='ipon'>{{item.full_detail_addr}}</p>
  21. </view>
  22. </view>
  23. <view class="" style="border-bottom: 2rpx solid #C0C0C0;margin-top: 3%;margin-bottom: 3%;"> </view>
  24. <view class="func">
  25. <view class="func-left">
  26. <label style="font-size: 28rpx;vertical-align: middle;">
  27. <radio color="#F0D232" :value="item.default_tag" :checked="item.default_tag" style="transform:scale(0.6);
  28. font-size: 24rpx;" @click="setdefault(item)" name="radio" />
  29. </label>
  30. <span>默认地址</span>
  31. </view>
  32. <view class="func-right">
  33. <view class="func-btn" @click="edit(item)">
  34. <image :src="picture.icon_edit" mode="">
  35. </image>
  36. <span>编辑</span>
  37. </view>
  38. <view class="func-btn" @click="del(item)">
  39. <image :src="picture.icon_del" mode="" style="width: 33rpx;height: 33rpx;">
  40. </image>
  41. <span>删除</span>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="" style="width: 100%;height: 150rpx;">
  49. </view>
  50. <view class="signup">
  51. <view class="signupbtn">
  52. <button type="default" class="btn1" @click="addreceipt()">手动添加</button>
  53. </view>
  54. <view class="signupbtn">
  55. <button type="default" class="btn1" @click="chooseAddr()">
  56. <image class="weixinlogo" :src="weixinimage">
  57. </image>
  58. <p class="auto-text">
  59. 自动获取</p>
  60. </button>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import region from '@/components/pca-code.json';
  67. import mvBar from "@/components/mys_navBar/mysNavBar";
  68. export default {
  69. components: {
  70. mvBar,
  71. },
  72. data() {
  73. return {
  74. weixinimage: "../../../static/img/icon-weixin.png",
  75. picture: {
  76. icon_edit: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-edit.png',
  77. icon_del: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-del.png',
  78. icon_loc: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-loc.png',
  79. home8: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home8.png',
  80. home10: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home10.png',
  81. home11: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home11.png',
  82. },
  83. list: [],
  84. mysNavConfig: {
  85. /* 开启单页显示首页图标 */
  86. isHome: true,
  87. /* 固定导航 */
  88. navFixed: true,
  89. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  90. navTitle: {
  91. text: "收货地址管理",
  92. color: "",
  93. fontSize: "32rpx", // px upx rpx
  94. fontWeight: "normal", // 100 - 700
  95. },
  96. btnType: "type2",
  97. onLeftClick: "",
  98. /* type2 按钮 */
  99. type2Config: {
  100. // 左图标
  101. leftPath: "/static/img/png2.png",
  102. // 右图标
  103. rightPath: "/static/img/png4.png",
  104. // 圆角
  105. radius: "40rpx",
  106. },
  107. },
  108. };
  109. },
  110. onShow() {
  111. this.getlist()
  112. },
  113. onLoad() {},
  114. methods: {
  115. // 列表
  116. getlist() {
  117. return this.$https.get('/youngee/c/t/g/get-talent-address')
  118. .then(res => {
  119. console.log(res)
  120. this.list = res.data.data
  121. for (let k = 0; k < this.list.length; ++k) {
  122. let a = this.list[k].region_code.toString().slice(0, 2)
  123. let b = this.list[k].region_code.toString().slice(0, 4)
  124. let c = 0
  125. for (var i = 0; i < region.length; i++) {
  126. if (region[i].code == a) {
  127. a = region[i].name
  128. for (var j = 0; j < region[i].children.length; j++) {
  129. if (region[i].children[j].code == b) {
  130. b = region[i].children[j].name
  131. for (var o = 0; o < region[i].children[j].children.length; o++) {
  132. if (region[i].children[j].children[o].code == this.list[k]
  133. .region_code) {
  134. c = region[i].children[j].children[o].name
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. this.list[k].full_detail_addr = a + b + c + this.list[k].detail_addr
  142. }
  143. })
  144. },
  145. // 进入添加收货地址
  146. addreceipt() {
  147. uni.navigateTo({
  148. url: '/pages/mycenter/myinformation/addlocation?ismodify=0'
  149. });
  150. },
  151. chooseAddr() {
  152. const that = this
  153. uni.chooseAddress({
  154. success(res) {
  155. console.log(res)
  156. console.log(res.userName)
  157. console.log(res.postalCode)
  158. console.log(res.provinceName)
  159. console.log(res.cityName)
  160. console.log(res.countyName)
  161. console.log(res.detailInfo)
  162. console.log(res.nationalCode)
  163. console.log(res.telNumber)
  164. that.$https.post('/youngee/c/t/p/add-talent-address', {
  165. region_code: res.nationalCode,
  166. detail_addr: res.provinceName + res.cityName + res.countyName + res.detailInfo,
  167. phone_number: res.telNumber,
  168. receiver_name: res.userName,
  169. mail_code: res.postalCode,
  170. default_tag: 1
  171. })
  172. .then(res => {
  173. console.log(res)
  174. that.getlist()
  175. })
  176. },
  177. fail: (res) => {
  178. console.log(res)
  179. }
  180. })
  181. },
  182. // 改变默认地址
  183. setdefault(item) {
  184. console.log(item.default_tag)
  185. if (item.default_tag === 1)
  186. return
  187. this.$https.post('/youngee/c/t/p/change-default-delivery-addr', {
  188. address_id: item.address_id,
  189. })
  190. .then(res => {
  191. console.log(res)
  192. this.getlist()
  193. uni.showToast({
  194. title: '修改成功'
  195. })
  196. })
  197. // var that = this;
  198. // uni.showModal({
  199. // title: '提示',
  200. // content: '确认修改默认地址',
  201. // success: function(res) {
  202. // if (res.confirm) {
  203. // that.$https.post('/youngee/c/t/p/change-default-delivery-addr', {
  204. // address_id: item.address_id,
  205. // })
  206. // .then(res => {
  207. // console.log(res)
  208. // that.getlist()
  209. // uni.showToast({
  210. // title: '修改成功'
  211. // })
  212. // })
  213. // } else if (res.cancel) {
  214. // console.log('用户点击取消');
  215. // }
  216. // },
  217. // })
  218. },
  219. // 编辑地址
  220. edit(item) {
  221. console.log(item.receiver_name)
  222. uni.navigateTo({
  223. url: '/pages/mycenter/myinformation/addlocation?address_id=' + item.address_id + '&ismodify=1'
  224. });
  225. },
  226. // 删除地址
  227. del(item) {
  228. let that = this
  229. uni.showModal({
  230. title: '提示',
  231. content: '确认删除',
  232. success: function(res) {
  233. if (res.confirm) {
  234. // console.log(item)
  235. that.$https.post('/youngee/c/t/p/delete-talent-address', {
  236. address_id: item.address_id,
  237. default_tag: item.default_tag,
  238. })
  239. .then(res => {
  240. console.log(res)
  241. that.getlist()
  242. uni.showToast({
  243. title: '删除成功'
  244. })
  245. })
  246. } else if (res.cancel) {
  247. console.log('用户点击取消');
  248. }
  249. },
  250. })
  251. },
  252. }
  253. };
  254. </script>
  255. <style>
  256. </style>
  257. <style lang="scss" scoped>
  258. view {
  259. font-size: 28rpx;
  260. // line-height: inherit;
  261. }
  262. .menu {
  263. position: fixed;
  264. top: 180rpx;
  265. border-bottom: #FCCF41;
  266. background-color: #FFFFFF;
  267. justify-content: space-around;
  268. height: 5%;
  269. width: 100%;
  270. display: flex;
  271. z-index: 10;
  272. }
  273. .menu-item p {
  274. font-weight: 600;
  275. &.lor {
  276. border-bottom: 5rpx solid #F0D232;
  277. color: #F0D232;
  278. padding-bottom: 15rpx;
  279. }
  280. }
  281. .signup {
  282. display: flex;
  283. align-items: center;
  284. justify-content: space-around;
  285. width: 100%;
  286. position: fixed;
  287. padding-bottom: 10rpx;
  288. bottom: 0rpx;
  289. display: flex;
  290. height: 100rpx;
  291. padding-top: 2%;
  292. box-shadow: 0rpx 5rpx 40rpx #ccc;
  293. // width: 100%;
  294. // position: fixed;
  295. // bottom: 0rpx;
  296. // display: flex;
  297. // height: 90rpx;
  298. // background-color: #FFFFFF;
  299. // justify-content: space-around;
  300. // ;
  301. // /* 垂直居中 */
  302. // align-items: center;
  303. }
  304. .signupbtn p {
  305. font-size: 32rpx;
  306. }
  307. .btn1 {
  308. // width: 60%;
  309. background-color: #f2d22d;
  310. color: #000;
  311. border-color: #ffffff;
  312. border-radius: 10rpx;
  313. font-size: 32rpx;
  314. line-height: 200%;
  315. letter-spacing: 10rpx;
  316. font-weight: 500;
  317. height: 100%;
  318. width: 280rpx;
  319. display: flex;
  320. align-items: center;
  321. justify-content: center;
  322. }
  323. .auto-btn {
  324. width: 300rpx;
  325. text-align: center;
  326. background-color: #FCCF41;
  327. border-radius: 10rpx;
  328. color: #FFFFFF;
  329. font-size: 28rpx;
  330. line-height: 180%;
  331. margin-right: 10%;
  332. display: flex;
  333. justify-content: center;
  334. align-items: center;
  335. }
  336. .auto-text {
  337. display: inline-block;
  338. // font-size:32rpx;
  339. }
  340. .weixinlogo {
  341. display: inline-block;
  342. padding-right: 5rpx;
  343. width: 35rpx;
  344. height: 35rpx;
  345. }
  346. .radio {
  347. color: #F0D232;
  348. }
  349. .taskimg {
  350. width: 30rpx;
  351. height: 30rpx;
  352. background-image: url(../../../static/home/home12.png);
  353. background-size: 30rpx;
  354. background-repeat: no-repeat;
  355. box-sizing: border-box;
  356. display: inline-block;
  357. vertical-align: middle;
  358. &.on {
  359. background-image: url(../../../static/home/home13.png);
  360. }
  361. }
  362. .func {
  363. display: flex;
  364. justify-content: space-between;
  365. }
  366. .func-left {
  367. display: flex;
  368. align-items: center;
  369. }
  370. .func-right {
  371. display: flex;
  372. justify-content: center;
  373. padding: 0 0 0 1%;
  374. }
  375. .func-btn {
  376. display: flex;
  377. align-items: center;
  378. padding-left: 20rpx;
  379. }
  380. .func-btn span {
  381. color: #333333;
  382. font-size: 30rpx;
  383. font-weight: 500;
  384. }
  385. .func-btn image {
  386. vertical-align: middle;
  387. width: 30rpx;
  388. height: 30rpx;
  389. display: inline-block;
  390. padding-right: 14rpx;
  391. }
  392. .head-img {
  393. vertical-align: middle;
  394. width: 50rpx;
  395. height: 50rpx;
  396. display: inline-block;
  397. padding-right: 30rpx;
  398. }
  399. .ipon {
  400. color: #333333;
  401. font-size: 30rpx;
  402. font-weight: 500;
  403. margin-bottom: 10rpx;
  404. }
  405. .card {
  406. width: 88%;
  407. padding: 24rpx;
  408. margin-top: 30rpx;
  409. border-radius: 10rpx;
  410. background-color: #ffffff;
  411. margin: 0 auto;
  412. box-shadow: 0px 0px 10rpx 2rpx #CCCCCC;
  413. }
  414. .butto {
  415. text-align: center;
  416. }
  417. .option {
  418. padding: 20rpx;
  419. }
  420. .uni-margin-wrap {
  421. width: 690rpx;
  422. width: 100%;
  423. ;
  424. }
  425. .swiper {
  426. height: 300rpx;
  427. }
  428. .swiper-item {
  429. display: block;
  430. height: 300rpx;
  431. line-height: 300rpx;
  432. text-align: center;
  433. }
  434. .swiper-list {
  435. margin-top: 40rpx;
  436. margin-bottom: 0;
  437. }
  438. .uni-common-mt {
  439. margin-top: 60rpx;
  440. position: relative;
  441. }
  442. .info {
  443. position: absolute;
  444. right: 20rpx;
  445. }
  446. .uni-padding-wrap {
  447. width: 550rpx;
  448. padding: 0 100rpx;
  449. }
  450. </style>