商城首页

This commit is contained in:
itgaojian163 2025-06-09 17:02:32 +08:00
parent fb54447a91
commit 5976746087
26 changed files with 1640 additions and 211 deletions

130
app.json
View File

@ -1,66 +1,68 @@
{
"pages": [
"pages/mainPage/mainPage",
"pages/login/login",
"pages/index/index",
"pages/mine/mineIndex/mine",
"pages/copyright/createProjectInfo/createProjectInfo",
"pages/copyright/createBuy/createBuy",
"pages/copyright/payment/payment",
"pages/mine/mineAccount/mineCoupons/mineCoupons",
"pages/copyright/publicPay/publicPay",
"pages/copyright/common/payState",
"pages/readTxt/readTxt",
"pages/mine/mineAccount/mineInfo/mineInfo",
"pages/mine/mineAccount/mineOrder/mineOrder",
"pages/mine/mineAccount/mineContact/mineContact",
"pages/treaty/rule/rule",
"pages/mine/mineAccount/minePayRecord/minePayRecord",
"pages/mine/mineAccount/mineInvoiceManage/mineInvoiceManage",
"pages/mine/mineAccount/invoiceInfo/invoiceInfo",
"pages/mine/mineAccount/makeInvoice/makeInvoice",
"pages/mine/mineAccount/invoiceOrder/invoiceOrder",
"pages/mine/mineAccount/invoiceRecordDetail/invoiceRecordDetail",
"pages/mine/mineAccount/mineMsgNotice/mineMsgNotice",
"pages/copyright/refund/refund",
"pages/copyright/repair/repair",
"pages/copyright/applyRepair/applyRepair",
"pages/copyright/applyRefund/applyRefund",
"pages/shop/market"
],
"window": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "AI喵著",
"navigationBarBackgroundColor": "#ffffff"
},
"tabBar": {
"custom": true,
"color": "#515151",
"selectedColor": "#FE9944",
"list": [{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "/static/images/ic_home_normal.png",
"selectedIconPath": "/static/images/ic_home_select.png"
},
{
"pagePath": "pages/shop/market",
"text": "软著市场",
"iconPath": "/static/images/ic_home_normal.png",
"selectedIconPath": "/static/images/ic_home_select.png"
},
{
"pagePath": "pages/mine/mineIndex/mine",
"text": "我的",
"iconPath": "/static/images/ic_mine_normal.png",
"selectedIconPath": "/static/images/ic_mine_select.png"
}
]
},
"style": "v2",
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"useExtendedLib": {
"weui": true
}
"pages": [
"pages/mainPage/mainPage",
"pages/login/login",
"pages/index/index",
"pages/mine/mineIndex/mine",
"pages/copyright/createProjectInfo/createProjectInfo",
"pages/copyright/createBuy/createBuy",
"pages/copyright/payment/payment",
"pages/mine/mineAccount/mineCoupons/mineCoupons",
"pages/copyright/publicPay/publicPay",
"pages/copyright/common/payState",
"pages/readTxt/readTxt",
"pages/mine/mineAccount/mineInfo/mineInfo",
"pages/mine/mineAccount/mineOrder/mineOrder",
"pages/mine/mineAccount/mineContact/mineContact",
"pages/treaty/rule/rule",
"pages/mine/mineAccount/minePayRecord/minePayRecord",
"pages/mine/mineAccount/mineInvoiceManage/mineInvoiceManage",
"pages/mine/mineAccount/invoiceInfo/invoiceInfo",
"pages/mine/mineAccount/makeInvoice/makeInvoice",
"pages/mine/mineAccount/invoiceOrder/invoiceOrder",
"pages/mine/mineAccount/invoiceRecordDetail/invoiceRecordDetail",
"pages/mine/mineAccount/mineMsgNotice/mineMsgNotice",
"pages/copyright/refund/refund",
"pages/copyright/repair/repair",
"pages/copyright/applyRepair/applyRepair",
"pages/copyright/applyRefund/applyRefund",
"pages/shop/market/market",
"pages/shop/publishCopyright/publishCopyright"
],
"window": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "AI喵著",
"navigationBarBackgroundColor": "#ffffff"
},
"tabBar": {
"custom": true,
"color": "#515151",
"selectedColor": "#FE9944",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "/static/images/ic_home_normal.png",
"selectedIconPath": "/static/images/ic_home_select.png"
},
{
"pagePath": "pages/shop/market/market",
"text": "软著市场",
"iconPath": "/static/images/ic_home_normal.png",
"selectedIconPath": "/static/images/ic_home_select.png"
},
{
"pagePath": "pages/mine/mineIndex/mine",
"text": "我的",
"iconPath": "/static/images/ic_mine_normal.png",
"selectedIconPath": "/static/images/ic_mine_select.png"
}
]
},
"style": "v2",
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"useExtendedLib": {
"weui": true
}
}

View File

