diff --git a/api/api.js b/api/api.js index 2366f65..55fb4ce 100644 --- a/api/api.js +++ b/api/api.js @@ -424,7 +424,8 @@ export function api(key, data, callback, loadingTitle) { } http.http(req.url, data, callback, req.method, - loadingTitle || req.showLoading, loadingTitle || req.loadingTitle) + loadingTitle || req.showLoading, loadingTitle || req.loadingTitle, + req) } diff --git a/api/http.js b/api/http.js index 3c18457..68b0c24 100644 --- a/api/http.js +++ b/api/http.js @@ -3,7 +3,7 @@ import Vue from 'vue' import utils from '../utils/utils.js' -function http(uri, data, callback, method = 'GET', showLoading, title) { +function http(uri, data, callback, method = 'GET', showLoading, title, req) { if(showLoading){ uni.showLoading({ @@ -11,13 +11,18 @@ function http(uri, data, callback, method = 'GET', showLoading, title) { }); } + let header = { + 'X-Access-Token': uni.getStorageSync('token'), + 'Content-Type' : method == 'POST' ? 'application/x-www-form-urlencoded' : 'application/json' + } + uni.request({ url: Vue.prototype.$config.baseUrl + uri, data: enhanceData(data), method: method, - header: { - 'X-Access-Token': uni.getStorageSync('token'), - 'Content-Type' : method == 'POST' ? 'application/x-www-form-urlencoded' : 'application/json' + header : { + ...header, + ...req.header, }, success: (res) => { diff --git a/api/model/order.js b/api/model/order.js index f1362ac..cf7e529 100644 --- a/api/model/order.js +++ b/api/model/order.js @@ -62,6 +62,21 @@ const api = { method: 'GET', auth : true, }, + // 商城-增加或者修改商品信息 + orderSaveOrUpdate : { + url: '/order/saveOrUpdate', + method: 'POST', + auth : true, + header : { + 'Content-Type' : 'application/json' + }, + }, + // 商城-商品下架 + orderUpdate : { + url: '/order/update', + method: 'POST', + auth : true, + }, } export default api \ No newline at end of file diff --git a/components/list/activity/active-itemV2.vue b/components/list/activity/active-itemV2.vue new file mode 100644 index 0000000..c570e2e --- /dev/null +++ b/components/list/activity/active-itemV2.vue @@ -0,0 +1,215 @@ + + + + + diff --git a/manifest.json b/manifest.json index d05d70b..7d9114c 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name" : "unapp模板", - "appid" : "__UNI__E90DB8C", + "appid" : "__UNI__197A38F", "description" : "", "versionName" : "1.0.0", "versionCode" : "100", diff --git a/mixins/product.js b/mixins/product.js index ddb3a82..dccbb01 100644 --- a/mixins/product.js +++ b/mixins/product.js @@ -3,15 +3,42 @@ export default { data() { return { - + productCategory : [ + { + name : '户外', + value : 0, + }, + { + name : '美食', + value : 1, + }, + { + name : '兑换', + value : 2, + }, + { + name : '特产', + value : 3, + }, + { + name : '校园', + value : 4, + }, + ], } }, methods : { + // 商品详情->积分兑换 isProductPoint(detail){ return [2].includes(detail.className) }, + // 商品详情->微信支付 isProductPrice(detail){ return [0, 1, 3].includes(detail.className) }, + // 是否跳转到商店 + isShopBuy(detail){ + return [1, 3, 4].includes(detail.className) + }, } } \ No newline at end of file diff --git a/pages.json b/pages.json index 9188bcd..650aa4f 100644 --- a/pages.json +++ b/pages.json @@ -175,6 +175,9 @@ }, { "path": "notice/noticeDetail" + }, + { + "path": "product/addProduct" } ] }], diff --git a/pages/index/product.vue b/pages/index/product.vue index 599ca56..d8e244a 100644 --- a/pages/index/product.vue +++ b/pages/index/product.vue @@ -28,7 +28,7 @@ - import mixinsList from '@/mixins/list.js' + import mixinsProduct from '@/mixins/product.js' import tabber from '@/components/base/tabbar.vue' import productList from '@/components/user/productList.vue' import { mapState } from 'vuex' export default { - mixins: [mixinsList], + mixins: [mixinsList, mixinsProduct], components : { tabber, productList, @@ -130,24 +131,28 @@ // rightGap: 10, // columnGap: 10, bannerList : [], - category : [ - { - name : '美食商城', - value : 0, - }, - { - name : '家乡特产', - value : 1, - }, - { - name : '积分商城', - value : 2, - }, - { - name : '二手集市', - value : 3, - }, - ], + // category : [ + // { + // name : '户外', + // value : 0, + // }, + // { + // name : '美食', + // value : 1, + // }, + // { + // name : '兑换', + // value : 2, + // }, + // { + // name : '特产', + // value : 3, + // }, + // { + // name : '校园', + // value : 4, + // }, + // ], } }, onShow() { diff --git a/pages_order/components/list/gourmet/productSelectList.vue b/pages_order/components/list/gourmet/productSelectList.vue index 6c60a13..cdff58f 100644 --- a/pages_order/components/list/gourmet/productSelectList.vue +++ b/pages_order/components/list/gourmet/productSelectList.vue @@ -2,7 +2,6 @@ - + + + + @@ -76,6 +91,19 @@ :priceList="priceList" @submit="submit" /> + + + + + + + @@ -88,7 +116,13 @@ }, props : { list : { - default : [] + default : [], + }, + edit : { + default : false, + }, + shopId : { + default : '' }, }, computed : { @@ -137,6 +171,32 @@ }; }, methods : { + + // 下架商品 + del(item){ + uni.showModal({ + title: '您确认要下架吗?', + content: `您正在下架 ${item.name}`, + success : res => { + this.$api('orderUpdate', { + id : item.id, + isOpen : 'N', + }, res => { + if(res.code == 200){ + this.$emit('getData') + } + }) + } + }) + }, + + // 修改商品 + toEdit(item){ + this.$utils. + navigateTo('/pages_order/product/addProduct?id=' + + item.id) + }, + getDataThen(list){ list.forEach(n => { if(!this.selectNumMap[n.id]){ @@ -231,6 +291,8 @@ font-size: 24rpx; padding: 6rpx 20rpx; color: #717171; + display: flex; + justify-content: space-between; } .price-box{ @@ -356,5 +418,30 @@ flex-direction: column; font-size: 20rpx; } + + + .createDetail { + position: fixed; + top: 60vh; + right: 50rpx; + z-index: 999; + button{ + all : unset; + } + button::after{ + all : unset; + } + &>view{ + width: 100rpx; + height: 100rpx; + background-color: $uni-color; + border-radius: 50rpx; + display: flex; + justify-content: center; + align-items: center; + box-shadow: 0 0 10rpx 10rpx rgba(#000, 0.1); + margin-bottom: 30rpx; + } + } } \ No newline at end of file diff --git a/pages_order/components/product/submit.vue b/pages_order/components/product/submit.vue index def10d2..c95c758 100644 --- a/pages_order/components/product/submit.vue +++ b/pages_order/components/product/submit.vue @@ -62,9 +62,9 @@ } }, methods: { - // 美食商城、二手集市 + // submit(){ - if([0, 3].includes(this.detail.className)){ + if(this.isShopBuy(this.detail)){ uni.navigateTo({ url: '/pages_order/gourmet/gourmetDetail?id=' + this.detail.shopId }) diff --git a/pages_order/gourmet/gourmetDetail.vue b/pages_order/gourmet/gourmetDetail.vue index 73761b3..d14079b 100644 --- a/pages_order/gourmet/gourmetDetail.vue +++ b/pages_order/gourmet/gourmetDetail.vue @@ -56,6 +56,8 @@ @@ -107,7 +109,6 @@ :list="list" :params="params" /> - @@ -229,7 +230,7 @@ diff --git a/pages_order/product/productDetail.vue b/pages_order/product/productDetail.vue index 4ccdd75..3f58594 100644 --- a/pages_order/product/productDetail.vue +++ b/pages_order/product/productDetail.vue @@ -1,12 +1,12 @@ - + --> diff --git a/utils/utils.js b/utils/utils.js index 2b07dde..db8df99 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -172,6 +172,12 @@ export function navigateTo(...args){ } export function navigateBack(num = -1){ + if(getCurrentPages().length == 1){ + uni.reLaunch({ + url: '/pages/index/index' + }) + return + } uni.navigateBack(num) }