Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the three-level linkage of ecshop address in WeChat Mini Programs

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to achieve the three-level linkage of ecshop addresses in WeChat Mini Programs". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

How to realize the three-level linkage of ecshop address by WeChat Mini Programs

Picker tag, an official example:

Current selection of region selector: {{array [index]} Page ({data: {array: ['US', 'China', 'Brazil', 'Japan'], index: 0,}, bindPickerChange: function (e) {console.log ('picker send selection change, carry value is', e.detail.value) this.setData ({index: e.detail.value})},})

Wxml page:

Receiving address {{province [provinceIndex]}} {{city [cityIndex]}} {{district [districtIndex]}}

Js page:

Var app = getApp () Page ({data: {motto: 'jxcat', serverUrl: app.globalData.ajaxUrl, baseUrl: app.globalData.baseUrl, title: "ship to address", address_id: ", address:", province: [], province_id: [], / / the data returned by the backend corresponds to region_id city,district the same province_name: [], / / the data returned by the backend corresponds to region_name provinceIndex: 0 / / options selected on the wxml page Starting from 0, provinceId: 0, / / get the region_id city corresponding to province_id: [] according to the option selected on the wxml page. City_id: [], city_name: [], cityIndex: 0, cityId: 0, district: [], district_id: [], district_name: [], districtIndex: 0, districtId: 0,} OnLoad:function (options) {/ / Page initialization parameter var that = this var get_data wx.checkSession for page jump brought by options ({success: function () {/ / login state unexpired wx.getStorage ({key: 'wcx_session', success: function (sres) {get_data = {m:' api', c: 'user') A: 'edit_address', wcx_session: sres.data,} if (options.act = =' edit') {get_data = {m: 'api', c:' user', a: 'edit_address', id: options.id, wcx_session: sres.data }} wx.request ({url: app.globalData.ajaxUrl, data: get_data, header: {'content-type':' application/json'} Success: function (res) {if (options.act = = "edit") {that.data.provinceId = res.data.consignee.province that.data.cityId = res.data.consignee.city that.data.districtid = res.data.consignee.district} for (var item0 I

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report