@ -161,6 +161,12 @@ swiper-item {
.mb-40 {
margin-bottom: 40rpx;
}
.mb-60{
margin-bottom: 60rpx;
}
.mb-80{
margin-bottom: 80rpx;
}
.mg {
margin: 10rpx;
@ -319,4 +325,9 @@ swiper-item {
border-radius: 50%;
background-color: var(--divider-color);
margin: 0 20rpx;
}
.weui-half-screen-dialog__ft {
height: 0;
padding: 0rpx 0rpx 50rpx;
}

View File

@ -11,46 +11,93 @@ const apiPath = {
updateGoods: "/api/goods/update/{goodsId}", //修改商品 PUT
doCheck: "/api/goods/sub-check/{goodsId}", //提交审核 PUT
onGoods: "/api/goods/publish/{goodsId}", //上架商品 PUT
offGoods: "/api/goods/no-publish/{goodsId}", //下架商品 PUT
offGoods: "/api/goods/no-publish/{goodsId}", //下架商品
// 0b00884a-f7a2-425f-93e5-599fbaad4bde 软著分类
// ce3ded65-68ed-4f42-89da-de1b813b8f7e 证件类型
goodsDics: "/api/data/listbyparentid/{dId}", //商品数据字典
areaList: "/api/area/listbyparentid/{pId}", //省市区树结构
}
class Shop {
//获取上架的软著列表
// 通用路径参数替换方法
static #replacePathParams(path, params) {
return Object.entries(params).reduce(
(acc, [key, value]) => acc.replace(`{${key}}`, value),
path
)
}
// 通用请求方法
static requestHandler(endpoint, method, data = null, pathParams = {}) {
const path = Object.keys(pathParams).length ?
this.#replacePathParams(endpoint, pathParams) :
endpoint
return request(path, method, data, proName)
}
// 获取上架的软著列表
static doGetIndexList(data) {
return request(apiPath.indexList, "GET", data, proName)
return this.requestHandler(apiPath.indexList, "GET", data)
}
//新增软件商品
// 软著类型
static doGetGoodsDic(id) {
return this.requestHandler(apiPath.goodsDics, "GET", null, {
dId: id
})
}
// 新增软件商品
static doSaveGoods(data) {
return request(apiPath.saveGoods, "POST", data, proName)
return this.requestHandler(apiPath.saveGoods, "POST", data)
}
//商品详情
// 商品详情
static doGetGoodsDetail(id) {
const path = apiPath.goodsDetail.replace('{goodsId}', id)
return request(path, "GET", null, proName)
return this.requestHandler(apiPath.goodsDetail, "GET", null, {
goodsId: id
})
}
//删除商品
// 删除商品
static doDelGoods(id) {
const path = apiPath.delGoods.replace('{goodsId}', id)
return request(path, "DELETE", null, proName)
return this.requestHandler(apiPath.delGoods, "DELETE", null, {
ids: id
})
}
//更新商品
// 更新商品
static doUpdateGoods(id, data) {
const path = apiPath.updateGoods.replace('{goodsId}', id)
return request(path, "PUT", data, proName)
return this.requestHandler(apiPath.updateGoods, "PUT", data, {
goodsId: id
})
}
//提交审核
// 提交审核
static doSubCheck(id) {
const path = apiPath.doCheck.replace('{goodsId}', id)
return request(path, "PUT", null, proName)
return this.requestHandler(apiPath.doCheck, "PUT", null, {
goodsId: id
})
}
//上架商品
// 上架商品
static doOnGoods(id) {
const path = apiPath.onGoods.replace('{goodsId}', id)
return request(path, "PUT", null, proName)
return this.requestHandler(apiPath.onGoods, "PUT", null, {
goodsId: id
})
}
//下架商品
// 下架商品
static doOffGoods(id) {
const path = apiPath.offGoods.replace('{goodsId}', id)
return request(path, "PUT", null, proName)
return this.requestHandler(apiPath.offGoods, "PUT", null, {
goodsId: id
})
}
//获取地区
static doGetAreaList(id) {
return this.requestHandler(apiPath.areaList, "GET", null, {
pId: id
})
}
}

View File

@ -1,12 +1,16 @@
// 定义api服务地址
const operatorUrl = 'https://www.aimzhu.com/operator'
const operatorPlug = 'https://www.aimzhu.com/operator-plugin'
const copyrightUrl = 'https://www.aimzhu.com/copyright'
const aiShopUrl = 'https://www.aimzhu.com/aishop'
const appUrl = 'https://www.aimzhu.com'
const prewBaseUrl = ''
const operatorUrl = appUrl + '/operator'
const operatorPlug = appUrl + '/operator-plugin'
const copyrightUrl = appUrl + '/copyright'
const aiShopUrl = appUrl + '/aishop'
const uploadImgUrl = copyrightUrl + '/api/file/v2/upload-image'
const previewUrl = copyrightUrl + '/route/file/v2/download/true/'
const imgAssets = 'https://www.aimzhu.com/miniapp-assets'
const appUrl = 'https://www.aimzhu.com'
const imgAssets = appUrl + '/miniapp-assets'
const sImgPrefix = aiShopUrl + '/route/file/download/true/'
const upShopImgUrl = aiShopUrl + '/api/file/v2/upload-image'
export {
operatorUrl,
@ -16,5 +20,7 @@ export {
copyrightUrl,
aiShopUrl,
imgAssets,
appUrl
appUrl,
sImgPrefix,
upShopImgUrl
}

View File

@ -1,66 +0,0 @@
// pages/mine/mineAccount/mineInvoice/mineInvoice.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,2 +0,0 @@
<!--pages/mine/mineAccount/mineInvoice/mineInvoice.wxml-->
<text>pages/mine/mineAccount/mineInvoice/mineInvoice.wxml</text>

View File

@ -1,35 +0,0 @@
// pages/shop/market.js
const data= require('../../utils/data')
Page({
/**
* 页面的初始数据
*/
data: {
tabList:data.tabList
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
console.log('页面显示')
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const tabList = this.data.tabList;
tabList.forEach(item => {
item.selected = item.pagePath === currentPage.route;
});
this.setData({
tabList
});
},
})

View File

@ -1,5 +0,0 @@
{
"usingComponents": {
"custom-tabbar": "/components/tabbar/custom-tabbar"
}
}

View File

@ -1,4 +0,0 @@
<view>
市场
</view>
<custom-tabbar tabList="{{tabList}}" color="var(--tabbar-normal-color)" selectedColor="var(--tabbar-select-color)"></custom-tabbar>

View File

@ -1 +0,0 @@
/* pages/shop/market.wxss */

243
pages/shop/market/market.js Normal file
View File

@ -0,0 +1,243 @@
// pages/shop/market.js
import Shop from '../../../net/api/shop'
import {
sImgPrefix,
} from '../../../net/mainUrl'
const data = require('../../../utils/data')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
tabList: data.tabList,
pageData: {
page: 1,
rows: 12,
keywords: '',
priceRangeStart: '',
priceRangeEnd: '',
priceOrder: '',
goodsGetTime: '',
goodsDevelop: '',
goodsType: '', //软著类型
goodsFlag: '',
},
keywords: '',
priceStart: '',
priceEnd: '',
isLoadMore: false,
hasMore: true,
listLoading: 'loading',
listRefreshTrig: false,
goodsList: [],
imgPrefix: sImgPrefix,
localAssets: app.globalData.localAssets,
imgAssets: app.globalData.imgAssetsUrl,
typeList: [],
selType: '',
ownerList: [{
dataName: '从高到低',
dataId: 'DESC'
}, {
dataName: '从低到高',
dataId: 'ASC'
}],
selOwner: '',
isSticky: false,
msgType: 'info',
msgHint: '',
msgShow: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.setNavigationBarTitle({
title: '商城',
})
wx.setNavigationBarColor({
frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000
backgroundColor: '#FFFFFF', // 传递的颜色值,仅支持十六进制颜色
animation: { // 可选项
duration: 500,
timingFunc: 'easeIn'
}
})
this.doGetDic()
this.doRefreshList()
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
console.log('页面显示')
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const tabList = this.data.tabList;
tabList.forEach(item => {
item.selected = item.pagePath === currentPage.route;
});
this.setData({
tabList
});
},
onPageScroll(e) {
this.setData({
isSticky: e.scrollTop > 190
})
},
onPullDownRefresh() {
this.doRefreshList()
},
onReachBottom(e) {
console.log('触底了')
this.doLoadMore()
},
inputKeywords(e) {
this.setData({
keywords: e.detail.value
})
},
doSearch() {
this.doRefreshList()
},
bindChooseType(e) {
wx.pageScrollTo({
scrollTop: 0
})
setTimeout(() => {
const item = e.currentTarget.dataset.item;
let newSelType = this.data.selType;
// 先转数组,处理空字符串情况
const typeArr = newSelType ? newSelType.split(',') : [];
if (typeArr.includes(item.dataId)) {
// 删除
const index = typeArr.indexOf(item.dataId);
typeArr.splice(index, 1);
} else {
// 添加
typeArr.push(item.dataId);
}
// 转回字符串,自动处理空数组(转成空字符串)
newSelType = typeArr.join(',');
this.setData({
selType: newSelType
});
console.log('选择分类:', this.data.selType);
this.doRefreshList();
}, 500);
},
bindChooseOwner(e) {
const item = e.currentTarget.dataset.item
this.setData({
selOwner: this.data.selOwner == item.dataId ? '' : item.dataId
})
this.doRefreshList()
},
doGetDic() {
wx.showLoading({
title: '加载中...',
})
const that = this
Shop.doGetGoodsDic('0b00884a-f7a2-425f-93e5-599fbaad4bde')
.then(res => {
wx.hideLoading()
that.setData({
typeList: res
})
})
.catch(err => {
wx.hideLoading()
})
},
//刷新
doRefreshList() {
const _self = this
console.log('页面刷新:分类', _self.data.selType)
this.setData({
goodsList: [],
isLoadMore: false,
hasMore: true,
listRefreshTrig: true,
'pageData.page': 1,
'pageData.keywords': _self.data.keywords,
'pageData.priceOrder': _self.data.selOwner,
'pageData.priceRangeStart': _self.data.priceStart,
'pageData.priceRangeEnd': _self.data.priceEnd,
'pageData.goodsType': _self.data.selType,
})
console.log('刷新页面', _self.data.pageData.page)
_self.getIndexList(true)
},
//加载更多
doLoadMore() {
console.log('加载更多:', this.data.isLoadMore, this.data.hasMore)
const _self = this
if (_self.data.isLoadMore || !_self.data.hasMore) {
return
}
//判断是否有更多
_self.setData({
isLoadMore: true,
'pageData.page': ++_self.data.pageData.page
})
_self.getIndexList(false)
},
//获取列表
getIndexList(isRefresh) {
const _self = this
_self.setData({
listLoading: isRefresh ? 'loading' : ''
})
Shop.doGetIndexList(_self.data.pageData)
.then(res => {
console.log(res)
wx.stopPullDownRefresh()
var status = 'success'
status = res.rows && res.rows.length > 0 ? 'success' : 'empty'
const list = _self.addPrefixToPreviewImgs(res.rows)
_self.setData({
listLoading: isRefresh ? status : '',
goodsList: _self.data.goodsList.concat(list),
listRefreshTrig: false,
isLoadMore: false,
})
_self.setData({
hasMore: _self.data.goodsList.length < res.total
})
})
.catch(err => {
wx.stopPullDownRefresh()
console.log(err)
_self.setData({
listLoading: 'error',
listRefreshTrig: false,
isLoadMore: false,
hasMore: true
})
})
},
//为数据中图片添加前缀
addPrefixToPreviewImgs(data) {
const prefix = this.data.imgPrefix;
return data.map(item => {
if (item.goodsPhoto && item.goodsPhoto != '') {
item.preImg = prefix + item.goodsPhoto
}
return item;
});
},
doPublish() {
wx.navigateTo({
url: '/pages/shop/publishCopyright/publishCopyright',
})
}
})

