微信小程序怎么卖东西

微信小程序怎么卖东西?那么首先我们要做一个微信小程序商城,只需以下3个步骤:

步骤一:注册小程序账号

注册小程序需要到微信公众平台官网进行注册一个小程序。

步骤二:挑选微信小程序商城模板在线编辑

进入>>在线商城小程序开发平台选择好模板后,进入模板在线编辑页面,更改具体的店铺文案介绍和商品,还可以更具喜好添加多种实用功能板块,例如短视频导购、投票评选、互动拼团等等。

步骤三:授权小程序账号一键发布

完成上述对微信小程序商城模板的所有修改后,点击保存。再到后台将自己的小程序账号授权给平台,进行上传提交审核,通过后即可发布自己的微信小程序商城啦!

方法就是这么简单,大家也快来试试吧!

小程序所有新进用户的昵称全部变成了“微信昵称”,当时我就

吓得我赶紧爬起来翻文档(需要代码直接往后翻)

原因就像微信所说的,很多开发者在打开小程序时就通过组件方式唤起getUserInfo弹窗,如果用户点击拒绝,无法使用小程序,这种做法打断了用户正常使用小程序的流程,同时也不利于小程序获取新用户。

这里我会给出Uni-app的适配代码,针对CRMEB系统进行修复,各位同学举一反三(4.13号之前发布的正式包暂不影响)

1.修改pages/users/wechat_login/index.vue中关于微信登录的按钮

<button span=""

>微信登录

<button span=""

>微信登录

2.默认data中添加canUseGetUserProfile: false,然后在加载页面调用的方法里面增加uni.getUserProfile的判断,是否显示新的按钮。

canUseGetUserProfile: false

if (uni.getUserProfile) {

this.canUseGetUserProfile = true

}

3.方法中新增getUserProfile方法用户获取用户信息

//小程序授权api替换 getUserInfo

getUserProfile() {

uni.showLoading({

title: '正在登录中'

});

let self = this;

Routine.getUserProfile()

.then(res => {

let userInfo = res.userInfo;

userInfo.code = this.code;

userInfo.spread_spid = app.globalData.spid; //获取推广人ID

userInfo.spread_code = app.globalData.code; //获取推广人分享二维码ID

Routine.authUserInfo(userInfo)

.then(res => {

if (res.data.key !== undefined && res.data.key) {

uni.hideLoading();

self.authKey = res.data.key;

self.isPhoneBox = true;

} else {

uni.hideLoading();

let time = res.data.expires_time - self.$Cache.time();

self.$store.commit('LOGIN', {

token: res.data.token,

time: time

});

this.getUserInfo()

}

})

.catch(res => {

uni.hideLoading();

uni.showToast({

title: res.msg,

icon: 'none',

duration: 2000

});

});

})

.catch(res => {

uni.hideLoading();

});

},

4.然后在libs/routine.js中增加getUserProfile方法

/**

* 新版小程序获取用户信息 2021 4.13微信小程序开始正式启用

*/

getUserProfile(code) {

return new Promise((resolve, reject) => {

uni.getUserProfile({

lang: 'zh_CN',

success(user) {

if (code) user.code = code;

resolve({

userInfo: user,

islogin: false

});

},

fail(res) {

reject(res);

}

})

})

}

这里要注意

if (!isset($userInfoCong['openid'])) {

throw new ValidateException('openid获取失败');

}

if (!isset($userInfoCong['openid'])) {

throw new ValidateException('openid获取失败');

}

userInfo['unionId'] = isset( userInfo [′ unionId ′]= isset (userInfoCong['unionid']) ? $userInfoCong['unionid'] : '';

userInfo['openId'] = userInfo [′ openId ′]=openid = $userInfoCong['openid'];

修复完成之后重新编译小程序就可以解决授权之后微信用户的问题啦。

本文来自作者[晓兰兰]投稿,不代表巨商报立场,如若转载,请注明出处:https://91zxpc.com/zx/2970.html

(10)
晓兰兰的头像晓兰兰签约作者

文章推荐

发表回复

作者才能评论

评论列表(3条)

  • 晓兰兰的头像
    晓兰兰 2025年08月16日

    我是巨商报的签约作者“晓兰兰”

  • 晓兰兰
    晓兰兰 2025年08月16日

    本文概览:微信小程序怎么卖东西?那么首先我们要做一个微信小程序商城,只需以下3个步骤:步骤一:注册小程序账号注册小程序需要到微信公众平台官网进行注册一个小程序。步骤二:挑选微信小程序商城...

  • 晓兰兰
    用户081605 2025年08月16日

    文章不错《微信小程序怎么卖东西》内容很有帮助

联系我们

邮件:巨商报@gmail.com

工作时间:周一至周五,9:30-17:30,节假日休息

关注微信