| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- <template>
- <view class="container">
- <navBar title="接口测试" :back="true" color="white" background="green" />
- <button @click="wxAuthLogin">微信授权登陆</button>
- <button @click="getUserInfo">获取用户信息</button>
- <button @click="updatetUserInfo">更新用户信息</button>
- <button @click="updatetUserInfo">更新用户信息</button>
- <button @click="getIndexConfig">获取首页配置</button>
- <button @click="postOrder">提交订单</button>
- <button @click="getOrderDetail">获取订单详细</button>
- <button @click="getMallCat">获取商城分类数据</button>
- <button @click="getMall">获取商城数据</button>
- <button @click="getSerDoc">获取服务文档数据</button>
- <button @click="getPricePercent">获取各个身份的价格百分比</button>
- <button @click="getSerBack">获取我的售后保障</button>
- <button @click="getSerStep">获取我的服务流程</button>
- <button @click="getSerBackGoods">获取我的售后商品</button>
- <button @click="getSerBackCon">获取我的售后联系</button>
- <button @click="postInvite">提交邀请</button>
- <button @click="getMyInvite">获取我的邀请</button>
- <button @click="addInvite">添加邀请</button>
- <button @click="addColl">添加收藏</button>
- <button @click="cancelColl">取消收藏</button>
- <button @click="getActGoods">获取活动商品</button>
- </view>
- </template>
- <script>
- import {
- wxAuthLoginReq,
- getUserInfoReq,
- updateUserInfoReq,
- getIndexConfigReq,
- postOrderReq,
- getOrderDetailReq,
- getMallCatReq,
- getMallReq,
- getSerDocReq,
- getPricePercentReq,
- getSerBackReq,
- getSerStepReq,
- getSerBackGoodsReq,
- getSerBackConReq,
- postInviteReq,
- getMyInviteReq,
- addInviteReq,
- addCollReq,
- cancelCollReq,
- getActGoodsReq
- } from '@/api/test/index.js'
- export default {
- // components: {
- // navBar
- // },
- data() {
- return {
- }
- },
- methods: {
- async wxAuthLogin() {
- let res = await wxAuthLoginReq({
- code: '0b3nl20w3x5lh13zH53w3HRKX02nl20H'
- })
- if (res.code == 0) {
- console.log('微信授权登陆返回值:', res);
- uni.setStorageSync('token', res.data.token)
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getUserInfo() {
- let res = await getUserInfoReq()
- if (res.code == 0) {
- console.log('获取用户信息返回值:', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async updatetUserInfo() {
- let res = await updateUserInfoReq({
- nickname: '测试昵称',
- head: 'https://himg.bdimg.com/sys/portraitn/item/public.1.7bbfbe74.qTDof1r_zukwKzMF2A-cRQ',
- phone: '15609038521',
- sex: 1,
- name: '李万涛',
- birthday: '1999-01-03'
- })
- if (res.code == 0) {
- console.log('更新用户信息返回值:', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getIndexConfig() {
- let res = await getIndexConfigReq({
- type: 2
- })
- if (res.code == 0) {
- console.log('获取首页配置返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async postOrder() {
- let res = await postOrderReq({
- address: '成都市金牛区长平街70号',
- phone: '15609038521',
- name: '李万涛',
- remark: '备注内容',
- config_id: '1,3,5',
- lamp_id: '2,4,6'
- })
- if (res.code == 0) {
- console.log('提交订单返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getOrderDetail() {
- let res = await getOrderDetailReq({
- orderId: '3bfc962f6f049082267020faf903d777',
- })
- if (res.code == 0) {
- console.log('获取订单详细返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getMallCat() {
- let res = await getMallCatReq()
- if (res.code == 0) {
- console.log('获取商城分类数据返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getMall() {
- let res = await getMallReq({
- page: 1,
- type: 1,
- brand: 0,
- search: '筒'
- })
- if (res.code == 0) {
- console.log('获取商城数据返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getSerDoc() {
- let res = await getSerDocReq()
- if (res.code == 0) {
- console.log('获取服务文档数据返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getPricePercent() {
- let res = await getPricePercentReq()
- if (res.code == 0) {
- console.log('获取各个身份的价格百分比返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getSerBack() {
- let res = await getSerBackReq()
- if (res.code == 0) {
- console.log('获取我的售后保障返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getSerStep() {
- let res = await getSerStepReq()
- if (res.code == 0) {
- console.log('获取我的服务流程返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getSerBackGoods() {
- let res = await getSerBackGoodsReq({
- page: 1
- })
- if (res.code == 0) {
- console.log('获取我的售后商品返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getSerBackCon() {
- let res = await getSerBackConReq()
- if (res.code == 0) {
- console.log('获取我的售后联系返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async postInvite() {
- let res = await postInviteReq({
- type: 0,
- name: '李万涛',
- phone: '15609038521',
- status: 'G-VIP',
- company: '思维定制科技有限公司',
- remark: '我的备注project_nameproject_name',
- project_name: 'project_name'
- })
- if (res.code == 0) {
- console.log('提交邀请返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getMyInvite() {
- let res = await getMyInviteReq({
- type: 0,
- state: 0,
- })
- if (res.code == 0) {
- console.log('获取我的邀请返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async addInvite() {
- let res = await addInviteReq({
- inviteId: 'b3f48188b03b54aeb32256c825044e35',
- })
- if (res.code == 0) {
- console.log('添加邀请返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async addColl() {
- let res = await addCollReq({
- id: 2,
- })
- if (res.code == 0) {
- console.log('添加收藏返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async cancelColl() {
- let res = await cancelCollReq({
- id: 1,
- })
- if (res.code == 0) {
- console.log('取消收藏返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- async getActGoods() {
- let res = await getActGoodsReq()
- if (res.code == 0) {
- console.log('获取活动商品返回值: ', res);
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "./index.scss";
- </style>
|