View File

@ -0,0 +1,9 @@
{
"usingComponents": {
"custom-tabbar": "/components/tabbar/custom-tabbar",
"container-loading": "/components/container-loading/container-loading",
"mp-loading": "weui-miniprogram/loading/loading",
"mp-toptips": "weui-miniprogram/toptips/toptips"
},
"enablePullDownRefresh": true
}

View File

@ -0,0 +1,102 @@
<view class="page-container" style="background-color: white;height: 100vh;">
<view class="search-container-fixed" style="background-color: white;">
<view class="search-box">
<icon class="mr-10" type="search" size="20"></icon>
<input type="text" bindconfirm="doSearch" class="search-input" bindinput="inputKeywords" value="{{keywords}}" placeholder="请输入软著名称" />
<view bind:tap="doSearch">搜索</view>
</view>
</view>
<view class="title-box">
<view style="background-image: url('{{imgAssets}}/bg_shop_title.png');" class="title-bg">
</view>
<view class="title-container">
<text>AI喵著 为您提供一站式服务</text>
<view class="title-hint-box">
<view class="title-hint-item">
<view class="hook"></view>
<text class="title-hint-txt">选的省心</text>
</view>
<view class="title-hint-item">
<view class="hook"></view>
<text class="title-hint-txt">买的放心</text>
</view>
<view class="title-hint-item">
<view class="hook"></view>
<text class="title-hint-txt">用的安心</text>
</view>
</view>
<view class="title-func-box">
<view class="title-func-item">
<image class="func-img" src="/static/images/icon_purchase.png"></image>
<text class="func-txt">已购买</text>
</view>
<view class="title-func-item">
<image class="func-img" src="/static/images/icon_sell.png"></image>
<text class="func-txt">我要卖</text>
</view>
<view class="title-func-item">
<image class="func-img" src="/static/images/icon_betray.png"></image>
<text class="func-txt">已销售</text>
</view>
</view>
</view>
</view>
<view class="container-box">
<view class="header {{isSticky? 'sticky' :''}}">
<view class="divider-20"></view>
<view class="condition-box">
<view class="condition-item">
<view class="condition-item-title">软著分类</view>
<scroll-view scroll-x style="width: 80vw;padding-left: 20rpx;">
<view class="list-tabs">
<block wx:for="{{typeList}}" wx:key="index">
<view class="{{tools.includes(selType,item.dataId)? 'tab-select':'tab-normal' }} item-margin" bind:tap="bindChooseType" data-item="{{item}}">
<text>{{item.dataName}}</text>
</view>
</block>
</view>
</scroll-view>
</view>
<view class="condition-item mt-20">
<view class="condition-item-title">所属者类型</view>
<scroll-view scroll-x style="flex:1;">
<view class="list-tabs ml-20">
<block wx:for="{{ownerList}}" wx:key="index">
<view class="{{selOwner==item.dataId? 'tab-select':'tab-normal' }} item-margin" bind:tap="bindChooseOwner" data-item="{{item}}">
<text>{{item.dataName}}</text>
</view>
</block>
</view>
</scroll-view>
</view>
</view>
</view>
<view class="content-container" style="min-height: 600rpx;">
<view class="loading-box">
<container-loading loadingState="{{listLoading}}" style="height: 40vh;" bindrefresh="doRefreshList"></container-loading>
</view>
<view class="content-box">
<block wx:for="{{goodsList}}" wx:key="index">
<view class="content-item">
<view class="content-item-img-box">
<image src="{{item.preImg}}" class="content-item-img" mode="aspectFill"></image>
</view>
<view class="content-item-txt">{{item.goodsName}}</view>
<view class="content-item-bottom">
<rich-text class="content-item-price" nodes="{{tools.moneyTxt(8,item.goodsOpenPrice)}}"></rich-text>
<view class="content-item-time">{{item.goodsLastTime}}</view>
</view>
<view class="special-tag" wx:if="{{tools.includes(item.goodsFlag,'特价')}}">特价</view>
</view>
</block>
</view>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore && listLoading != 'empty'}}" class="no-more">
<view class="no-more-dot"></view>
</view>
</view>
</view>
</view>
<custom-tabbar tabList="{{tabList}}" color="var(--tabbar-normal-color)" selectedColor="var(--tabbar-select-color)"></custom-tabbar>
<mp-toptips delay="2000" msg="{{msgHint}}" type="{{msgType}}" show="{{msgShow}}"></mp-toptips>
<wxs src="../../../utils/comm.wxs" module="tools"></wxs>

View File

@ -0,0 +1,298 @@
.search-container-fixed {
position: fixed;
top: 0;
left: 0;
display: flex;
flex-direction: column;
box-sizing: border-box;
width: 100%;
z-index: 99;
}
.search-box {
background-color: var(--bg-gray-color);
display: flex;
flex-direction: row;
align-items: center;
margin: 0rpx 30rpx 0rpx 30rpx;
padding: 15rpx 20rpx;
border-radius: 60rpx;
font-size: 28rpx;
}
.search-input {
flex: 1;
}
.divider-20 {
background-color: var(--bg-gray-input-color);
min-height: 20rpx;
margin: 0rpx -30rpx;
}
.title-box {
position: relative;
margin-top: 60rpx;
padding: 30rpx;
}
.title-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 300rpx;
background-size: cover;
}
.title-container {
position: relative;
}
.title-hint-box {
display: flex;
flex-direction: row;
margin-top: 20rpx;
}
.title-hint-item {
display: flex;
flex-direction: row;
align-items: center;
}
.title-hint-item:nth-of-type(n+2) {
margin-left: 30rpx;
}
.title-hint-txt {
margin-left: 8rpx;
font-size: 24rpx;
color: var(--text-gray-desc-color);
}
.hook {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
background: linear-gradient(0deg, #FFB540 0%, #FF4800 100%);
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.hook::after {
content: "";
display: block;
width: 8rpx;
height: 15rpx;
border: solid white;
border-width: 0 2rpx 2rpx 0;
transform: rotate(45deg);
position: absolute;
top: 6rpx;
}
.title-func-box {
display: flex;
flex-direction: row;
margin-top: 30rpx;
}
.title-func-item {
display: flex;
flex-direction: column;
align-items: center;
}
.title-func-item:nth-of-type(n+2) {
margin-left: 40rpx;
}
.func-img {
width: 120rpx;
height: 120rpx;
}
.func-txt {
font-size: 28rpx;
color: var(--text-color);
margin-top: 15rpx;
}
.container-box {
display: flex;
flex-direction: column;
}
.header {
transition: all 0.3s;
background-color: var(--white-color);
}
.header.sticky {
position: fixed;
/* padding: 20rpx 30rpx; */
background-color: var(--white-color);
box-sizing: border-box;
padding: 20rpx 30rpx 0rpx 30rpx;
top: 70rpx;
left: 0;
right: 0;
z-index: 100;
box-shadow: 0 2rpx 4rpx var(--bg-gray-input-color);
}
.condition-box {
display: flex;
flex-direction: column;
padding: 30rpx 0rpx;
}
.condition-item {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.condition-item-title {
white-space: nowrap;
font-size: 24rpx;
}
.list-tabs {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.tab-select {
white-space: nowrap;
line-height: 17px;
border-radius: 5rpx;
background-color: var(--btn-primary-color);
color: var(--text-primary-deep-color);
font-size: 24rpx;
text-align: center;
padding: 5rpx 15rpx;
}
.tab-normal {
background-color: var(--bg-gray-input-color);
color: var(--text-gray-hint-color);
white-space: nowrap;
line-height: 17px;
border-radius: 5rpx;
font-size: 24rpx;
text-align: center;
padding: 5rpx 15rpx;
}
.item-margin {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.item-margin:nth-of-type(n+2) {
margin-left: 20rpx;
}
.content-container {
display: flex;
flex-direction: column;
margin-bottom: 180rpx;
position: relative;
}
.loading-box {
position: absolute;
top: 50%;
left: 50%;
z-index: 99;
transform: translate(-50%, -50%);
}
.content-box {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.content-item {
width: 48%;
margin-top: 20rpx;
position: relative;
}
.content-item:nth-of-type(even) {
margin-left: 20rpx;
}
.special-tag {
display: inline-block;
padding: 0rpx 20rpx;
background-color: var(--red-color);
color: #fff;
font-size: 22rpx;
border-bottom-right-radius: 30rpx;
border-top-right-radius: 30rpx;
position: absolute;
top: 0rpx;
left: 0rpx;
}
.special-tag::before {
content: '';
position: absolute;
left: 0rpx;
bottom: -15rpx;
border-width: 18rpx 18rpx 0 0rpx;
border-style: solid;
border-color: var(--red-color) transparent transparent transparent;
}
.content-item-img-box {
border-radius: 10rpx;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 20rpx;
background-color: var(--bg-gray-input-color);
}
.content-item-img {
width: 200rpx;
height: 260rpx;
}
.content-item-txt {
font-size: 28rpx;
margin-top: 15rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
}
.content-item-bottom {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.content-item-time {
font-size: 24rpx;
color: var(--text-gray-hint-color);
}
.content-item-price {
color: red;
font-size: 28rpx;
}

View File

@ -0,0 +1,449 @@
// pages/shop/publishCopyright/publishCopyright.js
import Shop from '../../../net/api/shop'
import {
upShopImgUrl
} from '../../../net/mainUrl'
const {
isValidPhone
} = require('../../../utils/validator')
const Utils = require('../../../utils/util')
const Cache = require('../../../utils/storage')
Page({
/**
* 页面的初始数据
*/
data: {
// 0b00884a-f7a2-425f-93e5-599fbaad4bde 软著分类
// ce3ded65-68ed-4f42-89da-de1b813b8f7e 证件类型
curStartDate: Utils.currentDate(),
personType: [{
dataName: '自然人',
dataId: '1'
}, {
dataName: '法人',
dataId: '2'
}, {
dataName: '非法人组织或其他',
dataId: '3'
}],
selPersonType: null,
creType: [],
rightType: [],
areaList: [], //省
cityList: [], //市
rightName: '', //软著名称
orgName: '', //著作权人姓名
orgPhone: '', //联系电话
cardNumber: '', //证件号码
selRightType: [], //选中分类
rightPrice: '', //售价
rightStopDate: '', //停止日期
selCreType: null, //选中证件类型
showArea: false,
prevValue: [0, 0], // 用于存储上一次的值
selArea: null,
selCity: null,
msgHint: '',
msgType: 'info',
msgShow: false,
files: [],
showType: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.setNavigationBarTitle({
title: '软著发布',
})
wx.setNavigationBarColor({
frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000
backgroundColor: '#F0F0F0', // 传递的颜色值,仅支持十六进制颜色
animation: { // 可选项
duration: 500,
timingFunc: 'easeIn'
}
})
this.setData({
selPersonType: this.data.personType[0],
selectFile: this.selectFile.bind(this),
uploadFile: this.uploadFile.bind(this)
})
this.getDic()
},
inputRightName(e) {
this.setData({
rightName: e.detail.value
})
},
inputRightPrice(e) {
this.setData({
rightPrice: e.detail.value
})
},
inputOrgName(e) {
this.setData({
orgName: e.detail.value
})
},
inputCardNumber(e) {
this.setData({
cardNumber: e.detail.value
})
},
//著作权人类别
bindChangePersonType(e) {
this.setData({
selPersonType: this.data.personType[e.detail.value]
})
},
clearPersonType() {
this.setData({
selPersonType: null
})
},
//证件类型
bindChangeCreType(e) {
this.setData({
selCreType: this.data.creType[e.detail.value]
})
},
clearCreType() {
this.setData({
selCreType: null
})
},
//选择软著分类
onShowRightType() {
this.setData({
showType: true
})
},
bindChangeRightType(e) {
const selectedIds = new Set(e.detail.value);
const rightTypeMap = new Map();
this.data.rightType.forEach(item => {
rightTypeMap.set(item.dataId, item);
});
const selRightType = [...selectedIds].map(id => {
const item = rightTypeMap.get(id);
if (item) {
item.checked = true;
}
return item;
}).filter(Boolean);
this.setData({
selRightType,
rightType: [...this.data.rightType]
});
},
clearRightType() {
this.data.rightType.forEach(item => {
item.checked = false
})
this.setData({
selRightType: [],
rightType: this.data.rightType
})
},
confirmSelRightType() {
this.setData({
showType: false
})
},
//显示日期选择
bindDateChange(e) {
this.setData({
rightStopDate: e.detail.value
})
},
clearTime() {
this.setData({
rightStopDate: ''
})
},
deleteImage(e) {
var index = e.detail.index;
this.data.files.splice(index, 1);
},
selectFile(files) {
console.log('files', files)
},
uploadFile(files) {
console.log(files)
const tempFilePaths = files.tempFilePaths;
const token = Cache.get('token')
const header = {}
if (token) {
header.Auth = `Bearer ${token}`;
}
var that = this
for (let i = 0; i < tempFilePaths.length; i++) {
wx.uploadFile({
url: upShopImgUrl,
header: header,
filePath: tempFilePaths[i],
name: 'image',
success(res) {
console.log(res)
let result = JSON.parse(res.data)
that.data.files.push(result.data)
},
fail(err) {
console.log(err);
}
})
}
// 文件上传的函数返回一个promise
return new Promise((resolve, reject) => {
var result = {};
result['urls'] = tempFilePaths;
resolve(result);
})
},
//显示地区选择
onShowArea() {
this.setData({
showArea: true
})
},
clearArea() {
this.setData({
selArea: null,
selCity: null
})
},
confirmSelArea() {
this.setData({
showArea: false
})
},
inputOrgPhone(e) {
this.setData({
orgPhone: e.detail.value
})
},
getDic() {
const _self = this
const cre = Shop.doGetGoodsDic('0b00884a-f7a2-425f-93e5-599fbaad4bde') //软著分类
const right = Shop.doGetGoodsDic('ce3ded65-68ed-4f42-89da-de1b813b8f7e') //证件类型
const area = Shop.doGetAreaList('0')
const list = [cre, right, area]
Promise.all(list)
.then(res => {
if (res) {
_self.setData({
rightType: res[0],
creType: res[1],
areaList: res[2]
})
_self.data.rightType.forEach(item => {
item.checked = false
})
//默认加载第一个area
_self.setData({
selCreType: _self.data.creType[0],
selArea: _self.data.areaList[0],
rightType: _self.data.rightType
})
_self.doGetArea(_self.data.selArea.areaId)
}
})
.catch(err => {
_self.setData({
msgShow: true,
msgHint: '数据加载错误,请稍后重试',
msgType: 'error'
})
setTimeout(() => {
wx.navigateBack()
}, 1500);
})
},
//获取区域
doGetArea(pId) {
wx.showLoading({
title: '加载中...',
})
const _self = this
Shop.doGetAreaList(pId)
.then(res => {
wx.hideLoading()
console.log(res)
if (res) {
_self.setData({
cityList: res,
selCity: res[0]
})
}
})
.catch(err => {
wx.hideLoading()
_self.setData({
msgShow: true,
msgHint: '数据加载错误,请稍后重试',
msgType: 'error'
})
})
},
//选中省市
areaChange(e) {
const _self = this
const currentValue = e.detail.value;
const prevValue = _self.data.prevValue;
_self.setData({
prevValue: currentValue
});
for (let i = 0; i < currentValue.length; i++) {
if (currentValue[i] !== prevValue[i]) {
if (i == 0) {
//获取city
const area = _self.data.areaList[currentValue[0]]
_self.setData({
selArea: area
})
_self.doGetArea(area.areaId)
} else {
const city = _self.data.cityList[currentValue[1]]
_self.setData({
selCity: city
})
}
}
}
},
//保存商品
doSave() {
const isLegal = this.checkParams()
if (isLegal) {
const _self = this
const data = _self.buildParams()
wx.showLoading({
title: '保存中...',
})
Shop.doSaveGoods(data)
.then(res => {
wx.hideLoading()
_self.setData({
msgType: 'success',
msgHint: '保存成功',
msgShow: true
})
setTimeout(() => {
wx.navigateBack()
}, 1500);
})
.catch(err => {
wx.hideLoading()
_self.setData({
msgType: 'error',
msgHint: err.msg ? err.msg : '网络错误,请稍后重试',
msgShow: true
})
})
}
},
//校验参数
checkParams() {
const rules = [{
field: 'rightName',
message: '请输入软著名称',
validator: v => v.trim() !== ''
},
{
field: 'selRightType',
message: '请选择软著分类',
validator: v => v !== null
},
{
field: 'rightPrice',
message: '请输入软著售价',
validator: v => v.trim() !== ''
},
{
field: 'rightStopDate',
message: '请选择截止售卖日期',
validator: v => v.trim() !== ''
},
{
field: 'files',
message: '请上传软著图片',
validator: v => v && v.length > 0
},
{
field: 'selPersonType',
message: '请选择著作权人类别',
validator: v => v !== null
},
{
field: 'orgName',
message: '请输入姓名或机构名称',
validator: v => v.trim() !== ''
},
{
field: ['selArea', 'selCity'],
message: '请选择所在省市',
validator: (_, data) => data.selArea !== null && data.selCity !== null
},
{
field: 'orgPhone',
message: '请输入合法的联系电话',
validator: v => v.trim() !== '' && isValidPhone(v.trim())
},
{
field: 'selCreType',
message: '请选择证件类型',
validator: v => v !== null
},
{
field: 'cardNumber',
message: '请输入证件号码',
validator: v => v.trim() !== ''
}
];
for (const rule of rules) {
let isValid;
if (Array.isArray(rule.field)) {
// 多字段联合验证
isValid = rule.validator(null, this.data);
} else {
// 单字段验证
const value = this.data[rule.field];
isValid = rule.validator(value, this.data);
}
if (!isValid) {
this.setData({
msgType: 'error',
msgHint: rule.message,
msgShow: true
});
return false;
}
}
return true;
},
buildParams() {
const data = {
goodsLastTime: this.data.rightStopDate,
goodsLeader: this.data.orgName,
goodsLeaderCity1: this.data.selArea.areaId,
goodsLeaderCity2: this.data.selCity.areaId,
goodsLeaderIdcard: this.data.cardNumber,
goodsLeaderIdcardType: this.data.selCreType.dataId,
goodsLeaderPhone: this.data.orgPhone,
goodsLeaderType: this.data.selPersonType.dataId,
goodsName: this.data.rightName,
goodsLocalPhoto: this.data.files[0].fileId,
goodsPrice: this.data.rightPrice,
goodsType: this.data.selRightType.dataId
}
return data
}
})

View File

@ -0,0 +1,7 @@
{
"usingComponents": {
"mp-half-screen-dialog": "weui-miniprogram/half-screen-dialog/half-screen-dialog",
"mp-toptips": "weui-miniprogram/toptips/toptips",
"mp-uploader": "weui-miniprogram/uploader/uploader"
}
}

View File

@ -0,0 +1,157 @@
<view class="page-container">
<view class="content-box">
<view class="info-title">软著信息</view>
<!-- 第一部分 -->
<view class="section">
<view class="item">
<text class="label star">软著名称</text>
<view class="select-content-item">
<input class="value {{rightName != '' ? 'v-select':''}}" placeholder="请输入软著名称" style="flex:1;align-self: center;" value="{{rightName}}" bindinput="inputRightName" />
</view>
</view>
<view class="item">
<text class="label star">软著分类</text>
<view class="select-content-no-h">
<view class="select-item-box" bind:tap="onShowRightType">
<view wx:if="{{selRightType.length<=0}}" class="value-hint">请选择软著分类</view>
<block wx:else>
<block wx:for="{{selRightType}}" wx:key="index">
<view class="select-item-item">
<text>{{item.dataName}}</text>
<view class="icon-clear" style="width: 25rpx;height: 25rpx;margin-left: 5rpx;"></view>
</view>
</block>
</block>
</view>
<view style="display: flex;flex-direction: row;">
<view wx:if="{{selRightType.length>0 }}" bind:tap="clearRightType" class="icon-clear clear-icon"></view>
<view wx:if="{{selRightType.length<=0}}" style="margin-right: 25rpx;" class="icon-arrow-solid"></view>
</view>
</view>
</view>
<view class="item">
<text class="label star">售卖价格</text>
<view class="select-content-item">
<input class="value {{rightPrice != 0 ? 'v-select':''}}" type="number" placeholder="请输入售价" style="flex:1;align-self: center;" value="{{rightPrice}}" bindinput="inputRightPrice" />
</view>
</view>
<view class="item">
<view class="label star">截止售卖日期</view>
<view class="select-content-item" style="align-items: center;">
<picker mode="date" style="flex:1;" value="{{rightStopDate}}" start="{{curStartDate}}" end="2050-01-01" bindchange="bindDateChange">
<view class="select-time {{rightStopDate ==''? 'value-hint':''}}">{{rightStopDate != ''? rightStopDate:'请选择截止售卖日期'}}</view>
</picker>
<view style="display: flex;flex-direction: row;">
<view wx:if="{{rightStopDate !=''}}" bind:tap="clearTime" class="icon-clear clear-icon"></view>
<view wx:if="{{rightStopDate==''}}" class="icon-calendar-ind clear-icon"></view>
</view>
</view>
</view>
<view class="item">
<view class="label star">软著图片</view>
<view>
<mp-uploader max-count="1" delete="true" select="{{selectFile}}" upload="{{uploadFile}}" bind:delete="deleteImage" files="{{files}}" title=""></mp-uploader>
</view>
</view>
</view>
</view>
<view class="content-box mb-80">
<view class="info-title">著作权人信息</view>
<!-- 第一部分 -->
<view class="section">
<view class="item">
<text class="label star">类别</text>
<view class="select-content-item">
<picker mode="selector" style="flex:1;" range="{{personType}}" range-key="dataName" bindchange="bindChangePersonType">
<view class="select-time {{selPersonType ==null? 'value-hint':''}}">{{selPersonType != null? selPersonType.dataName:'请选择类别'}}</view>
</picker>
<view style="display: flex;flex-direction: row;">
<view wx:if="{{selPersonType !=null}}" bind:tap="clearPersonType" class="icon-clear clear-icon"></view>
<view wx:if="{{selPersonType==null}}" style="margin-right: 25rpx;" class="icon-arrow-solid"></view>
</view>
</view>
</view>
<view class="item">
<text class="label star">姓名或机构名称</text>
<view class="select-content-item">
<input class="value {{orgName != '' ? 'v-select':''}}" placeholder="请输入姓名或机构名称" style="flex:1;align-self: center;" value="{{orgName}}" bindinput="inputOrgName" />
</view>
</view>
<view class="item">
<text class="label star">所在省市</text>
<view class="select-content-item">
<view bind:tap="onShowArea" class="select-time {{selArea ==null? 'value-hint':''}}">{{selArea != null? selArea.areaName+'/'+selCity.areaName:'请选择所在省市'}}</view>
<view style="display: flex;flex-direction: row;">
<view wx:if="{{selArea !=null}}" bind:tap="clearArea" class="icon-clear clear-icon"></view>
<view wx:if="{{selArea==null}}" style="margin-right: 25rpx;" class="icon-arrow-solid"></view>
</view>
</view>
</view>
<view class="item">
<text class="label star">联系电话</text>
<view class="select-content-item">
<input class="value {{orgPhone != '' ? 'v-select':''}}" placeholder="请输入联系电话" style="flex:1;align-self: center;" value="{{orgPhone}}" bindinput="inputOrgPhone" />
</view>
</view>
<view class="item">
<text class="label star">证件类型</text>
<view class="select-content-item">
<picker mode="selector" style="flex:1;" range="{{creType}}" range-key="dataName" bindchange="bindChangeCreType">
<view class="select-time {{selCreType ==null? 'value-hint':''}}">{{selCreType != null? selCreType.dataName:'请选择证件类型'}}</view>
</picker>
<view style="display: flex;flex-direction: row;">
<view wx:if="{{selCreType !=null}}" bind:tap="clearCreType" class="icon-clear clear-icon"></view>
<view wx:if="{{selCreType==null}}" style="margin-right: 25rpx;" class="icon-arrow-solid"></view>
</view>
</view>
</view>
<view class="item">
<text class="label star">证件号码</text>
<view class="select-content-item">
<input class="value {{cardNumber != '' ? 'v-select':''}}" placeholder="请输入证件号码" style="flex:1;align-self: center;" value="{{cardNumber}}" bindinput="inputCardNumber" />
</view>
</view>
</view>
</view>
<view class="bottom-fixed-footer">
<view class="bottom-btn-green" bind:tap="doSave">保存</view>
</view>
</view>
<!-- 软著分类 -->
<mp-half-screen-dialog show="{{showType}}" ext-class="custom-dialog">
<view slot="title" style="font-size: 16px;font-weight: bold;">软件分类</view>
<view slot="desc" style="margin-top: 10rpx;">
<scroll-view scroll-y style="height: 400rpx;">
<view style="display: flex;flex-direction: row;flex-wrap: wrap;">
<checkbox-group bindchange="bindChangeRightType" style="display: flex;flex-direction: row;flex-wrap: wrap;">
<block wx:for="{{rightType}}" wx:key="dataId">
<checkbox checked="{{item.checked}}" value="{{item.dataId}}" class="custom-wx-checkbox" style="display: flex;flex-direction: row;padding: 8rpx 15rpx;">
<view>{{item.dataName}}</view>
</checkbox>
</block>
</checkbox-group>
</view>
</scroll-view>
</view>
<view slot="footer">
<view class="bottom-btn-green" bind:tap="confirmSelRightType">确定</view>
</view>
</mp-half-screen-dialog>
<!-- 所在省市 -->
<mp-half-screen-dialog show="{{showArea}}" ext-class="custom-dialog">
<view slot="title" style="font-size: 16px;font-weight: bold;">省市</view>
<view slot="desc" style="margin-top: 10rpx;">
<picker-view indicator-style="height: 50px;" value="{{prevValue}}" style="width: 100%; height: 400rpx;" bindchange="areaChange">
<picker-view-column>
<view style="line-height: 50px;text-align: center;" wx:for="{{areaList}}" wx:key="index">{{item.areaName}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{cityList}}" wx:key="index" style="line-height: 50px;text-align: center;">{{item.areaName}}</view>
</picker-view-column>
</picker-view>
</view>
<view slot="footer">
<view class="bottom-btn-green" bind:tap="confirmSelArea">确定</view>
</view>
</mp-half-screen-dialog>
<mp-toptips delay="2000" msg="{{msgHint}}" type="{{msgType}}" show="{{msgShow}}"></mp-toptips>

View File

@ -0,0 +1,195 @@
/* pages/shop/publishCopyright/publishCopyright.wxss */
.content-box {
border-radius: 20rpx;
padding: 20rpx;
background-color: var(--white-color);
margin-top: 20rpx;
}
.info-title {
font-size: 36rpx;
font-weight: bold;
display: flex;
flex-direction: row;
align-items: center;
}
.info-title::before {
content: "";
width: 10rpx;
height: 36rpx;
margin-right: 8rpx;
border-left: 10rpx solid var(--primary-color);
border-radius: 4rpx;
vertical-align: middle;
}
.section {
margin-bottom: 15rpx;
}
.item {
display: flex;
flex-direction: column;
margin-bottom: 10rpx;
padding: 20rpx 10rpx;
font-size: 28rpx;
}
.label {
color: var(--text-color);
font-weight: bold;
}
.select-content {
margin-top: 15rpx;
display: flex;
height: 70rpx;
flex-direction: row;
border-radius: 5rpx;
background-color: var(--bg-gray-input-color);
padding: 0rpx 10rpx;
}
.select-content-no-h {
margin-top: 15rpx;
display: flex;
flex-direction: row;
align-items: center;
min-height: 70rpx;
flex-direction: row;
border-radius: 5rpx;
background-color: var(--bg-gray-input-color);
padding: 0rpx 15rpx;
}
.select-content-item {
margin-top: 15rpx;
display: flex;
flex-direction: row;
align-items: center;
height: 70rpx;
flex-direction: row;
border-radius: 5rpx;
background-color: var(--bg-gray-input-color);
padding: 0rpx 15rpx;
}
.select-item-box {
flex: 1;
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding: 5rpx;
}
.select-item-item {
display: flex;
flex-direction: row;
align-items: center;
background-color: var(--divider-color);
padding: 5rpx 15rpx;
border-radius: 5rpx;
}
.select-item-item:nth-of-type(n+1) {
margin: 8rpx;
}
.desc {
flex: 1;
color: #999;
text-align: left;
padding-left: 20rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
padding-right: 10px;
align-items: center;
}
.select-time {
color: var(--text-color);
flex: 1;
font-size: 28rpx;
text-align: left;
}
.clear-icon {
width: 20px;
height: 20px;
margin-right: 20rpx;
}
.value {
flex: 1;
text-align: left;
font-size: 28rpx;
}
.value-hint {
color: var(--text-gray-hint-color);
}
.v-select {
color: var(--text-color);
}
.v-normal {
color: var(--text-gray-hint-color)
}
.custom-dialog {
background-color: var(--white-color);
}
.custom-tips {
margin-top: 80px;
}
/* 上传图片 */
.weui-uploader {
margin-top: 10rpx;
width: 100%;
}
.weui-uploader__bd {
display: flex;
flex-direction: row;
margin-bottom: 0;
}
.weui-uploader__hd {
display: none;
}
.weui-uploader__input-box {
width: 65px;
height: 65px;
border-radius: 5px;
}
.weui-uploader__file {
width: 65px;
height: 65px;
border-radius: 5px;
}
.weui-uploader__img {
border-radius: 5px;
}
.weui-uploader__overview {
display: flex;
flex-direction: row;
justify-content: space-between;
width: 65vw;
}
.weui-uploader__input-box {
background: white;
border: 1px solid var(--divider-color);
}

BIN
static/images/icon_betray.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
static/images/icon_buy.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
static/images/icon_purchase.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
static/images/icon_sell.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -20,6 +20,7 @@ page {
--text-gray-hint-color: #9A9A9A;
--text-gray-desc-color: #5c5c5c;
--text-blue-color: #3270FF;
--text-primary-deep-color: #FF6700;
/* 背景棕色 */
--bg-brown-color: #42210B;
--bg-gray-color: #FAFAFA;

View File

@ -96,6 +96,9 @@ var coverTxt = function (price) {
var moneyTxt = function (size, price) {
return '<span style="font-size:' + size + 'px;">¥</span>' + price
}
var includes = function (str, target) {
return str && str.indexOf(target) !== -1;
}
var payType = function (type) {
// 充值1|支出2|提现3|系统扣款4|订单收入5|付款6)
var typeStr = '支出'
@ -379,5 +382,6 @@ module.exports = {
repairStatusColor: repairStatusColor,
repairType: repairType,
repairKind: repairKind,
phoneNum: phoneNum
phoneNum: phoneNum,
includes: includes
};

View File

@ -37,8 +37,8 @@ const tabList = [{
"hasMsg": false
},
{
"pagePath": "pages/shop/market",
"text": "软著市场",
"pagePath": "pages/shop/market/market",
"text": "商城",
"iconPath": "/static/images/ic_home_normal.png",
"selectedIconPath": "/static/images/ic_home_select.png",
"selected": false,

View File

@ -91,6 +91,16 @@ const formatDate = date => {
return [year, month, day].map(formatNumber).join('-')
}
/**
* 获取当前日期
*/
const currentDate = () => {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份+10~11
const day = String(now.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
const formatNumber = n => {
n = n.toString()
@ -198,5 +208,6 @@ module.exports = {
removeImgStyle: removeImgStyleFromRichText,
dateTimePicker: dateTimePicker,
pxToRpx: pxToRpx,
random32Str: random32Str
random32Str: random32Str,
currentDate: currentDate
}