mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 09:55:16 +08:00
Merge branch 'master' of https://gitee.com/tottimctj/Hope-Mall
# Conflicts: # hope-winery/src/main/java/com/ruoyi/winery/component/MiniComponent.java # hope-winery/src/main/java/com/ruoyi/winery/controller/NewsContentController.java
This commit is contained in:
commit
52bcb6669f
6
.gitignore
vendored
6
.gitignore
vendored
@ -2,7 +2,10 @@
|
||||
# Build Tools
|
||||
|
||||
.gradle
|
||||
*/node_modules/*
|
||||
mini-app/weapp
|
||||
/build/
|
||||
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
target/
|
||||
@ -39,6 +42,9 @@ nbdist/
|
||||
*.xml.versionsBackup
|
||||
*.swp
|
||||
|
||||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
|
||||
|
||||
|
||||
11
Dockerfile
11
Dockerfile
@ -1,5 +1,6 @@
|
||||
FROM java:8-alpine
|
||||
WORKDIR /app
|
||||
COPY ruoyi-admin.jar /app/app.jar
|
||||
ENTRYPOINT ["java","-Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC","-jar","/app/app.jar"]
|
||||
|
||||
FROM openjdk:8-jre-alpine
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
##安装字体
|
||||
RUN apk --no-cache add ttf-dejavu
|
||||
COPY ruoyi-admin.jar /app/app.jar
|
||||
ENTRYPOINT ["java","-Duser.timezone=GMT+08","-jar","/app/app.jar"]
|
||||
|
||||
12
deploy.sh → deploy_backend.sh
Executable file → Normal file
12
deploy.sh → deploy_backend.sh
Executable file → Normal file
@ -1,15 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
imageName="wine"
|
||||
imageName="mall"
|
||||
|
||||
echo "==========打包========="
|
||||
mvn clean package -Dmaven.test.skip=true
|
||||
mvn clean package -P prod -Dmaven.test.skip=true
|
||||
echo "==========上传服务器========="
|
||||
scp ruoyi-admin/target/ruoyi-admin.jar root@62.234.123.172:/root/wine/
|
||||
scp Dockerfile root@62.234.123.172:/root/wine/
|
||||
scp ruoyi-admin/target/ruoyi-admin.jar root@192.144.217.65:/root/mall/
|
||||
scp Dockerfile root@192.144.217.65:/root/mall/
|
||||
echo "==========远程执行========="
|
||||
ssh root@62.234.123.172 > /dev/null 2>&1 << eeooff
|
||||
cd /root/wine
|
||||
ssh root@192.144.217.65 > /dev/null 2>&1 << eeooff
|
||||
cd /root/mall
|
||||
docker build -t $imageName .
|
||||
docker stop $imageName
|
||||
docker rm $imageName
|
||||
14
deploy_frontend.sh
Normal file
14
deploy_frontend.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
path="/data/mall/"
|
||||
|
||||
echo "==========打包========="
|
||||
cd ruoyi-ui
|
||||
npm run build:prod
|
||||
echo "==========删除旧静态页面目录========="
|
||||
ssh -t root@62.234.115.161 rm -rf $path
|
||||
echo "==========创建目录========="
|
||||
ssh -t root@62.234.115.161 mkdir $path
|
||||
echo "==========上传服务器========="
|
||||
scp -r dist/* root@62.234.115.161:$path
|
||||
echo "==========部署完成========="
|
||||
3734
doc/2021-01-15.sql
Normal file
3734
doc/2021-01-15.sql
Normal file
File diff suppressed because one or more lines are too long
8079
doc/2021-01-21.sql
Normal file
8079
doc/2021-01-21.sql
Normal file
File diff suppressed because one or more lines are too long
126
doc/代码约定.md
Normal file
126
doc/代码约定.md
Normal file
@ -0,0 +1,126 @@
|
||||
# 代码约定
|
||||
|
||||
#### 1.类文件名以大写驼峰开始,内部主类(class)保持与文件名一致,方便查询。
|
||||
|
||||
#### 2.每个类请标注注释 (特别是拼音缩写起名的类把拼音字母所对应的汉字请标注上)
|
||||
|
||||
```
|
||||
【例】
|
||||
//用于xxx的一个类
|
||||
class MyClass {
|
||||
}
|
||||
```
|
||||
|
||||
#### 3.如果是页面尽量用 xxPage命名,功能拥有复数页面的时候,其首页尽量用xxIndexPage命名。
|
||||
|
||||
```
|
||||
【例】
|
||||
HomePage //首页
|
||||
NewsIndexPage //新闻首页
|
||||
NewsInfoPage //新闻咨询页
|
||||
```
|
||||
|
||||
#### 4.变量命名
|
||||
|
||||
①布尔值请用can/is标记开头命名
|
||||
②int double 如不是width height count等能容易联想到的名字,尽量命名成xxxNum等容易联想的形式.
|
||||
③String型同理 如果不是name title lable等容易联想到的名字,尽量命名成xxxStr/xxxText等容易联想的名字。
|
||||
④类成员变量请用private(小写驼峰命名)
|
||||
|
||||
```
|
||||
【例】
|
||||
int count;
|
||||
var myPage;
|
||||
```
|
||||
|
||||
如是固定参数用,不会改变的变量请在初始化前使用final const开头以区分
|
||||
|
||||
|
||||
```
|
||||
【例】
|
||||
const Color clRed = Colors(0xFFFF0000);
|
||||
final List<String> pageValueList = ["第一","第二","第三"]
|
||||
```
|
||||
|
||||
#### 5.if文等逻辑表达式 判断条件如有两个表达式的时候 请将两个表达式分别用小括号引上
|
||||
|
||||
```
|
||||
【例】
|
||||
错误例: if ( a+1==b && b+2==c) {} ❌
|
||||
正确例: if ((a+1==b) && (b+2==c)) {} ✅
|
||||
|
||||
```
|
||||
|
||||
如更复杂三个及以上表达式的时候请整理各结果方便事后查阅
|
||||
|
||||
```
|
||||
【反例】
|
||||
if ((a=b) && (b=c) || (c=a)) {}
|
||||
```
|
||||
|
||||
```
|
||||
【推荐例】
|
||||
bool isAEqualB = (a==b);
|
||||
bool isBEqualC = (b==c);
|
||||
bool isAEqualC = (a==c);
|
||||
bool isResult = isAEqualB && isBEqualC && isAEqualC;
|
||||
if (isResult) {}
|
||||
```
|
||||
|
||||
#### 6.代码if/for嵌套花括号的层级不要太深(尽量控制在两层之内):
|
||||
|
||||
```
|
||||
【反例】
|
||||
if (isA) {
|
||||
if (isB) {
|
||||
if (isC) {
|
||||
处理1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
处理2
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
【正例】
|
||||
if (!isA) {
|
||||
处理2
|
||||
return
|
||||
}
|
||||
if (!isB) {
|
||||
return
|
||||
}
|
||||
if (isC) {
|
||||
处理1
|
||||
}
|
||||
```
|
||||
|
||||
#### 7.为防止bug,禁止浮点变量用“==”或“!=”与任何数字比较。
|
||||
【禁止用int和double不同变量做等于==”或“!=”判断】
|
||||
(会因为精度不同导致结果误差,如比较请同时转成int或者double,具体请百度)
|
||||
|
||||
#### 8.表示状态的迁移变化的变量 尽量使用enum
|
||||
|
||||
```
|
||||
【不推荐例】
|
||||
int currentPage = 1;
|
||||
changePage(int pageNum)
|
||||
```
|
||||
|
||||
```
|
||||
【推荐例】
|
||||
enum PageType {
|
||||
PAGE1,
|
||||
PAGE2
|
||||
}
|
||||
PageType currentPage = PageType.PAGE1;
|
||||
changePage(PageType pageType)
|
||||
```
|
||||
|
||||
#### 9.每个函数Widget函数的原则不建议超过40行.超过了请整理各要素和封装逻辑,以便维护。(防止行对齐都到屏幕外面去了)
|
||||
|
||||
#### 10.异步类方法/函数(async/Future<T>等)起名时候加定冠词do/run等方便识别.
|
||||
|
||||
#### 11.代码每个函数尽量控制到30行以内,超过30行请尝试封装重构
|
||||
|
||||
0
doc/积分设计.md
Normal file
0
doc/积分设计.md
Normal file
6
doc/葡萄酒贩卖相关信息.md
Normal file
6
doc/葡萄酒贩卖相关信息.md
Normal file
@ -0,0 +1,6 @@
|
||||
小程序
|
||||
账号:luhuanongjy@163.com
|
||||
密码:lhnjy789
|
||||
|
||||
appid: wx4306452d346f783d
|
||||
secret: dc55bc1729090bdff9b63e1a5f0d03b2
|
||||
BIN
doc/证书相关/1605949156_20210122_cert/apiclient_cert.p12
Normal file
BIN
doc/证书相关/1605949156_20210122_cert/apiclient_cert.p12
Normal file
Binary file not shown.
23
doc/证书相关/1605949156_20210122_cert/apiclient_cert.pem
Normal file
23
doc/证书相关/1605949156_20210122_cert/apiclient_cert.pem
Normal file
@ -0,0 +1,23 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIID7DCCAtSgAwIBAgIUbDT71zU75w5Z4yw5CWCfJLSdY4swDQYJKoZIhvcNAQEL
|
||||
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
|
||||
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
|
||||
Q0EwHhcNMjEwMTIyMDkyMzA4WhcNMjYwMTIxMDkyMzA4WjB+MRMwEQYDVQQDDAox
|
||||
NjA1OTQ5MTU2MRswGQYDVQQKDBLlvq7kv6HllYbmiLfns7vnu58xKjAoBgNVBAsM
|
||||
IeWugeWkj+mcsuWNjua1k+mFkuS4muaciemZkOWFrOWPuDELMAkGA1UEBgwCQ04x
|
||||
ETAPBgNVBAcMCFNoZW5aaGVuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
|
||||
AQEAoGdajHnrQQqVIr0fxt1pcP/J/SAAf5JYdQS2bkgZCsn6mzTX52NTiz5TKPDs
|
||||
4Nt6BAD6ObLGMMDBiIzqI9olf6wBqpkjVSfofDdv/tQTYohVrSyNJiSlhfohqYVj
|
||||
9X0pPkGKaNyqrxXnUHdW66VqDh1njQL8HyrIQXF0rKWJwz5YfMxNSrduY1YnBnIP
|
||||
rU7Od6w/CRHnO51aHNldwaZ0MT6QJAkHy9VkW6cIIxRzZGOJFR54PS9xm39rrWZn
|
||||
tAU8F7hg8gufZCDoX0g7X+5pXep7bIMgU78TGVLZr0/IUQaVyMHLF8Gs2NrjV/P1
|
||||
NtOzclnM++13IxCXj9I4O5MzzQIDAQABo4GBMH8wCQYDVR0TBAIwADALBgNVHQ8E
|
||||
BAMCBPAwZQYDVR0fBF4wXDBaoFigVoZUaHR0cDovL2V2Y2EuaXRydXMuY29tLmNu
|
||||
L3B1YmxpYy9pdHJ1c2NybD9DQT0xQkQ0MjIwRTUwREJDMDRCMDZBRDM5NzU0OTg0
|
||||
NkMwMUMzRThFQkQyMA0GCSqGSIb3DQEBCwUAA4IBAQBy9i1tNQ2mIbY7w+m2OC6U
|
||||
cygVVozbh0+q2ej97JQ9WbE4Fl+0OVVedzG7GjEadRP3ji/wu+lVIPxjw2rnpS2a
|
||||
riDGeS0oGC+8Sjz3W+aOKToNcb2j6W9KJU1kttvf+98U9Cf8vR8c2/ow/8kdaGJE
|
||||
NRGjIlR2kwbQZFSv/mBypwqDIwNCT2Z73tx2QMnkLqFRqzO/lqnVGfIraaL/+SCd
|
||||
rnDOTCtL9SnzQiHMQwx/kWtI641y4EV4UAnJKawbR8L90ely751sNuOMLWs+Xzgg
|
||||
qIsvvfVshkueM9ZyseksRO8GVFSF4njk1iwiSsfGTQpj1PvWFT9pOHAODSTtM0VL
|
||||
-----END CERTIFICATE-----
|
||||
28
doc/证书相关/1605949156_20210122_cert/apiclient_key.pem
Normal file
28
doc/证书相关/1605949156_20210122_cert/apiclient_key.pem
Normal file
@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCgZ1qMeetBCpUi
|
||||
vR/G3Wlw/8n9IAB/klh1BLZuSBkKyfqbNNfnY1OLPlMo8Ozg23oEAPo5ssYwwMGI
|
||||
jOoj2iV/rAGqmSNVJ+h8N2/+1BNiiFWtLI0mJKWF+iGphWP1fSk+QYpo3KqvFedQ
|
||||
d1brpWoOHWeNAvwfKshBcXSspYnDPlh8zE1Kt25jVicGcg+tTs53rD8JEec7nVoc
|
||||
2V3BpnQxPpAkCQfL1WRbpwgjFHNkY4kVHng9L3Gbf2utZme0BTwXuGDyC59kIOhf
|
||||
SDtf7mld6ntsgyBTvxMZUtmvT8hRBpXIwcsXwazY2uNX8/U207NyWcz77XcjEJeP
|
||||
0jg7kzPNAgMBAAECggEALEI4Tth5HBoyakJq2TFQnbhGYIyK9qhHtgoV2DoWhs6S
|
||||
Um7zP8o9TAdnZL2NbsHAWgh3AqKcYulcvTO8iyXvANpSH2Nfx2hakqOtSE/2BVL+
|
||||
6OiJDcRA08Xfsem3Wg4t6hqleSeiBOtzRtWW6zBaIgjlAJiZPnRMixomClkmuPMz
|
||||
9oVy4JPy1vunYRfswwEcqa50NJkxqTBHZttrr2+9QKmnShc/kcsb7Okof7hUpJ70
|
||||
p0TOiJC0FdUnqhozI4GZcYXgMXW9CNDOywBl7Y3r/7nEcW4dJgZSG6+juUs4ntF7
|
||||
xpHL8Zk5XxxWgI6zc5mHrd5H/0bSJugQpseiKrw71QKBgQDVffyMYfoHO49A6Zur
|
||||
dxZkJBhpqYeMeMtXuFm23FdkOo4DhM4j2J2TkxUEdhZEGIUeh42+RBLcmND3n6wE
|
||||
zCfcv/VbiUxP3uimjR1MS5aYXgMFjrVtbfihP5mJ4zq5ipdVjKtGAA8pZsCREEUa
|
||||
ar9Guzn5//XUsqqCWgOlnYp+0wKBgQDAV18dgmM7QXNeJydQiN7SHSuyVYL9P734
|
||||
Crti9WY2ntx+Pf4XVtSxT/O4Q3Dvj/9phC/acaBYfwEb0uwLpYAtkLXuEuLsKLwT
|
||||
9IYeqWATg5EoRPivbVl9syK378XO8OAohWYPfDkwWpedpy7RtESgB1LuwJTen8PL
|
||||
PgrPr2Ye3wKBgFAsHsINLRq4OCS1VZs/fm4ey/gqDNgoqJwJg89S0ZK3FoulvM/j
|
||||
UdGQg20Id3YdCyia2RThdX/X92l2Ud//VtzkTVyRo9G+sPmStrTnEeeoLlRQ8jrk
|
||||
+GB9hMguR+hTbl9XEx6XeRogFyKizICOI8SJHM2QXJ4Cdlu7N/Fixxa3AoGAFhNx
|
||||
JU/r18dBWJMh3gp3mKIke8l4yVxhj3Cb5VXJL4e4Qv0WhtM+gkNs87853SUn6ZJ0
|
||||
c5wLDV02YV0qHoQWXCR53SNpzDU4sQmlwyspjdPR+08/Q9NHLDg9SeNJTuEyuTPm
|
||||
bOyTG8uqDzw7EXKhVcTBbgnIjGzF6jPqxb+Z9v0CgYEAmsek53w4UJyR9TsKI//c
|
||||
pEVokUCt/Ntm1CQkSbdYPx1JZnhMNYBkhfsB8yNPMZ+kh73qbk/Wz4iQzoO4THU2
|
||||
UI122PNGSkzIplqGcTF9LmJXzW5FRuRZ18Aa2gDcshpOrevk2HIwp/WWa5DqENaX
|
||||
fL8BpgJsNOYfriXUYJciBts=
|
||||
-----END PRIVATE KEY-----
|
||||
18
doc/证书相关/1605949156_20210122_cert/证书使用说明.txt
Normal file
18
doc/证书相关/1605949156_20210122_cert/证书使用说明.txt
Normal file
@ -0,0 +1,18 @@
|
||||
欢迎使用微信支付!
|
||||
附件中的三份文件(证书pkcs12格式、证书pem格式、证书密钥pem格式),为接口中强制要求时需携带的证书文件。
|
||||
证书属于敏感信息,请妥善保管不要泄露和被他人复制。
|
||||
不同开发语言下的证书格式不同,以下为说明指引:
|
||||
证书pkcs12格式(apiclient_cert.p12)
|
||||
包含了私钥信息的证书文件,为p12(pfx)格式,由微信支付签发给您用来标识和界定您的身份
|
||||
部分安全性要求较高的API需要使用该证书来确认您的调用身份
|
||||
windows上可以直接双击导入系统,导入过程中会提示输入证书密码,证书密码默认为您的商户号(如:1900006031)
|
||||
证书pem格式(apiclient_cert.pem)
|
||||
从apiclient_cert.p12中导出证书部分的文件,为pem格式,请妥善保管不要泄漏和被他人复制
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -clcerts -nokeys -in apiclient_cert.p12 -out apiclient_cert.pem
|
||||
证书密钥pem格式(apiclient_key.pem)
|
||||
从apiclient_cert.p12中导出密钥部分的文件,为pem格式
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem
|
||||
备注说明:
|
||||
由于绝大部分操作系统已内置了微信支付服务器证书的根CA证书, 2018年3月6日后, 不再提供CA证书文件(rootca.pem)下载
|
||||
@ -6,6 +6,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.github.binarywang.wxpay.util.SignUtils;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
@ -26,7 +27,6 @@ import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.winery.config.wx.WxMiniProperties;
|
||||
import com.ruoyi.winery.domain.winery.WineryMauser;
|
||||
import com.ruoyi.winery.service.IWineryMauserService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -35,7 +35,6 @@ import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
@ -80,82 +79,111 @@ public class MiniComponent {
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private IWineryMauserService iWineryMauserService;
|
||||
|
||||
public WxMaJscode2SessionResult login(String code) throws WxErrorException {
|
||||
|
||||
public WxMaJscode2SessionResult login(String code, Long deptId) throws WxErrorException {
|
||||
|
||||
WxMaJscode2SessionResult sessionInfo = wxMaService.getUserService().getSessionInfo(code);
|
||||
|
||||
WineryMauser user = wineryMauserService.getById(sessionInfo.getOpenid());
|
||||
WineryMauser user = wineryMauserService.getOne(
|
||||
new LambdaQueryWrapper<WineryMauser>()
|
||||
.eq(WineryMauser::getDeptId, deptId)
|
||||
.eq(WineryMauser::getOpenId, sessionInfo.getOpenid())
|
||||
);
|
||||
String key = sessionInfo.getOpenid();
|
||||
redisCache.setCacheObject(key, sessionInfo.getSessionKey(), 7200, TimeUnit.SECONDS);
|
||||
if (user == null) {
|
||||
user = new WineryMauser();
|
||||
user.setOpenId(sessionInfo.getOpenid());
|
||||
user.setDeptId(deptId);
|
||||
log.info("新增user:{}", user);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(sessionInfo.getUnionid())) {
|
||||
user.setUnionId(sessionInfo.getUnionid());
|
||||
}
|
||||
|
||||
user.setStatus(0);
|
||||
wineryMauserService.saveOrUpdate(user);
|
||||
|
||||
return sessionInfo;
|
||||
}
|
||||
|
||||
public AjaxResult registration(String openid, String mobile) {
|
||||
|
||||
public AjaxResult registration(String openid, String mobile, String nickName, Long deptId, String avatar) {
|
||||
|
||||
SysUser user = new SysUser();
|
||||
|
||||
user.setUserName(openid);
|
||||
String userName = MINI_USER_SYMBOL + openid + "-" + deptId;
|
||||
user.setUserName(userName);
|
||||
user.setPhonenumber(mobile);
|
||||
|
||||
user.setNickName(mobile);
|
||||
user.setDeptId(MINI_DEPTID);
|
||||
user.setNickName(nickName);
|
||||
user.setDeptId(deptId);
|
||||
user.setAvatar(avatar);
|
||||
user.setPassword(MINI_DEFUALT_PASSWORD);
|
||||
user.setRoleIds(new Long[]{MINI_DEFUALT_ROLEID});
|
||||
user.setPostIds(new Long[]{MINI_DEFUALT_POSTID});
|
||||
|
||||
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
|
||||
return AjaxResult.error("新增用户" + user.getUserName() + "失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
}
|
||||
|
||||
//
|
||||
// else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
// && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
// return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
// }
|
||||
|
||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(MINI_MANAGE_USER);
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return userService.insertUser(user) > 0 ? AjaxResult.success(user) : AjaxResult.error();
|
||||
|
||||
|
||||
// 创建查找小程序用户
|
||||
WineryMauser wineryMauser = iWineryMauserService.getOne(
|
||||
new LambdaQueryWrapper<WineryMauser>()
|
||||
.eq(WineryMauser::getOpenId, openid)
|
||||
.eq(WineryMauser::getDeptId, user.getDeptId()));
|
||||
|
||||
if (wineryMauser == null) {
|
||||
wineryMauser = new WineryMauser(user);
|
||||
}
|
||||
|
||||
if (userService.insertUser(user) > 0 && iWineryMauserService.saveOrUpdate(wineryMauser)) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put(Constants.TOKEN, loginByMini(userName));
|
||||
return ajax;
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序登录
|
||||
*
|
||||
* @param openId
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
public String loginByMini(String openId) {
|
||||
public String loginByMini(String userName) {
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
try {
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager
|
||||
.authenticate(new UsernamePasswordAuthenticationToken(openId, MINI_DEFUALT_PASSWORD));
|
||||
.authenticate(new UsernamePasswordAuthenticationToken(userName, MINI_DEFUALT_PASSWORD));
|
||||
} catch (Exception e) {
|
||||
if (e instanceof BadCredentialsException) {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(openId, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
} else {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(openId, Constants.LOGIN_FAIL, e.getMessage()));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGIN_FAIL, e.getMessage()));
|
||||
throw new CustomException(e.getMessage());
|
||||
}
|
||||
}
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(openId, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
// 生成token
|
||||
return tokenService.createToken(loginUser);
|
||||
@ -171,7 +199,12 @@ public class MiniComponent {
|
||||
public String getMobile(JSONObject json) {
|
||||
|
||||
String openid = json.getStr("openid");
|
||||
WineryMauser user = wineryMauserService.getById(openid);
|
||||
String deptId = json.getStr("deptId");
|
||||
// 创建查找小程序用户
|
||||
WineryMauser user = iWineryMauserService.getOne(
|
||||
new LambdaQueryWrapper<WineryMauser>()
|
||||
.eq(WineryMauser::getOpenId, openid)
|
||||
.eq(WineryMauser::getDeptId, deptId));
|
||||
|
||||
JSONObject detail = json.getJSONObject("detail");
|
||||
String encryptedData = detail.getStr("encryptedData");
|
||||
@ -209,7 +242,6 @@ public class MiniComponent {
|
||||
|
||||
Map<String, String> params = json.toBean(HashMap.class);
|
||||
|
||||
|
||||
json.set("sign", SignUtils.createSign(params, "HMAC-SHA256", wxMiniProperties.getMchKey(), (String[]) null));
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,166 @@
|
||||
package com.ruoyi.winery.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.winery.domain.AppActivity;
|
||||
import com.ruoyi.winery.service.IAppActivityService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 活动Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-20
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/winery/activity")
|
||||
public class AppActivityController extends BaseController {
|
||||
|
||||
private final IAppActivityService iAppActivityService;
|
||||
|
||||
/**
|
||||
* 查询活动列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:activity:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppActivity appActivity) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<AppActivity> lqw = Wrappers.lambdaQuery(appActivity);
|
||||
if (StringUtils.isNotBlank(appActivity.getUrl())) {
|
||||
lqw.eq(AppActivity::getUrl, appActivity.getUrl());
|
||||
}
|
||||
if (appActivity.getType() != null) {
|
||||
lqw.eq(AppActivity::getType, appActivity.getType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appActivity.getImage())) {
|
||||
lqw.eq(AppActivity::getImage, appActivity.getImage());
|
||||
}
|
||||
if (appActivity.getImageHeight() != null) {
|
||||
lqw.eq(AppActivity::getImageHeight, appActivity.getImageHeight());
|
||||
}
|
||||
lqw.orderByAsc(AppActivity::getSort);
|
||||
List<AppActivity> list = iAppActivityService.list(lqw);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出活动列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:activity:export')")
|
||||
@Log(title = "活动", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(AppActivity appActivity) {
|
||||
LambdaQueryWrapper<AppActivity> lqw = new LambdaQueryWrapper<AppActivity>(appActivity);
|
||||
List<AppActivity> list = iAppActivityService.list(lqw);
|
||||
ExcelUtil<AppActivity> util = new ExcelUtil<AppActivity>(AppActivity.class);
|
||||
return util.exportExcel(list, "activity");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:activity:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
return AjaxResult.success(iAppActivityService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增活动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:activity:add')")
|
||||
@Log(title = "活动", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AppActivity appActivity) {
|
||||
return toAjax(iAppActivityService.save(appActivity) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改活动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:activity:edit')")
|
||||
@Log(title = "活动", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppActivity appActivity) {
|
||||
return toAjax(iAppActivityService.updateById(appActivity) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除活动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:activity:remove')")
|
||||
@Log(title = "活动", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(iAppActivityService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核中接口
|
||||
*/
|
||||
@GetMapping("/open/hotSwitch")
|
||||
public AjaxResult openHotSwitch() {
|
||||
return AjaxResult.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 首页跑马灯
|
||||
*/
|
||||
@GetMapping("/open/notice")
|
||||
public AjaxResult openNotice() {
|
||||
// String notice =
|
||||
// "手机尾号4707的用户购买了「山之语·赤霞珠干红葡萄酒」, " +
|
||||
// "手机尾号5266的用户购买了「2021辛丑牛年纪念酒」" +
|
||||
// "手机尾号3062的用户购买了「留世传奇红葡萄酒」";
|
||||
|
||||
String notice = "客服热线请致电:17395097925";
|
||||
return AjaxResult.success(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询活动列表(开放)
|
||||
*/
|
||||
@GetMapping("/open/list")
|
||||
public TableDataInfo openList(AppActivity appActivity) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<AppActivity> lqw = Wrappers.lambdaQuery(appActivity);
|
||||
if (StringUtils.isNotBlank(appActivity.getUrl())) {
|
||||
lqw.eq(AppActivity::getUrl, appActivity.getUrl());
|
||||
}
|
||||
if (appActivity.getType() != null) {
|
||||
lqw.eq(AppActivity::getType, appActivity.getType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appActivity.getImage())) {
|
||||
lqw.eq(AppActivity::getImage, appActivity.getImage());
|
||||
}
|
||||
if (appActivity.getImageHeight() != null) {
|
||||
lqw.eq(AppActivity::getImageHeight, appActivity.getImageHeight());
|
||||
}
|
||||
lqw.orderByAsc(AppActivity::getSort);
|
||||
List<AppActivity> list = iAppActivityService.list(lqw);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,143 @@
|
||||
package com.ruoyi.winery.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.itextpdf.styledxmlparser.jsoup.nodes.Document;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.winery.domain.goods.GoodsMain;
|
||||
import com.ruoyi.winery.utils.RichTextUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.winery.domain.AppMerchant;
|
||||
import com.ruoyi.winery.service.IAppMerchantService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商户Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/winery/merchant")
|
||||
public class AppMerchantController extends BaseController {
|
||||
|
||||
private final IAppMerchantService iAppMerchantService;
|
||||
|
||||
/**
|
||||
* 查询商户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppMerchant appMerchant) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<AppMerchant> lqw = Wrappers.lambdaQuery(appMerchant);
|
||||
if (StringUtils.isNotBlank(appMerchant.getMchName())) {
|
||||
lqw.like(AppMerchant::getMchName, appMerchant.getMchName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appMerchant.getSubtitle())) {
|
||||
lqw.eq(AppMerchant::getSubtitle, appMerchant.getSubtitle());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appMerchant.getAvatar())) {
|
||||
lqw.eq(AppMerchant::getAvatar, appMerchant.getAvatar());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appMerchant.getMchDesc())) {
|
||||
lqw.eq(AppMerchant::getMchDesc, appMerchant.getMchDesc());
|
||||
}
|
||||
lqw.orderByAsc(AppMerchant::getSort);
|
||||
List<AppMerchant> list = iAppMerchantService.list(lqw);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:export')")
|
||||
@Log(title = "商户", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(AppMerchant appMerchant) {
|
||||
LambdaQueryWrapper<AppMerchant> lqw = new LambdaQueryWrapper<AppMerchant>(appMerchant);
|
||||
List<AppMerchant> list = iAppMerchantService.list(lqw);
|
||||
ExcelUtil<AppMerchant> util = new ExcelUtil<AppMerchant>(AppMerchant.class);
|
||||
return util.exportExcel(list, "merchant");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商户详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
return AjaxResult.success(iAppMerchantService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取商户详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:query')")
|
||||
@GetMapping(value = "dept/{deptId}")
|
||||
public AjaxResult getInfoByDeptId(@PathVariable("deptId") String deptId) {
|
||||
|
||||
return AjaxResult.success(iAppMerchantService.getOne(new LambdaQueryWrapper<AppMerchant>().eq(AppMerchant::getDeptId, deptId)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:add')")
|
||||
@Log(title = "商户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AppMerchant appMerchant) {
|
||||
String richText = appMerchant.getMchDesc();
|
||||
if (richText != null && StringUtils.isNotEmpty(richText)) {
|
||||
Document doc = RichTextUtil.setImgStyle(richText, "width: 100%");
|
||||
appMerchant.setMchDesc(doc.body().children().toString());
|
||||
}
|
||||
return toAjax(iAppMerchantService.save(appMerchant) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:edit')")
|
||||
@Log(title = "商户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppMerchant appMerchant) {
|
||||
String richText = appMerchant.getMchDesc();
|
||||
if (richText != null && StringUtils.isNotEmpty(richText)) {
|
||||
Document doc = RichTextUtil.setImgStyle(richText, "width: 100%");
|
||||
appMerchant.setMchDesc(doc.body().children().toString());
|
||||
}
|
||||
return toAjax(iAppMerchantService.updateById(appMerchant) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:remove')")
|
||||
@Log(title = "商户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(iAppMerchantService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,275 @@
|
||||
package com.ruoyi.winery.controller;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.itextpdf.io.util.DateTimeUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.winery.domain.AppOrder;
|
||||
import com.ruoyi.winery.domain.AppOrderDetail;
|
||||
import com.ruoyi.winery.domain.AppUserAddress;
|
||||
import com.ruoyi.winery.domain.goods.GoodsMain;
|
||||
import com.ruoyi.winery.domain.winery.WineryOrders;
|
||||
import com.ruoyi.winery.service.IAppOrderDetailService;
|
||||
import com.ruoyi.winery.service.IAppOrderService;
|
||||
import com.ruoyi.winery.service.IAppUserAddressService;
|
||||
import com.ruoyi.winery.service.IGoodsMainService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.*;
|
||||
|
||||
/**
|
||||
* 订单Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/winery/order")
|
||||
public class AppOrderController extends BaseController {
|
||||
|
||||
private final IAppOrderService iAppOrderService;
|
||||
|
||||
@Autowired
|
||||
private WxPayService wxPayService;
|
||||
|
||||
@Autowired
|
||||
private IGoodsMainService goodsMainService;
|
||||
|
||||
@Autowired
|
||||
private IAppOrderDetailService detailService;
|
||||
|
||||
@Autowired
|
||||
private IAppUserAddressService addressService;
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:order:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppOrder appOrder) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<AppOrder> lqw = Wrappers.lambdaQuery(appOrder);
|
||||
if (appOrder.getUserId() != null) {
|
||||
lqw.eq(AppOrder::getUserId, appOrder.getUserId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appOrder.getPostName())) {
|
||||
lqw.eq(AppOrder::getPostName, appOrder.getPostName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appOrder.getPostMobile())) {
|
||||
lqw.eq(AppOrder::getPostName, appOrder.getPostName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appOrder.getPostRegion())) {
|
||||
lqw.eq(AppOrder::getPostName, appOrder.getPostName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appOrder.getPostAddress())) {
|
||||
lqw.eq(AppOrder::getPostName, appOrder.getPostName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appOrder.getPayMsg())) {
|
||||
lqw.eq(AppOrder::getPayMsg, appOrder.getPayMsg());
|
||||
}
|
||||
if (appOrder.getTotalFee() != null) {
|
||||
lqw.eq(AppOrder::getTotalFee, appOrder.getTotalFee());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appOrder.getTransportNo())) {
|
||||
lqw.eq(AppOrder::getTransportNo, appOrder.getTransportNo());
|
||||
}
|
||||
if (appOrder.getStatus() != null) {
|
||||
lqw.eq(AppOrder::getStatus, appOrder.getStatus());
|
||||
}
|
||||
if (appOrder.getPayTime() != null) {
|
||||
lqw.eq(AppOrder::getPayTime, appOrder.getPayTime());
|
||||
}
|
||||
if (appOrder.getCancelTime() != null) {
|
||||
lqw.eq(AppOrder::getCancelTime, appOrder.getCancelTime());
|
||||
}
|
||||
lqw.orderByDesc(AppOrder::getCreateTime);
|
||||
|
||||
if (isMiniUser()) {
|
||||
lqw.eq(AppOrder::getUserId, getLoginUser().getUser().getUserId());
|
||||
}
|
||||
|
||||
List<AppOrder> list = iAppOrderService.list(lqw);
|
||||
for (AppOrder order : list) {
|
||||
LambdaQueryWrapper<AppOrderDetail> wrapper = new LambdaQueryWrapper<AppOrderDetail>();
|
||||
wrapper.eq(AppOrderDetail::getOrderId, order.getId());
|
||||
List<AppOrderDetail> detailList = detailService.list(wrapper);
|
||||
for (AppOrderDetail detail : detailList) {
|
||||
detail.setGoods(goodsMainService.getById(detail.getGoodsId()));
|
||||
}
|
||||
order.setOrderDetailList(detailList);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:order:export')")
|
||||
@Log(title = "订单", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(AppOrder appOrder) {
|
||||
LambdaQueryWrapper<AppOrder> lqw = new LambdaQueryWrapper<AppOrder>(appOrder);
|
||||
List<AppOrder> list = iAppOrderService.list(lqw);
|
||||
ExcelUtil<AppOrder> util = new ExcelUtil<AppOrder>(AppOrder.class);
|
||||
return util.exportExcel(list, "order");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:order:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
AppOrder order = iAppOrderService.getById(id);
|
||||
LambdaQueryWrapper<AppOrderDetail> wrapper = new LambdaQueryWrapper<AppOrderDetail>();
|
||||
wrapper.eq(AppOrderDetail::getOrderId, order.getId());
|
||||
List<AppOrderDetail> detailList = detailService.list(wrapper);
|
||||
order.setOrderDetailList(detailList);
|
||||
for (AppOrderDetail detail : detailList) {
|
||||
detail.setGoods(goodsMainService.getById(detail.getGoodsId()));
|
||||
}
|
||||
return success(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:order:add')")
|
||||
@Log(title = "订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@Transactional
|
||||
public AjaxResult add(@RequestBody AppOrder appOrder, HttpServletRequest req) {
|
||||
Long userId = getLoginUser().getUser().getUserId();
|
||||
String username = getUsername();
|
||||
|
||||
String id = System.currentTimeMillis() + RandomUtil.randomNumbers(6);
|
||||
|
||||
|
||||
AppUserAddress address = addressService.getById(appOrder.getAddressId());
|
||||
|
||||
if (address == null) {
|
||||
return AjaxResult.error("请校验地址信息");
|
||||
}
|
||||
|
||||
appOrder.setPostMobile(address.getMobile());
|
||||
appOrder.setPostName(address.getName());
|
||||
appOrder.setPostRegion(address.getRegion());
|
||||
appOrder.setPostAddress(address.getAddress());
|
||||
|
||||
appOrder.setId(id);
|
||||
appOrder.setUserId(userId);
|
||||
|
||||
// 计算总金额
|
||||
List<AppOrderDetail> orderDetailList = appOrder.getOrderDetailList();
|
||||
Integer totalFee = 0;
|
||||
for (AppOrderDetail detail : orderDetailList) {
|
||||
GoodsMain goods = goodsMainService.getById(detail.getGoodsId());
|
||||
detail.setUserId(userId);
|
||||
detail.setOrderId(id);
|
||||
// 使用产品对应酒庄id
|
||||
detail.setDeptId(goods.getDeptId());
|
||||
detail.setStatus(0);
|
||||
detailService.save(detail);
|
||||
totalFee += (goods.getGoodsPrice().multiply(new BigDecimal(100)).intValue() * detail.getGoodsCount());
|
||||
}
|
||||
appOrder.setTotalFee(totalFee);
|
||||
|
||||
// 统一下单
|
||||
WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest();
|
||||
String openId = "";
|
||||
if (username.contains("mini-")) {
|
||||
openId = username.split("-")[1];
|
||||
}
|
||||
request.setOpenid(openId);
|
||||
request.setTotalFee(totalFee);
|
||||
request.setBody("订单编号" + id);
|
||||
request.setOutTradeNo(id);
|
||||
request.setSpbillCreateIp(req.getRemoteAddr());
|
||||
request.setTradeType("JSAPI");
|
||||
|
||||
try {
|
||||
WxPayMpOrderResult payMsg = wxPayService.createOrder(request);
|
||||
appOrder.setPayMsg(((JSONObject) JSONObject.toJSON(payMsg)).toJSONString());
|
||||
appOrder.setStatus(0);
|
||||
iAppOrderService.save(appOrder);
|
||||
|
||||
return success("success", payMsg);
|
||||
} catch (WxPayException e) {
|
||||
e.printStackTrace();
|
||||
return error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:order:edit')")
|
||||
@Log(title = "订单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppOrder appOrder) {
|
||||
|
||||
// 0=待支付,1=已取消,2=已支付,3=待收货,4=交易完成
|
||||
if (appOrder.getStatus() == 1) {
|
||||
appOrder.setCancelTime(DateUtils.getNowDate());
|
||||
}
|
||||
|
||||
return toAjax(iAppOrderService.updateById(appOrder) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:order:remove')")
|
||||
@Log(title = "订单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(iAppOrderService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
|
||||
@Log(title = "回调", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/pay/payNotify")
|
||||
String payNotify(@RequestBody String xmlData) throws WxPayException {
|
||||
WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData);
|
||||
AppOrder order = iAppOrderService.getById(notifyResult.getOutTradeNo());
|
||||
order.setTransitionId(notifyResult.getTransactionId());
|
||||
order.setStatus(2);
|
||||
order.setPayTime(DateUtils.getNowDate());
|
||||
iAppOrderService.updateById(order);
|
||||
// TODO 根据自己业务场景需要构造返回对象
|
||||
return WxPayNotifyResponse.success("成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,210 @@
|
||||
package com.ruoyi.winery.controller;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.winery.domain.AppOrder;
|
||||
import com.ruoyi.winery.domain.goods.GoodsMain;
|
||||
import com.ruoyi.winery.service.IAppOrderService;
|
||||
import com.ruoyi.winery.service.IGoodsMainService;
|
||||
import com.ruoyi.winery.vo.AppRequestRefundDetailVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.winery.domain.AppOrderDetail;
|
||||
import com.ruoyi.winery.service.IAppOrderDetailService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getLoginUser;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.isMiniUser;
|
||||
|
||||
/**
|
||||
* 订单明细Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/winery/detail")
|
||||
public class AppOrderDetailController extends BaseController {
|
||||
|
||||
private final IAppOrderDetailService iAppOrderDetailService;
|
||||
|
||||
@Autowired
|
||||
private IGoodsMainService goodsMainService;
|
||||
|
||||
@Autowired
|
||||
private WxPayService wxPayService;
|
||||
|
||||
@Autowired
|
||||
private IAppOrderService orderService;
|
||||
|
||||
/**
|
||||
* 查询订单明细列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:detail:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppOrderDetail appOrderDetail) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<AppOrderDetail> lqw = Wrappers.lambdaQuery(appOrderDetail);
|
||||
if (appOrderDetail.getDeptId() != null) {
|
||||
lqw.eq(AppOrderDetail::getDeptId, appOrderDetail.getDeptId());
|
||||
}
|
||||
if (appOrderDetail.getUserId() != null) {
|
||||
lqw.eq(AppOrderDetail::getUserId, appOrderDetail.getUserId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appOrderDetail.getOrderId())) {
|
||||
lqw.eq(AppOrderDetail::getOrderId, appOrderDetail.getOrderId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appOrderDetail.getGoodsId())) {
|
||||
lqw.eq(AppOrderDetail::getGoodsId, appOrderDetail.getGoodsId());
|
||||
}
|
||||
if (appOrderDetail.getGoodsCount() != null) {
|
||||
lqw.eq(AppOrderDetail::getGoodsCount, appOrderDetail.getGoodsCount());
|
||||
}
|
||||
if (appOrderDetail.getStatus() != null) {
|
||||
lqw.eq(AppOrderDetail::getStatus, appOrderDetail.getStatus());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appOrderDetail.getRefundNo())) {
|
||||
lqw.eq(AppOrderDetail::getRefundNo, appOrderDetail.getRefundNo());
|
||||
}
|
||||
if (appOrderDetail.getRefundTime() != null) {
|
||||
lqw.eq(AppOrderDetail::getRefundTime, appOrderDetail.getRefundTime());
|
||||
}
|
||||
|
||||
if (isMiniUser()) {
|
||||
lqw.eq(AppOrderDetail::getUserId, getLoginUser().getUser().getUserId());
|
||||
}
|
||||
|
||||
|
||||
lqw.orderByDesc(AppOrderDetail::getCreateTime);
|
||||
List<AppOrderDetail> list = iAppOrderDetailService.list(lqw);
|
||||
for (AppOrderDetail detail : list) {
|
||||
detail.setGoods(goodsMainService.getById(detail.getGoodsId()));
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出订单明细列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:detail:export')")
|
||||
@Log(title = "订单明细", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(AppOrderDetail appOrderDetail) {
|
||||
LambdaQueryWrapper<AppOrderDetail> lqw = new LambdaQueryWrapper<AppOrderDetail>(appOrderDetail);
|
||||
List<AppOrderDetail> list = iAppOrderDetailService.list(lqw);
|
||||
ExcelUtil<AppOrderDetail> util = new ExcelUtil<AppOrderDetail>(AppOrderDetail.class);
|
||||
return util.exportExcel(list, "detail");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单明细详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:detail:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
AppOrderDetail detail = iAppOrderDetailService.getById(id);
|
||||
detail.setGoods(goodsMainService.getById(detail.getGoodsId()));
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增订单明细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:detail:add')")
|
||||
@Log(title = "订单明细", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AppOrderDetail appOrderDetail) {
|
||||
return toAjax(iAppOrderDetailService.save(appOrderDetail) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单明细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:detail:edit')")
|
||||
@Log(title = "订单明细", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppOrderDetail appOrderDetail) {
|
||||
return toAjax(iAppOrderDetailService.updateById(appOrderDetail) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单明细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:detail:remove')")
|
||||
@Log(title = "订单明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(iAppOrderDetailService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('winery:detail:refund')")
|
||||
@Log(title = "退款", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/refund/{id}")
|
||||
AjaxResult refund(@PathVariable String id) {
|
||||
AppOrderDetail detail = iAppOrderDetailService.getById(id);
|
||||
AppOrder order = orderService.getById(detail.getOrderId());
|
||||
GoodsMain goods = goodsMainService.getById(detail.getGoodsId());
|
||||
Integer fee = goods.getGoodsPrice().multiply(new BigDecimal(100)).intValue() * detail.getGoodsCount();
|
||||
|
||||
String refundNo = System.currentTimeMillis() + RandomUtil.randomNumbers(6);
|
||||
WxPayRefundRequest request = new WxPayRefundRequest();
|
||||
request.setRefundFee(fee);
|
||||
request.setTotalFee(order.getTotalFee());
|
||||
request.setOutTradeNo(detail.getOrderId());
|
||||
request.setOutRefundNo(refundNo);
|
||||
WxPayRefundResult refund = null;
|
||||
try {
|
||||
wxPayService.refund(request);
|
||||
detail.setRefundTime(DateUtils.getNowDate());
|
||||
detail.setRefundNo(refundNo);
|
||||
detail.setStatus(3);
|
||||
iAppOrderDetailService.updateById(detail);
|
||||
return AjaxResult.success(detail);
|
||||
} catch (WxPayException e) {
|
||||
e.printStackTrace();
|
||||
return error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('winery:detail:query')")
|
||||
@Log(title = "请求退款", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/requestRefund")
|
||||
AjaxResult requestRefund(@RequestBody AppRequestRefundDetailVo vo) {
|
||||
AppOrderDetail detail = iAppOrderDetailService.getById(vo.getId());
|
||||
detail.setStatus(1);
|
||||
detail.setRefundReason(vo.getRefundReason());
|
||||
iAppOrderDetailService.updateById(detail);
|
||||
return AjaxResult.success(detail);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,168 @@
|
||||
package com.ruoyi.winery.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.winery.domain.AppUserAddress;
|
||||
import com.ruoyi.winery.service.IAppUserAddressService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getDeptId;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getLoginUser;
|
||||
|
||||
/**
|
||||
* 用户收货地址Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-16
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/user/address")
|
||||
public class AppUserAddressController extends BaseController {
|
||||
|
||||
private final IAppUserAddressService iAppUserAddressService;
|
||||
|
||||
/**
|
||||
* 查询用户收货地址列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('user:address:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppUserAddress appUserAddress) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<AppUserAddress> lqw = Wrappers.lambdaQuery(appUserAddress);
|
||||
if (appUserAddress.getDeptId() != null) {
|
||||
lqw.eq(AppUserAddress::getDeptId, appUserAddress.getDeptId());
|
||||
}
|
||||
if (appUserAddress.getUserId() != null) {
|
||||
lqw.eq(AppUserAddress::getUserId, appUserAddress.getUserId());
|
||||
}
|
||||
if (appUserAddress.getIsDefault() != null) {
|
||||
lqw.eq(AppUserAddress::getIsDefault, appUserAddress.getIsDefault());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appUserAddress.getMobile())) {
|
||||
lqw.eq(AppUserAddress::getMobile, appUserAddress.getMobile());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appUserAddress.getName())) {
|
||||
lqw.like(AppUserAddress::getName, appUserAddress.getName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appUserAddress.getAddress())) {
|
||||
lqw.eq(AppUserAddress::getAddress, appUserAddress.getAddress());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appUserAddress.getRegion())) {
|
||||
lqw.eq(AppUserAddress::getRegion, appUserAddress.getRegion());
|
||||
}
|
||||
|
||||
|
||||
// 使小程序用户仅能查询自己的收货地址
|
||||
String userName = getLoginUser().getUser().getUserName();
|
||||
if (userName.contains("mini-")) {
|
||||
lqw.eq(AppUserAddress::getUserId, getLoginUser().getUser().getUserId());
|
||||
}
|
||||
|
||||
lqw.orderByDesc(AppUserAddress::getIsDefault);
|
||||
|
||||
List<AppUserAddress> list = iAppUserAddressService.list(lqw);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出用户收货地址列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('user:address:export')")
|
||||
@Log(title = "用户收货地址", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(AppUserAddress appUserAddress) {
|
||||
LambdaQueryWrapper<AppUserAddress> lqw = new LambdaQueryWrapper<AppUserAddress>(appUserAddress);
|
||||
List<AppUserAddress> list = iAppUserAddressService.list(lqw);
|
||||
ExcelUtil<AppUserAddress> util = new ExcelUtil<AppUserAddress>(AppUserAddress.class);
|
||||
return util.exportExcel(list, "address");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收货地址详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('user:address:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
return AjaxResult.success(iAppUserAddressService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户收货地址
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('user:address:add')")
|
||||
@Log(title = "用户收货地址", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AppUserAddress appUserAddress) {
|
||||
|
||||
Long userId = getLoginUser().getUser().getUserId();
|
||||
appUserAddress.setUserId(userId);
|
||||
appUserAddress.setDeptId(getDeptId());
|
||||
|
||||
// 首发设为默认收货地址
|
||||
if (appUserAddress.getIsDefault() == null) {
|
||||
List<AppUserAddress> list = iAppUserAddressService.list(
|
||||
new LambdaQueryWrapper<AppUserAddress>().eq(AppUserAddress::getUserId, userId)
|
||||
);
|
||||
appUserAddress.setIsDefault(list.size() > 0 ? 0 : 1);
|
||||
}
|
||||
|
||||
|
||||
return toAjax(iAppUserAddressService.save(appUserAddress) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户收货地址
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('user:address:edit')")
|
||||
@Log(title = "用户收货地址", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppUserAddress appUserAddress) {
|
||||
|
||||
if (appUserAddress.getIsDefault() == 1) {
|
||||
|
||||
AppUserAddress updateItem = new AppUserAddress();
|
||||
updateItem.setIsDefault(0);
|
||||
|
||||
iAppUserAddressService.update(updateItem ,new LambdaQueryWrapper<AppUserAddress>()
|
||||
.eq(AppUserAddress::getUserId, appUserAddress.getUserId())
|
||||
.eq(AppUserAddress::getIsDefault, 1)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return toAjax(iAppUserAddressService.updateById(appUserAddress) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户收货地址
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('user:address:remove')")
|
||||
@Log(title = "用户收货地址", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(iAppUserAddressService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@ -28,6 +28,9 @@ import com.ruoyi.winery.service.INewsContentService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getDeptId;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
/**
|
||||
* 新闻资讯Controller
|
||||
*
|
||||
@ -49,8 +52,8 @@ public class NewsContentController extends BaseController {
|
||||
public TableDataInfo list(UsernamePasswordAuthenticationToken token, NewsContent newsContent) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<NewsContent> lqw = Wrappers.lambdaQuery(newsContent);
|
||||
lqw.eq(NewsContent::getDeptId, getDeptId(token));
|
||||
|
||||
lqw.eq(NewsContent::getDeptId, getDeptId());
|
||||
|
||||
if (StringUtils.isNotBlank(newsContent.getNewsTitle())) {
|
||||
lqw.eq(NewsContent::getNewsTitle, newsContent.getNewsTitle());
|
||||
@ -100,7 +103,8 @@ public class NewsContentController extends BaseController {
|
||||
@Log(title = "新闻资讯", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(UsernamePasswordAuthenticationToken token, @RequestBody NewsContent newsContent) {
|
||||
newsContent.setDeptId(getDeptId(token));
|
||||
newsContent.setDeptId(getDeptId());
|
||||
newsContent.setCreateBy(getUsername());
|
||||
return toAjax(iNewsContentService.save(newsContent) ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -111,6 +115,7 @@ public class NewsContentController extends BaseController {
|
||||
@Log(title = "新闻资讯", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody NewsContent newsContent) {
|
||||
newsContent.setUpdateBy(getUsername());
|
||||
return toAjax(iNewsContentService.updateById(newsContent) ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -123,4 +128,12 @@ public class NewsContentController extends BaseController {
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(iNewsContentService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新闻资讯详细信息
|
||||
*/
|
||||
@GetMapping(value = "/open/{id}")
|
||||
public AjaxResult getOpenInfo(@PathVariable("id") String id) {
|
||||
return AjaxResult.success(iNewsContentService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,19 @@
|
||||
package com.ruoyi.winery.controller.goods;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.itextpdf.styledxmlparser.jsoup.Jsoup;
|
||||
import com.itextpdf.styledxmlparser.jsoup.nodes.Document;
|
||||
import com.itextpdf.styledxmlparser.jsoup.nodes.Element;
|
||||
import com.itextpdf.styledxmlparser.jsoup.select.Elements;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.winery.utils.RichTextUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -28,6 +35,8 @@ import com.ruoyi.winery.service.IGoodsMainService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.*;
|
||||
|
||||
/**
|
||||
* 商品信息Controller
|
||||
*
|
||||
@ -46,11 +55,15 @@ public class GoodsMainController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('goods:goods_main:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UsernamePasswordAuthenticationToken token, GoodsMain goodsMain) {
|
||||
public TableDataInfo list(GoodsMain goodsMain) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<GoodsMain> lqw = Wrappers.lambdaQuery(goodsMain);
|
||||
|
||||
lqw.eq(GoodsMain::getDeptId, getDeptId(token));
|
||||
|
||||
// 不是系统管理员且不是小程序用户的时候仅能看到自己部门的
|
||||
lqw.eq(!isAdmin() && !getUsername().contains("mini-"),
|
||||
GoodsMain::getDeptId, getDeptId());
|
||||
|
||||
|
||||
if (StringUtils.isNotBlank(goodsMain.getGoodsName())) {
|
||||
lqw.like(GoodsMain::getGoodsName, goodsMain.getGoodsName());
|
||||
@ -73,6 +86,13 @@ public class GoodsMainController extends BaseController {
|
||||
if (StringUtils.isNotBlank(goodsMain.getGoodsImg())) {
|
||||
lqw.eq(GoodsMain::getGoodsImg, goodsMain.getGoodsImg());
|
||||
}
|
||||
|
||||
if (isMiniUser()) {
|
||||
lqw.eq(GoodsMain::getState, 1);
|
||||
}
|
||||
|
||||
lqw.orderByAsc(GoodsMain::getSort);
|
||||
|
||||
List<GoodsMain> list = iWineryGoodsService.list(lqw);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ -106,7 +126,13 @@ public class GoodsMainController extends BaseController {
|
||||
@Log(title = "商品信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(UsernamePasswordAuthenticationToken token, @RequestBody GoodsMain goodsMain) {
|
||||
goodsMain.setDeptId(getDeptId(token));
|
||||
// goodsMain.setDeptId(getDeptId());
|
||||
goodsMain.setCreateBy(getUsername());
|
||||
String richText = goodsMain.getGoodsDesc();
|
||||
if (richText != null && StringUtils.isNotEmpty(richText)) {
|
||||
Document doc = RichTextUtil.setImgStyle(richText, "width: 100%");
|
||||
goodsMain.setGoodsDesc(doc.body().children().toString());
|
||||
}
|
||||
return toAjax(iWineryGoodsService.save(goodsMain) ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -117,6 +143,12 @@ public class GoodsMainController extends BaseController {
|
||||
@Log(title = "商品信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody GoodsMain goodsMain) {
|
||||
goodsMain.setUpdateBy(getUsername());
|
||||
String richText = goodsMain.getGoodsDesc();
|
||||
if (richText != null && StringUtils.isNotEmpty(richText)) {
|
||||
Document doc = RichTextUtil.setImgStyle(richText, "width: 100%");
|
||||
goodsMain.setGoodsDesc(doc.body().children().toString());
|
||||
}
|
||||
return toAjax(iWineryGoodsService.updateById(goodsMain) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.winery.controller.goods;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
@ -7,6 +8,7 @@ import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.winery.domain.goods.GoodsMain;
|
||||
import com.ruoyi.winery.domain.goods.GoodsSpec;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -28,6 +30,8 @@ import com.ruoyi.winery.service.IGoodsSpecService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.*;
|
||||
|
||||
/**
|
||||
* 商品规格Controller
|
||||
*
|
||||
@ -51,7 +55,7 @@ public class GoodsSpecController extends BaseController {
|
||||
|
||||
LambdaQueryWrapper<GoodsSpec> lqw = Wrappers.lambdaQuery(goodsSpec);
|
||||
|
||||
lqw.eq(GoodsSpec::getDeptId, getDeptId(token));
|
||||
lqw.eq(!isAdmin(), GoodsSpec::getDeptId, getDeptId());
|
||||
|
||||
if (StringUtils.isNotBlank(goodsSpec.getSpecName())) {
|
||||
lqw.like(GoodsSpec::getSpecName, goodsSpec.getSpecName());
|
||||
@ -101,7 +105,7 @@ public class GoodsSpecController extends BaseController {
|
||||
@Log(title = "商品规格", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(UsernamePasswordAuthenticationToken token, @RequestBody GoodsSpec goodsSpec) {
|
||||
goodsSpec.setDeptId(getDeptId(token));
|
||||
goodsSpec.setDeptId(getDeptId());
|
||||
return toAjax(iWineryGoodsSpecService.save(goodsSpec) ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -112,6 +116,7 @@ public class GoodsSpecController extends BaseController {
|
||||
@Log(title = "商品规格", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody GoodsSpec goodsSpec) {
|
||||
goodsSpec.setUpdateBy(getUsername());
|
||||
return toAjax(iWineryGoodsSpecService.updateById(goodsSpec) ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -124,4 +129,16 @@ public class GoodsSpecController extends BaseController {
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(iWineryGoodsSpecService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('goods:goods_spec:list')")
|
||||
@GetMapping("/listByIds/{ids}")
|
||||
public TableDataInfo listByIds(@PathVariable String[] ids) {
|
||||
startPage();
|
||||
List<GoodsSpec> list = iWineryGoodsSpecService.listByIds(Arrays.asList(ids));
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,10 +5,13 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.winery.component.MiniComponent;
|
||||
import com.ruoyi.winery.domain.winery.WineryCompanyRecord;
|
||||
import com.ruoyi.winery.enums.IrrigationTypeEnum;
|
||||
@ -23,14 +26,16 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.winery.define.MiniDefine.MINI_USER_SYMBOL;
|
||||
|
||||
/**
|
||||
* @author tottimctj
|
||||
* @since 2020-11-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/winery/mini")
|
||||
@RequestMapping("/winery/mini/user")
|
||||
@Slf4j
|
||||
public class MiniController {
|
||||
public class MiniUserController {
|
||||
|
||||
|
||||
@Autowired
|
||||
@ -41,7 +46,7 @@ public class MiniController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
private ISysUserService userService;
|
||||
|
||||
/**
|
||||
* 通过微信api授权获取手机号
|
||||
@ -66,35 +71,32 @@ public class MiniController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过微信api授权获取手机号并注册
|
||||
* 小程序进行注册用户
|
||||
*
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "发送小程序手机号码并注册", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/registrationByMiniMobile")
|
||||
@Log(title = "小程序进行注册用户", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/registrationByMini")
|
||||
@RepeatSubmit
|
||||
AjaxResult postMobileRegistration(@RequestBody JSONObject json) {
|
||||
|
||||
String mobile = miniComponent.getMobile(json);
|
||||
if (StrUtil.isBlank(mobile)) {
|
||||
return AjaxResult.error("获取失败!");
|
||||
}
|
||||
JSONObject rsp = new JSONObject();
|
||||
rsp.set("mobile", mobile);
|
||||
String openid = json.getStr("openid");
|
||||
return miniComponent.registration(openid, mobile);
|
||||
String mobile = json.getStr("mobile");
|
||||
Long deptId = json.getLong("deptId");
|
||||
String nickName = json.getJSONObject("userInfo").getStr("nickName");
|
||||
String avatar = json.getJSONObject("userInfo").getStr("avatarUrl");
|
||||
return miniComponent.registration(openid, mobile, nickName, deptId, avatar);
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "微信小程序登录", businessType = BusinessType.OTHER)
|
||||
@Log(title = "微信小程序登录换取openid", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/getSession")
|
||||
public AjaxResult getSession(@RequestParam("code") String code) throws WxErrorException {
|
||||
|
||||
WxMaJscode2SessionResult sessionInfo = miniComponent.login(code);
|
||||
|
||||
public AjaxResult getSession(@RequestParam("code") String code, @RequestParam("deptId") Long deptId) throws WxErrorException {
|
||||
WxMaJscode2SessionResult sessionInfo = miniComponent.login(code, deptId);
|
||||
JSONObject json = new JSONObject();
|
||||
json.set("openid", sessionInfo.getOpenid());
|
||||
log.info("微信小程序获取openid信息成功");
|
||||
log.info("微信小程序获取openid信息成功:{}", sessionInfo.getOpenid());
|
||||
|
||||
return AjaxResult.success(json);
|
||||
}
|
||||
@ -104,9 +106,20 @@ public class MiniController {
|
||||
@PostMapping("/loginByMini")
|
||||
public AjaxResult loginByMini(@RequestBody JSONObject json) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
String userAccount = MINI_USER_SYMBOL + json.getStr("openid") + "-" + json.getLong("deptId");
|
||||
// 生成令牌
|
||||
String token = miniComponent.loginByMini(json.getStr("openid"));
|
||||
String token = miniComponent.loginByMini(userAccount);
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
SysUser user = userService.selectUserByUserName(userAccount);
|
||||
|
||||
JSONObject userInfo = new JSONObject();
|
||||
userInfo.set("nickName",user.getNickName());
|
||||
userInfo.set("avatarUrl" ,user.getAvatar());
|
||||
userInfo.set("mobile" ,user.getPhonenumber());
|
||||
|
||||
ajax.put("userInfo", userInfo);
|
||||
|
||||
|
||||
return ajax;
|
||||
}
|
||||
|
||||
@ -27,6 +27,9 @@ import com.ruoyi.winery.service.IWineryFoodSafetyService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getDeptId;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
/**
|
||||
* 食品安全详情Controller
|
||||
*
|
||||
@ -118,6 +121,8 @@ public class WineryFoodSafetyController extends BaseController {
|
||||
@Log(title = "食品安全详情" , businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WineryFoodSafety wineryFoodSafety) {
|
||||
wineryFoodSafety.setCreateBy(getUsername());
|
||||
wineryFoodSafety.setDeptId(getDeptId());
|
||||
return toAjax(iWineryFoodSafetyService.save(wineryFoodSafety) ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -128,6 +133,7 @@ public class WineryFoodSafetyController extends BaseController {
|
||||
@Log(title = "食品安全详情" , businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WineryFoodSafety wineryFoodSafety) {
|
||||
wineryFoodSafety.setUpdateBy(getUsername());
|
||||
return toAjax(iWineryFoodSafetyService.updateById(wineryFoodSafety) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
@ -27,15 +27,18 @@ import com.ruoyi.winery.service.IWineryMauserService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getDeptId;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.isAdmin;
|
||||
|
||||
/**
|
||||
* 小程序用户Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-12-17
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/winery/winery_mauser" )
|
||||
@RequestMapping("/winery/winery_mauser")
|
||||
public class WineryMauserController extends BaseController {
|
||||
|
||||
private final IWineryMauserService iWineryMauserService;
|
||||
@ -45,28 +48,31 @@ public class WineryMauserController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WineryMauser wineryMauser)
|
||||
{
|
||||
public TableDataInfo list(WineryMauser wineryMauser) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<WineryMauser> lqw = Wrappers.lambdaQuery(wineryMauser);
|
||||
if (StringUtils.isNotBlank(wineryMauser.getStatus())){
|
||||
lqw.eq(WineryMauser::getStatus ,wineryMauser.getStatus());
|
||||
|
||||
lqw.eq(!isAdmin(),WineryMauser::getDeptId, getDeptId());
|
||||
|
||||
if (wineryMauser.getStatus() != null) {
|
||||
lqw.eq(WineryMauser::getStatus, wineryMauser.getStatus());
|
||||
}
|
||||
if (StringUtils.isNotBlank(wineryMauser.getMobile())){
|
||||
lqw.eq(WineryMauser::getMobile ,wineryMauser.getMobile());
|
||||
if (StringUtils.isNotBlank(wineryMauser.getMobile())) {
|
||||
lqw.eq(WineryMauser::getMobile, wineryMauser.getMobile());
|
||||
}
|
||||
if (StringUtils.isNotBlank(wineryMauser.getNickName())){
|
||||
lqw.like(WineryMauser::getNickName ,wineryMauser.getNickName());
|
||||
if (StringUtils.isNotBlank(wineryMauser.getNickName())) {
|
||||
lqw.like(WineryMauser::getNickName, wineryMauser.getNickName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(wineryMauser.getUnionId())){
|
||||
lqw.eq(WineryMauser::getUnionId ,wineryMauser.getUnionId());
|
||||
if (StringUtils.isNotBlank(wineryMauser.getUnionId())) {
|
||||
lqw.eq(WineryMauser::getUnionId, wineryMauser.getUnionId());
|
||||
}
|
||||
if (wineryMauser.getCreateTime() != null){
|
||||
lqw.eq(WineryMauser::getCreateTime ,wineryMauser.getCreateTime());
|
||||
}
|
||||
if (StringUtils.isNotBlank(wineryMauser.getDeptId())){
|
||||
lqw.eq(WineryMauser::getDeptId ,wineryMauser.getDeptId());
|
||||
if (wineryMauser.getCreateTime() != null) {
|
||||
lqw.eq(WineryMauser::getCreateTime, wineryMauser.getCreateTime());
|
||||
}
|
||||
|
||||
|
||||
lqw.eq(!isAdmin(), WineryMauser::getDeptId, getDeptId());
|
||||
|
||||
List<WineryMauser> list = iWineryMauserService.list(lqw);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ -74,40 +80,40 @@ public class WineryMauserController extends BaseController {
|
||||
/**
|
||||
* 导出小程序用户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:export')" )
|
||||
@Log(title = "小程序用户" , businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export" )
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:export')")
|
||||
@Log(title = "小程序用户", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(WineryMauser wineryMauser) {
|
||||
LambdaQueryWrapper<WineryMauser> lqw = new LambdaQueryWrapper<WineryMauser>(wineryMauser);
|
||||
List<WineryMauser> list = iWineryMauserService.list(lqw);
|
||||
ExcelUtil<WineryMauser> util = new ExcelUtil<WineryMauser>(WineryMauser. class);
|
||||
return util.exportExcel(list, "winery_mauser" );
|
||||
ExcelUtil<WineryMauser> util = new ExcelUtil<WineryMauser>(WineryMauser.class);
|
||||
return util.exportExcel(list, "winery_mauser");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小程序用户详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:query')" )
|
||||
@GetMapping(value = "/{openId}" )
|
||||
public AjaxResult getInfo(@PathVariable("openId" ) String openId) {
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:query')")
|
||||
@GetMapping(value = "/{openId}")
|
||||
public AjaxResult getInfo(@PathVariable("openId") String openId) {
|
||||
return AjaxResult.success(iWineryMauserService.getById(openId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增小程序用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:add')" )
|
||||
@Log(title = "小程序用户" , businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WineryMauser wineryMauser) {
|
||||
return toAjax(iWineryMauserService.save(wineryMauser) ? 1 : 0);
|
||||
}
|
||||
// /**
|
||||
// * 新增小程序用户
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('winery:winery_mauser:add')")
|
||||
// @Log(title = "小程序用户", businessType = BusinessType.INSERT)
|
||||
// @PostMapping
|
||||
// public AjaxResult add(@RequestBody WineryMauser wineryMauser) {
|
||||
// return toAjax(iWineryMauserService.save(wineryMauser) ? 1 : 0);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改小程序用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:edit')" )
|
||||
@Log(title = "小程序用户" , businessType = BusinessType.UPDATE)
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:edit')")
|
||||
@Log(title = "小程序用户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WineryMauser wineryMauser) {
|
||||
return toAjax(iWineryMauserService.updateById(wineryMauser) ? 1 : 0);
|
||||
@ -116,9 +122,9 @@ public class WineryMauserController extends BaseController {
|
||||
/**
|
||||
* 删除小程序用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:remove')" )
|
||||
@Log(title = "小程序用户" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{openIds}" )
|
||||
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:remove')")
|
||||
@Log(title = "小程序用户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{openIds}")
|
||||
public AjaxResult remove(@PathVariable String[] openIds) {
|
||||
return toAjax(iWineryMauserService.removeByIds(Arrays.asList(openIds)) ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -1,80 +1,90 @@
|
||||
package com.ruoyi.winery.controller.winery;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.winery.domain.winery.WineryOrders;
|
||||
import com.ruoyi.winery.service.IWineryOrdersService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.*;
|
||||
|
||||
/**
|
||||
* 客户订单Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-12-28
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/winery/user_orders" )
|
||||
@RequestMapping("/winery/user_orders")
|
||||
public class WineryOrdersController extends BaseController {
|
||||
|
||||
private final IWineryOrdersService iWineryOrdersService;
|
||||
|
||||
@Autowired
|
||||
private WxPayService wxPayService;
|
||||
|
||||
/**
|
||||
* 查询客户订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WineryOrders wineryOrders)
|
||||
{
|
||||
public TableDataInfo list(WineryOrders wineryOrders) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<WineryOrders> lqw = Wrappers.lambdaQuery(wineryOrders);
|
||||
if (wineryOrders.getDeptId() != null){
|
||||
lqw.eq(WineryOrders::getDeptId ,wineryOrders.getDeptId());
|
||||
|
||||
lqw.eq(!isAdmin(), WineryOrders::getDeptId, getDeptId());
|
||||
|
||||
if (wineryOrders.getGoodsId() != null) {
|
||||
lqw.eq(WineryOrders::getGoodsId, wineryOrders.getGoodsId());
|
||||
}
|
||||
if (wineryOrders.getGoodsId() != null){
|
||||
lqw.eq(WineryOrders::getGoodsId ,wineryOrders.getGoodsId());
|
||||
if (StringUtils.isNotBlank(wineryOrders.getGoodsName())) {
|
||||
lqw.like(WineryOrders::getGoodsName, wineryOrders.getGoodsName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(wineryOrders.getGoodsName())){
|
||||
lqw.like(WineryOrders::getGoodsName ,wineryOrders.getGoodsName());
|
||||
if (StringUtils.isNotBlank(wineryOrders.getGoodsType())) {
|
||||
lqw.eq(WineryOrders::getGoodsType, wineryOrders.getGoodsType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(wineryOrders.getGoodsType())){
|
||||
lqw.eq(WineryOrders::getGoodsType ,wineryOrders.getGoodsType());
|
||||
if (StringUtils.isNotBlank(wineryOrders.getGoodsSpec())) {
|
||||
lqw.eq(WineryOrders::getGoodsSpec, wineryOrders.getGoodsSpec());
|
||||
}
|
||||
if (StringUtils.isNotBlank(wineryOrders.getGoodsSpec())){
|
||||
lqw.eq(WineryOrders::getGoodsSpec ,wineryOrders.getGoodsSpec());
|
||||
if (StringUtils.isNotBlank(wineryOrders.getGoodsFaceImg())) {
|
||||
lqw.eq(WineryOrders::getGoodsFaceImg, wineryOrders.getGoodsFaceImg());
|
||||
}
|
||||
if (StringUtils.isNotBlank(wineryOrders.getGoodsFaceImg())){
|
||||
lqw.eq(WineryOrders::getGoodsFaceImg ,wineryOrders.getGoodsFaceImg());
|
||||
if (wineryOrders.getGoodsPrice() != null) {
|
||||
lqw.eq(WineryOrders::getGoodsPrice, wineryOrders.getGoodsPrice());
|
||||
}
|
||||
if (wineryOrders.getGoodsPrice() != null){
|
||||
lqw.eq(WineryOrders::getGoodsPrice ,wineryOrders.getGoodsPrice());
|
||||
if (wineryOrders.getGoodsCount() != null) {
|
||||
lqw.eq(WineryOrders::getGoodsCount, wineryOrders.getGoodsCount());
|
||||
}
|
||||
if (wineryOrders.getGoodsCount() != null){
|
||||
lqw.eq(WineryOrders::getGoodsCount ,wineryOrders.getGoodsCount());
|
||||
}
|
||||
if (wineryOrders.getOrderStatus() != null){
|
||||
lqw.eq(WineryOrders::getOrderStatus ,wineryOrders.getOrderStatus());
|
||||
if (wineryOrders.getOrderStatus() != null) {
|
||||
lqw.eq(WineryOrders::getOrderStatus, wineryOrders.getOrderStatus());
|
||||
}
|
||||
List<WineryOrders> list = iWineryOrdersService.list(lqw);
|
||||
return getDataTable(list);
|
||||
@ -83,52 +93,116 @@ public class WineryOrdersController extends BaseController {
|
||||
/**
|
||||
* 导出客户订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:export')" )
|
||||
@Log(title = "客户订单" , businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export" )
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:export')")
|
||||
@Log(title = "客户订单", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(WineryOrders wineryOrders) {
|
||||
LambdaQueryWrapper<WineryOrders> lqw = new LambdaQueryWrapper<WineryOrders>(wineryOrders);
|
||||
List<WineryOrders> list = iWineryOrdersService.list(lqw);
|
||||
ExcelUtil<WineryOrders> util = new ExcelUtil<WineryOrders>(WineryOrders. class);
|
||||
return util.exportExcel(list, "user_orders" );
|
||||
ExcelUtil<WineryOrders> util = new ExcelUtil<WineryOrders>(WineryOrders.class);
|
||||
return util.exportExcel(list, "user_orders");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户订单详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:query')" )
|
||||
@GetMapping(value = "/{id}" )
|
||||
public AjaxResult getInfo(@PathVariable("id" ) Long id) {
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iWineryOrdersService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客户订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:add')" )
|
||||
@Log(title = "客户订单" , businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WineryOrders wineryOrders) {
|
||||
return toAjax(iWineryOrdersService.save(wineryOrders) ? 1 : 0);
|
||||
}
|
||||
// @PreAuthorize("@ss.hasPermi('winery:user_orders:add')")
|
||||
// @Log(title = "客户订单", businessType = BusinessType.INSERT)
|
||||
// @PostMapping
|
||||
// public AjaxResult add(@RequestBody List<WineryOrders> wineryOrders, HttpServletRequest req) {
|
||||
// String username = getUsername();
|
||||
// Long deptId = getDeptId();
|
||||
// String outTradeNo = RandomUtil.randomNumbers(15);
|
||||
// wineryOrders.setCreateBy(getUsername());
|
||||
// wineryOrders.setDeptId(getDeptId());
|
||||
//
|
||||
// // 统一下单
|
||||
// WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest();
|
||||
// String userName = getLoginUser().getUser().getUserName();
|
||||
// String openId = "";
|
||||
// if (userName.contains("mini-")) {
|
||||
// openId = userName.split("-")[1];
|
||||
// }
|
||||
// request.setOpenid(openId);
|
||||
// request.setTotalFee(wineryOrders.getGoodsPrice().multiply(new BigDecimal(100)).intValue());
|
||||
// request.setBody("小程序名-订单编号");
|
||||
// request.setOutTradeNo(outTradeNo);
|
||||
// request.setNotifyUrl("");
|
||||
// request.setSpbillCreateIp(req.getRemoteAddr());
|
||||
// request.setTradeType("JSAPI");
|
||||
//
|
||||
//
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// try {
|
||||
// map.put("orderId", wineryOrders.getId());
|
||||
// WxPayMpOrderResult payMsg = wxPayService.createOrder(request);
|
||||
// map.put("payMsg", payMsg);
|
||||
// wineryOrders.setPayMsg(((JSONObject) JSONObject.toJSON(payMsg)).toJSONString());
|
||||
// wineryOrders.setOutTradeNo(outTradeNo);
|
||||
// wineryOrders.setOrderStatus(0);
|
||||
// iWineryOrdersService.save(wineryOrders);
|
||||
// return success("success", map);
|
||||
// } catch (WxPayException e) {
|
||||
// e.printStackTrace();
|
||||
// return error();
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改客户订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:edit')" )
|
||||
@Log(title = "客户订单" , businessType = BusinessType.UPDATE)
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:edit')")
|
||||
@Log(title = "客户订单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WineryOrders wineryOrders) {
|
||||
wineryOrders.setUpdateBy(getUsername());
|
||||
return toAjax(iWineryOrdersService.updateById(wineryOrders) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:remove')" )
|
||||
@Log(title = "客户订单" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}" )
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:remove')")
|
||||
@Log(title = "客户订单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(iWineryOrdersService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
|
||||
@Log(title = "回调", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/payNotify")
|
||||
String payNotify(@RequestBody String xmlData) throws WxPayException {
|
||||
WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData);
|
||||
// TODO 根据自己业务场景需要构造返回对象
|
||||
return WxPayNotifyResponse.success("成功");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('winery:user_orders:remove')")
|
||||
@Log(title = "退款", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/refund")
|
||||
AjaxResult refund(@PathVariable Long id) {
|
||||
WineryOrders order = iWineryOrdersService.getById(id);
|
||||
WxPayRefundRequest request = new WxPayRefundRequest();
|
||||
request.setRefundFee(order.getGoodsPrice().intValue());
|
||||
request.setTotalFee(order.getGoodsPrice().intValue());
|
||||
request.setOutTradeNo(order.getOutTradeNo());
|
||||
WxPayRefundResult refund = null;
|
||||
try {
|
||||
refund = wxPayService.refund(request);
|
||||
order.setRefundTime(DateUtils.getNowDate());
|
||||
return AjaxResult.success(refund);
|
||||
} catch (WxPayException e) {
|
||||
e.printStackTrace();
|
||||
return error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,9 @@ import com.ruoyi.winery.service.IWineryWineSpecDetailService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getDeptId;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
/**
|
||||
* 葡萄酒规格详情Controller
|
||||
*
|
||||
@ -121,6 +124,8 @@ public class WineryWineSpecDetailController extends BaseController {
|
||||
@Log(title = "葡萄酒规格详情" , businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WineryWineSpecDetail wineryWineSpecDetail) {
|
||||
wineryWineSpecDetail.setCreateBy(getUsername());
|
||||
wineryWineSpecDetail.setDeptId(getDeptId());
|
||||
return toAjax(iWineryWineSpecDetailService.save(wineryWineSpecDetail) ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -131,6 +136,7 @@ public class WineryWineSpecDetailController extends BaseController {
|
||||
@Log(title = "葡萄酒规格详情" , businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WineryWineSpecDetail wineryWineSpecDetail) {
|
||||
wineryWineSpecDetail.setUpdateBy(getUsername());
|
||||
return toAjax(iWineryWineSpecDetailService.updateById(wineryWineSpecDetail) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,8 @@ public class MiniDefine {
|
||||
|
||||
public static final String MINI_MANAGE_USER = "admin";
|
||||
|
||||
public static final String MINI_USER_SYMBOL = "mini-";
|
||||
|
||||
public static final Long MINI_DEPTID = 100L;
|
||||
|
||||
public static final String MINI_DEFUALT_PASSWORD = "Xiao4rHospSoft";
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
package com.ruoyi.winery.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 活动对象 app_activity
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-20
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("app_activity")
|
||||
public class AppActivity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** ID */
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/** 链接 */
|
||||
@Excel(name = "链接")
|
||||
private String url;
|
||||
|
||||
/** 1每日精选2热门活动 */
|
||||
@Excel(name = "0无1每日精选2热门活动")
|
||||
private Integer type;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
private String image;
|
||||
|
||||
/** 高度 */
|
||||
@Excel(name = "高度")
|
||||
private Integer imageHeight;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.ruoyi.winery.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商户对象 app_merchant
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("app_merchant")
|
||||
public class AppMerchant implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** ID */
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/** 商户名称 */
|
||||
@Excel(name = "商户名称")
|
||||
private String mchName;
|
||||
|
||||
/** 副标题 */
|
||||
@Excel(name = "副标题")
|
||||
private String subtitle;
|
||||
|
||||
/** 图标 */
|
||||
@Excel(name = "图标")
|
||||
private String avatar;
|
||||
|
||||
/** 封面图 */
|
||||
@Excel(name = "封面图")
|
||||
private String faceImage;
|
||||
|
||||
/** 置顶图 */
|
||||
@Excel(name = "置顶图")
|
||||
private String topImage;
|
||||
|
||||
/** 奖项信息 */
|
||||
@Excel(name = "奖项信息")
|
||||
private String award;
|
||||
|
||||
/** 介绍 */
|
||||
@Excel(name = "介绍")
|
||||
private String mchDesc;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
}
|
||||
109
hope-winery/src/main/java/com/ruoyi/winery/domain/AppOrder.java
Normal file
109
hope-winery/src/main/java/com/ruoyi/winery/domain/AppOrder.java
Normal file
@ -0,0 +1,109 @@
|
||||
package com.ruoyi.winery.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 订单对象 app_order
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("app_order")
|
||||
public class AppOrder implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** 订单ID */
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 收货人姓名 */
|
||||
@Excel(name = "收货人姓名")
|
||||
private String postName;
|
||||
|
||||
/** 收货人姓名 */
|
||||
@Excel(name = "收货人电话号码")
|
||||
private String postMobile;
|
||||
|
||||
/** 收货人姓名 */
|
||||
@Excel(name = "收货人地区")
|
||||
private String postRegion;
|
||||
|
||||
/** 收货人姓名 */
|
||||
@Excel(name = "收货人地址")
|
||||
private String postAddress;
|
||||
|
||||
/** 支付参数 */
|
||||
@Excel(name = "支付参数")
|
||||
private String payMsg;
|
||||
|
||||
/** 总金额 */
|
||||
@Excel(name = "总金额")
|
||||
private Integer totalFee;
|
||||
|
||||
/** 运单号 */
|
||||
@Excel(name = "运单号")
|
||||
private String transportNo;
|
||||
|
||||
/** 流水号 */
|
||||
@Excel(name = "流水号")
|
||||
private String transitionId;
|
||||
|
||||
/** 订单状态(0待支付1已取消2已支付3待收货4交易完成) */
|
||||
@Excel(name = "订单状态" , readConverterExp = "0=待支付,1=已取消,2=已支付,3=待收货,4=交易完成")
|
||||
private Integer status;
|
||||
|
||||
/** 支付时间 */
|
||||
@Excel(name = "支付时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date payTime;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 取消时间 */
|
||||
@Excel(name = "取消时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date cancelTime;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<AppOrderDetail> orderDetailList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String addressId;
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
package com.ruoyi.winery.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.winery.domain.goods.GoodsMain;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 订单明细对象 app_order_detail
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("app_order_detail")
|
||||
public class AppOrderDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 明细ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@Excel(name = "部门ID")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@Excel(name = "订单ID")
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@Excel(name = "商品ID")
|
||||
private String goodsId;
|
||||
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
@Excel(name = "商品数量")
|
||||
private Integer goodsCount;
|
||||
|
||||
/**
|
||||
* 明细状态:
|
||||
* 0 未退款
|
||||
* 1.退款申请
|
||||
* 2.退款中
|
||||
* 3.退款成功
|
||||
*/
|
||||
@Excel(name = "明细状态")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 统一退单号
|
||||
*/
|
||||
@Excel(name = "统一退单号")
|
||||
private String refundNo;
|
||||
|
||||
/**
|
||||
* 退款时间
|
||||
*/
|
||||
@Excel(name = "退款时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date refundTime;
|
||||
|
||||
/**
|
||||
退款理由
|
||||
*/
|
||||
@Excel(name = "退款理由")
|
||||
private String refundReason;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private GoodsMain goods;
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package com.ruoyi.winery.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 用户收货地址对象 app_user_address
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-16
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("app_user_address")
|
||||
public class AppUserAddress implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** ID */
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门ID")
|
||||
private Long deptId;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 是否默认 */
|
||||
@Excel(name = "是否默认")
|
||||
private Integer isDefault;
|
||||
|
||||
/** 手机号 */
|
||||
@Excel(name = "手机号")
|
||||
private String mobile;
|
||||
|
||||
/** 收货人 */
|
||||
@Excel(name = "收货人")
|
||||
private String name;
|
||||
|
||||
/** 省市县地址 */
|
||||
@Excel(name = "省市县地址")
|
||||
private String address;
|
||||
|
||||
/** 省市县地址 */
|
||||
@Excel(name = "省市县地址")
|
||||
private String region;
|
||||
|
||||
/** 删除标志 */
|
||||
private String delFlag;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -56,6 +56,9 @@ private static final long serialVersionUID=1L;
|
||||
@Excel(name = "关联规格")
|
||||
private String goodsSpec;
|
||||
|
||||
@Excel(name = "库存")
|
||||
private String goodsStock;
|
||||
|
||||
/** 商品说明 */
|
||||
@Excel(name = "商品说明")
|
||||
private String goodsDesc;
|
||||
@ -68,6 +71,10 @@ private static final long serialVersionUID=1L;
|
||||
@Excel(name = "商品图片")
|
||||
private String goodsImg;
|
||||
|
||||
/** 商品图片 */
|
||||
@Excel(name = "商品价格")
|
||||
private BigDecimal goodsPrice;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
@ -88,4 +95,10 @@ private static final long serialVersionUID=1L;
|
||||
* 状态
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.ruoyi.winery.domain.winery;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -32,14 +33,17 @@ public class WineryMauser implements Serializable {
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** 小程序userid */
|
||||
@TableId(value = "id",type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/** 小程序userid */
|
||||
@Excel(name = "小程序userid")
|
||||
@TableId(value = "open_id")
|
||||
private String openId;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
private Integer status;
|
||||
|
||||
/** 手机号 */
|
||||
@Excel(name = "手机号")
|
||||
@ -63,5 +67,15 @@ private static final long serialVersionUID=1L;
|
||||
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private String deptId;
|
||||
private Long deptId;
|
||||
|
||||
|
||||
public WineryMauser(SysUser user) {
|
||||
this.openId = user.getUserName();
|
||||
this.deptId = user.getDeptId();
|
||||
this.nickName = user.getNickName();
|
||||
this.mobile = user.getPhonenumber();
|
||||
this.status = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ public class WineryOrders implements Serializable {
|
||||
* 商品ID
|
||||
*/
|
||||
@Excel(name = "商品ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
/**
|
||||
* 商品简称
|
||||
@ -82,6 +82,35 @@ public class WineryOrders implements Serializable {
|
||||
@Excel(name = "商品基准单价")
|
||||
private BigDecimal goodsPrice;
|
||||
|
||||
/**
|
||||
* 统一订单号
|
||||
*/
|
||||
@Excel(name = "统一订单号")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 统一退款号
|
||||
*/
|
||||
@Excel(name = "统一退款号")
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 支付参数
|
||||
*/
|
||||
private String payMsg;
|
||||
|
||||
/**
|
||||
* 取消时间
|
||||
*/
|
||||
@Excel(name = "取消时间")
|
||||
private Date cancelTime;
|
||||
|
||||
/**
|
||||
* 退款时间
|
||||
*/
|
||||
@Excel(name = "退款时间")
|
||||
private Date refundTime;
|
||||
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.mapper;
|
||||
|
||||
import com.ruoyi.winery.domain.AppActivity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* 活动Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-20
|
||||
*/
|
||||
public interface AppActivityMapper extends BaseMapper<AppActivity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.mapper;
|
||||
|
||||
import com.ruoyi.winery.domain.AppMerchant;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* 商户Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
public interface AppMerchantMapper extends BaseMapper<AppMerchant> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.mapper;
|
||||
|
||||
import com.ruoyi.winery.domain.AppOrderDetail;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* 订单明细Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
public interface AppOrderDetailMapper extends BaseMapper<AppOrderDetail> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.mapper;
|
||||
|
||||
import com.ruoyi.winery.domain.AppOrder;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* 订单Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
public interface AppOrderMapper extends BaseMapper<AppOrder> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.mapper;
|
||||
|
||||
import com.ruoyi.winery.domain.AppUserAddress;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* 用户收货地址Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-16
|
||||
*/
|
||||
public interface AppUserAddressMapper extends BaseMapper<AppUserAddress> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.service;
|
||||
|
||||
import com.ruoyi.winery.domain.AppActivity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 活动Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-20
|
||||
*/
|
||||
public interface IAppActivityService extends IService<AppActivity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.service;
|
||||
|
||||
import com.ruoyi.winery.domain.AppMerchant;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 商户Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
public interface IAppMerchantService extends IService<AppMerchant> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.service;
|
||||
|
||||
import com.ruoyi.winery.domain.AppOrderDetail;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 订单明细Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
public interface IAppOrderDetailService extends IService<AppOrderDetail> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.service;
|
||||
|
||||
import com.ruoyi.winery.domain.AppOrder;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 订单Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
public interface IAppOrderService extends IService<AppOrder> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.service;
|
||||
|
||||
import com.ruoyi.winery.domain.AppUserAddress;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 用户收货地址Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-16
|
||||
*/
|
||||
public interface IAppUserAddressService extends IService<AppUserAddress> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.winery.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.winery.mapper.AppActivityMapper;
|
||||
import com.ruoyi.winery.domain.AppActivity;
|
||||
import com.ruoyi.winery.service.IAppActivityService;
|
||||
|
||||
/**
|
||||
* 活动Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-20
|
||||
*/
|
||||
@Service
|
||||
public class AppActivityServiceImpl extends ServiceImpl<AppActivityMapper, AppActivity> implements IAppActivityService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.winery.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.winery.mapper.AppMerchantMapper;
|
||||
import com.ruoyi.winery.domain.AppMerchant;
|
||||
import com.ruoyi.winery.service.IAppMerchantService;
|
||||
|
||||
/**
|
||||
* 商户Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
@Service
|
||||
public class AppMerchantServiceImpl extends ServiceImpl<AppMerchantMapper, AppMerchant> implements IAppMerchantService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.winery.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.winery.mapper.AppOrderDetailMapper;
|
||||
import com.ruoyi.winery.domain.AppOrderDetail;
|
||||
import com.ruoyi.winery.service.IAppOrderDetailService;
|
||||
|
||||
/**
|
||||
* 订单明细Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
@Service
|
||||
public class AppOrderDetailServiceImpl extends ServiceImpl<AppOrderDetailMapper, AppOrderDetail> implements IAppOrderDetailService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.winery.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.winery.mapper.AppOrderMapper;
|
||||
import com.ruoyi.winery.domain.AppOrder;
|
||||
import com.ruoyi.winery.service.IAppOrderService;
|
||||
|
||||
/**
|
||||
* 订单Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
@Service
|
||||
public class AppOrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> implements IAppOrderService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.winery.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.winery.mapper.AppUserAddressMapper;
|
||||
import com.ruoyi.winery.domain.AppUserAddress;
|
||||
import com.ruoyi.winery.service.IAppUserAddressService;
|
||||
|
||||
/**
|
||||
* 用户收货地址Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-16
|
||||
*/
|
||||
@Service
|
||||
public class AppUserAddressServiceImpl extends ServiceImpl<AppUserAddressMapper, AppUserAddress> implements IAppUserAddressService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.ruoyi.winery.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.itextpdf.styledxmlparser.jsoup.Jsoup;
|
||||
import com.itextpdf.styledxmlparser.jsoup.nodes.Document;
|
||||
import com.itextpdf.styledxmlparser.jsoup.nodes.Element;
|
||||
import com.itextpdf.styledxmlparser.jsoup.select.Elements;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* @author kino
|
||||
* @since 2021/01/19 9:49
|
||||
*/
|
||||
public class RichTextUtil {
|
||||
|
||||
public static Document setImgStyle(String richText, String style) {
|
||||
Document doc = Jsoup.parse(richText);
|
||||
Elements img = doc.getElementsByTag("img");
|
||||
if (CollUtil.isNotEmpty(img)) {
|
||||
for (Element i : img) {
|
||||
String s = i.attr("style");
|
||||
if (StringUtils.isEmpty(s)) {
|
||||
i.attr("style", style);
|
||||
}
|
||||
}
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.ruoyi.winery.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.winery.domain.goods.GoodsMain;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 请求退款对象
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-18
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class AppRequestRefundDetailVo implements Serializable {
|
||||
|
||||
/**
|
||||
* 明细ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
|
||||
@Excel(name = "退款理由")
|
||||
private String refundReason;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.winery.mapper.AppUserAddressMapper">
|
||||
|
||||
<resultMap type="AppUserAddress" id="AppUserAddressResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="isDefault" column="is_default" />
|
||||
<result property="mobile" column="mobile" />
|
||||
<result property="name" column="name" />
|
||||
<result property="address" column="address" />
|
||||
<result property="region" column="region" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.winery.mapper.AppActivityMapper">
|
||||
|
||||
<resultMap type="AppActivity" id="AppActivityResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="url" column="url" />
|
||||
<result property="type" column="type" />
|
||||
<result property="image" column="image" />
|
||||
<result property="imageHeight" column="image_height" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.winery.mapper.AppMerchantMapper">
|
||||
|
||||
<resultMap type="AppMerchant" id="AppMerchantResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="mchName" column="mch_name" />
|
||||
<result property="subtitle" column="subtitle" />
|
||||
<result property="avatar" column="avatar" />
|
||||
<result property="mchDesc" column="mch_desc" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.winery.mapper.AppOrderDetailMapper">
|
||||
|
||||
<resultMap type="AppOrderDetail" id="AppOrderDetailResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="orderId" column="order_id" />
|
||||
<result property="goodsId" column="goods_id" />
|
||||
<result property="goodsCount" column="goods_count" />
|
||||
<result property="status" column="status" />
|
||||
<result property="refundNo" column="refund_no" />
|
||||
<result property="refundTime" column="refund_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.winery.mapper.AppOrderMapper">
|
||||
|
||||
<resultMap type="AppOrder" id="AppOrderResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="addressId" column="address_id" />
|
||||
<result property="payMsg" column="pay_msg" />
|
||||
<result property="totalFee" column="total_fee" />
|
||||
<result property="transportNo" column="transport_no" />
|
||||
<result property="status" column="status" />
|
||||
<result property="payTime" column="pay_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="cancelTime" column="cancel_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<collection property="orderDetailList" column="order_id" javaType="java.util.List" resultMap="AppOrderDetailResult" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
9
mini-app/.editorconfig
Normal file
9
mini-app/.editorconfig
Normal file
@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
1
mini-app/.eslintignore
Normal file
1
mini-app/.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
dist/*
|
||||
32
mini-app/.eslintrc.js
Normal file
32
mini-app/.eslintrc.js
Normal file
@ -0,0 +1,32 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
globals: { wx: true },
|
||||
parser: 'babel-eslint',
|
||||
parserOptions: {
|
||||
sourceType: 'module'
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
es6: true
|
||||
},
|
||||
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
|
||||
extends: 'standard',
|
||||
// required to lint *.wpy files
|
||||
plugins: [
|
||||
'html'
|
||||
],
|
||||
settings: {
|
||||
'html/html-extensions': ['.html', '.wpy']
|
||||
},
|
||||
// add your custom rules here
|
||||
'rules': {
|
||||
// allow paren-less arrow functions
|
||||
'arrow-parens': 0,
|
||||
// allow async-await
|
||||
'generator-star-spacing': 0,
|
||||
// allow debugger during development
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||
'space-before-function-paren': 0
|
||||
}
|
||||
};
|
||||
3
mini-app/.prettierrc
Normal file
3
mini-app/.prettierrc
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"singleQuote": true
|
||||
}
|
||||
3
mini-app/.vscode/settings.json
vendored
Normal file
3
mini-app/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
||||
4
mini-app/.wepyignore
Normal file
4
mini-app/.wepyignore
Normal file
@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
dist
|
||||
.DS_Store
|
||||
*.wpy___jb_tmp___
|
||||
40
mini-app/TodoList.md
Normal file
40
mini-app/TodoList.md
Normal file
@ -0,0 +1,40 @@
|
||||
注x:完成
|
||||
|
||||
域名[x]
|
||||
注册[x]
|
||||
登录[x]
|
||||
首页装修[x]
|
||||
资讯/酒庄信息管理[x]
|
||||
采集酒庄介绍(图标/图片)[6/12]
|
||||
采集产品介绍(图标/图片)[6/12]
|
||||
商品列表[x]
|
||||
商品管理[x]
|
||||
商品详情[x]
|
||||
地址管理[x]
|
||||
订单生成[x]
|
||||
订单管理[x]
|
||||
生成支付[x]
|
||||
支付回调[x]
|
||||
紫环会[x]
|
||||
发货单excel输出[x]
|
||||
我的[x]
|
||||
|
||||
|
||||
|
||||
公众号专题链接列表[x]
|
||||
|
||||
|
||||
产品追溯[]
|
||||
视频直播[]
|
||||
新品推荐[]
|
||||
|
||||
用户协议/隐私政策[x]
|
||||
小程序图标[x]
|
||||
退款申请[]
|
||||
物流追踪[]
|
||||
订单跟踪[]
|
||||
发货单excel导入[]
|
||||
|
||||
|
||||
|
||||
|
||||
366
mini-app/docs/用户协议.txt
Normal file
366
mini-app/docs/用户协议.txt
Normal file
File diff suppressed because one or more lines are too long
1610
mini-app/docs/隐私政策.txt
Normal file
1610
mini-app/docs/隐私政策.txt
Normal file
File diff suppressed because it is too large
Load Diff
40
mini-app/package.json
Normal file
40
mini-app/package.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "hope_wine",
|
||||
"version": "1.0.0",
|
||||
"description": "希望软件小程序",
|
||||
"main": "weapp/app.js",
|
||||
"scripts": {
|
||||
"dev": "./node_modules/.bin/wepy build --watch",
|
||||
"build": "cross-env NODE_ENV=production ./node_modules/.bin/wepy build --no-cache",
|
||||
"clean": "rm -rf weapp",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"wepy": {
|
||||
"module-a": false
|
||||
},
|
||||
"author": "Machengtianjiang <myxmctj@gmail.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@wepy/core": "^2.1.0",
|
||||
"@wepy/x": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"@wepy/babel-plugin-import-regenerator": "2.1.0",
|
||||
"@wepy/cli": "^2.1.0",
|
||||
"@wepy/compiler-babel": "^2.1.0",
|
||||
"@wepy/compiler-less": "^2.1.0",
|
||||
"babel-eslint": "^7.2.1",
|
||||
"cross-env": "^5.1.3",
|
||||
"eslint": "^3.18.0",
|
||||
"eslint-config-standard": "^7.1.0",
|
||||
"eslint-friendly-formatter": "^2.0.7",
|
||||
"eslint-plugin-html": "^2.0.1",
|
||||
"eslint-plugin-promise": "^3.5.0",
|
||||
"eslint-plugin-standard": "^2.0.1",
|
||||
"less": "^3.8.1",
|
||||
"wepy-eslint": "^1.5.4"
|
||||
}
|
||||
}
|
||||
154
mini-app/project.config.json
Normal file
154
mini-app/project.config.json
Normal file
@ -0,0 +1,154 @@
|
||||
{
|
||||
"description": "A WePY project",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": false,
|
||||
"enhance": false,
|
||||
"postcss": false,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": false,
|
||||
"newFeature": true,
|
||||
"coverView": true,
|
||||
"nodeModules": true,
|
||||
"autoAudits": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"scopeDataCheck": false,
|
||||
"checkInvalidKey": true,
|
||||
"checkSiteMap": true,
|
||||
"uploadWithSourceMap": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"appid": "wx4306452d346f783d",
|
||||
"projectname": "mini-app",
|
||||
"miniprogramRoot": "weapp/",
|
||||
"simulatorType": "wechat",
|
||||
"simulatorPluginLibVersion": {},
|
||||
"condition": {
|
||||
"search": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"conversation": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"plugin": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"game": {
|
||||
"list": []
|
||||
},
|
||||
"gamePlugin": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"miniprogram": {
|
||||
"current": -1,
|
||||
"list": [
|
||||
{
|
||||
"id": -1,
|
||||
"name": "pages/form1",
|
||||
"pathName": "pages/form1",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "pages/form2",
|
||||
"pathName": "pages/form2",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "pages/form3",
|
||||
"pathName": "pages/form3",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "pages/form4",
|
||||
"pathName": "pages/form4",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "pages/form5",
|
||||
"pathName": "pages/form5",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "pages/form6",
|
||||
"pathName": "pages/form6",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "商城首页",
|
||||
"pathName": "pages/mall/index",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "商品详情",
|
||||
"pathName": "pages/mall/goods-detail",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "酒庄详情",
|
||||
"pathName": "pages/winery/winery-detail",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "新增地址",
|
||||
"pathName": "pages/mall/user/user-address",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "地址管理",
|
||||
"pathName": "pages/mall/user/user-address-list",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "酒庄调查首页",
|
||||
"pathName": "pages/index",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "订单列表",
|
||||
"pathName": "pages/mall/order/order-list",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"name": "\bwebview",
|
||||
"pathName": "pages/webView/web",
|
||||
"scene": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
52
mini-app/src/apis/addressApis.js
Normal file
52
mini-app/src/apis/addressApis.js
Normal file
@ -0,0 +1,52 @@
|
||||
import request from '../js/request'
|
||||
import { baseUrl } from '../baseDefine'
|
||||
import { jsonHeader } from './xiao4rApis'
|
||||
|
||||
/**
|
||||
* 地址管理相关接口
|
||||
*/
|
||||
class AddressApis {
|
||||
/**
|
||||
* 创建地址
|
||||
* @param data
|
||||
* @returns {Promise实例对象}
|
||||
*/
|
||||
getAddressList(data) {
|
||||
return request.get({
|
||||
url: baseUrl + 'user/address/list',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
getAddressById(id) {
|
||||
return request.get({
|
||||
url: baseUrl + 'user/address/' + id
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
createAddress(data) {
|
||||
|
||||
return request.post({
|
||||
url: baseUrl + 'user/address',
|
||||
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
delAddress(data) {
|
||||
return request.del({
|
||||
url: baseUrl + 'user/address',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
editAddress(data) {
|
||||
return request.put({
|
||||
url: baseUrl + 'user/address',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default new AddressApis()
|
||||
52
mini-app/src/apis/mallApis.js
Normal file
52
mini-app/src/apis/mallApis.js
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
import request from '../js/request'
|
||||
import { baseUrl } from '../baseDefine'
|
||||
|
||||
/**
|
||||
* 商城相关接口
|
||||
*/
|
||||
class MallApis {
|
||||
getGoodsList(data) {
|
||||
return request.get({
|
||||
url: baseUrl + 'goods/goods_main/list',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
getGoodsById(id) {
|
||||
return request.get({
|
||||
url: baseUrl + 'goods/goods_main/' + id
|
||||
})
|
||||
}
|
||||
|
||||
getGoodsSpecByIds(ids) {
|
||||
return request.get({
|
||||
url: baseUrl + 'goods/goods_spec/listByIds/' + ids
|
||||
})
|
||||
}
|
||||
|
||||
getHotSwitch() {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/activity/open/hotSwitch'
|
||||
})
|
||||
}
|
||||
|
||||
getActivityList() {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/activity/open/list'
|
||||
})
|
||||
}
|
||||
|
||||
getNotice() {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/activity/open/notice'
|
||||
})
|
||||
}
|
||||
|
||||
getNewsContent(id) {
|
||||
return request.get({
|
||||
url: baseUrl + 'news/news_content/open/' + id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default new MallApis()
|
||||
30
mini-app/src/apis/merchanApis.js
Normal file
30
mini-app/src/apis/merchanApis.js
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
import request from '../js/request'
|
||||
import { baseUrl, MINI_DEPTID } from '../baseDefine'
|
||||
import { formHeader, jsonHeader } from './xiao4rApis'
|
||||
|
||||
/**
|
||||
* 酒庄相关接口
|
||||
*/
|
||||
class MerchanApis {
|
||||
getMerchantList(data) {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/merchant/list',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
getMerchantInfo(id) {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/merchant/' + id
|
||||
})
|
||||
}
|
||||
|
||||
getMerchantInfoByDeptId(deptId) {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/merchant/dept/' + deptId
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default new MerchanApis()
|
||||
49
mini-app/src/apis/orderApis.js
Normal file
49
mini-app/src/apis/orderApis.js
Normal file
@ -0,0 +1,49 @@
|
||||
import request from '../js/request'
|
||||
import { baseUrl } from '../baseDefine'
|
||||
|
||||
/**
|
||||
* 订单相关接口
|
||||
*/
|
||||
class OrderApis {
|
||||
/**
|
||||
* 创建订单
|
||||
* @param data
|
||||
* @returns {Promise实例对象}
|
||||
*/
|
||||
createOrder(data) {
|
||||
return request.post({
|
||||
url: baseUrl + 'winery/order',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
getOrderList(data) {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/order/list',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
requestRefund(data) {
|
||||
return request.post({
|
||||
url: baseUrl + 'winery/detail/requestRefund',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
editOrder(data) {
|
||||
return request.put({
|
||||
url: baseUrl + 'winery/order',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
getOrderDetailList(data) {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/detail/list',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default new OrderApis()
|
||||
65
mini-app/src/apis/userApis.js
Normal file
65
mini-app/src/apis/userApis.js
Normal file
@ -0,0 +1,65 @@
|
||||
|
||||
import request from '../js/request'
|
||||
import { baseUrl, MINI_DEPTID } from '../baseDefine'
|
||||
import { formHeader, jsonHeader } from './xiao4rApis'
|
||||
|
||||
/**
|
||||
* 用户相关接口
|
||||
*/
|
||||
class UserApis {
|
||||
/**
|
||||
* 注册
|
||||
* @param data
|
||||
* @returns {Promise实例对象}
|
||||
*/
|
||||
registrationByMini(data) {
|
||||
data.deptId = MINI_DEPTID
|
||||
return request.post({
|
||||
url: baseUrl + 'winery/mini/user/registrationByMini',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param data
|
||||
* @returns {Promise实例对象}
|
||||
*/
|
||||
loginByMini(data) {
|
||||
data.deptId = MINI_DEPTID
|
||||
return request.post({
|
||||
url: baseUrl + 'winery/mini/user/loginByMini',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
getSession(code) {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/mini/user/getSession',
|
||||
header: formHeader,
|
||||
data: {
|
||||
'code': code,
|
||||
'deptId': MINI_DEPTID
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
sendMobile(data) {
|
||||
data.deptId = MINI_DEPTID
|
||||
return request.post({
|
||||
url: baseUrl + 'winery/mini/user/sendMobile',
|
||||
header: jsonHeader,
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
getAuthTest(data) {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/mini/user/test',
|
||||
header: formHeader,
|
||||
data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default new UserApis()
|
||||
40
mini-app/src/apis/xiao4rApis.js
Normal file
40
mini-app/src/apis/xiao4rApis.js
Normal file
@ -0,0 +1,40 @@
|
||||
import request from '../js/request'
|
||||
import { baseUrl } from '../baseDefine'
|
||||
|
||||
export const jsonHeader = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
export const formHeader = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口
|
||||
*/
|
||||
class Xiao4rApis {
|
||||
postForm(data) {
|
||||
return request.post({
|
||||
url: baseUrl + 'winery/mini/postForm',
|
||||
header: jsonHeader,
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
getForm(data) {
|
||||
return request.get({
|
||||
url: baseUrl + 'winery/mini/getForm',
|
||||
header: formHeader,
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据字典类型查询字典数据信息
|
||||
getDicts(dictType) {
|
||||
return request.get({
|
||||
url: baseUrl + 'system/dict/data/type/' + dictType
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default new Xiao4rApis()
|
||||
169
mini-app/src/app.wpy
Normal file
169
mini-app/src/app.wpy
Normal file
@ -0,0 +1,169 @@
|
||||
<style lang="less">
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
.buttonColor {
|
||||
background: #AC1630;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.buttonColor-cancel {
|
||||
background: #fff;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.background-color {
|
||||
background: #AC1630;
|
||||
}
|
||||
|
||||
.cell-title {
|
||||
padding: 10px 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.cell {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
|
||||
.boom {
|
||||
background-color: #F0F1F2;
|
||||
width: 100%;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.fxc{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import eventHub from './common/eventHub'
|
||||
import vuex from '@wepy/x'
|
||||
|
||||
wepy.use(vuex)
|
||||
|
||||
wepy.app({
|
||||
hooks: {
|
||||
// App 级别 hook,对整个 App 生效
|
||||
// 同时存在 Page hook 和 App hook 时,优先执行 Page hook,返回值再交由 App hook 处
|
||||
'before-setData': function(dirty) {
|
||||
console.log('setData dirty: ', dirty)
|
||||
return dirty
|
||||
}
|
||||
},
|
||||
globalData: {
|
||||
userInfo: null
|
||||
},
|
||||
|
||||
onLaunch() {
|
||||
// this.testAsync()
|
||||
eventHub.$on('app-launch', (...args) => {
|
||||
console.log('app-launch event emitted, the params are:')
|
||||
console.log(args)
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
// sleep(s) {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// setTimeout(() => {
|
||||
// resolve('promise resolved')
|
||||
// }, s * 1000)
|
||||
// })
|
||||
// },
|
||||
|
||||
// async testAsync() {
|
||||
// let d = await this.sleep(3)
|
||||
// console.log(d)
|
||||
// }
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
pages: [
|
||||
'pages/mall/index',
|
||||
'pages/index',
|
||||
'pages/form1',
|
||||
'pages/form2',
|
||||
'pages/form3',
|
||||
'pages/form4',
|
||||
'pages/form5',
|
||||
'pages/form6',
|
||||
|
||||
'pages/mall/goods/goods-detail',
|
||||
'pages/mall/user/user-address',
|
||||
'pages/mall/user/user-address-list',
|
||||
'pages/mall/order/order-list',
|
||||
'pages/mall/order/order-detail-list',
|
||||
'pages/mall/order/order-check',
|
||||
'pages/mall/shopping-car/shopping-car-list',
|
||||
'pages/news/news-detail',
|
||||
'pages/winery/winery-detail',
|
||||
'pages/winery/winery-list',
|
||||
'pages/webView/web'
|
||||
|
||||
],
|
||||
navigateToMiniProgramAppIdList: [
|
||||
'wx88736d7d39e2eda6'
|
||||
],
|
||||
window: {
|
||||
backgroundTextStyle: 'light',
|
||||
navigationBarBackgroundColor: '#fff',
|
||||
navigationBarTitleText: 'WeChat',
|
||||
navigationBarTextStyle: 'white',
|
||||
navigationStyle: 'custom',
|
||||
backgroundColor: '#222222'
|
||||
},
|
||||
usingComponents: {
|
||||
'nav-bar': './components/nav-bar',
|
||||
'van-button': './vant/button/index',
|
||||
'van-divider': './vant/divider/index',
|
||||
'van-field': './vant/field/index',
|
||||
'van-radio': './vant/radio/index',
|
||||
'van-radio-group': './vant/radio-group/index',
|
||||
'van-checkbox': './vant/checkbox/index',
|
||||
'van-checkbox-group': './vant/checkbox-group/index',
|
||||
'van-cell': './vant/cell/index',
|
||||
'van-cell-group': './vant/cell-group/index',
|
||||
'van-datetime-picker': './vant/datetime-picker/index',
|
||||
'van-nav-bar': './vant/nav-bar/index',
|
||||
'van-icon': './vant/icon/index',
|
||||
'van-steps': './vant/steps/index',
|
||||
'van-row': './vant/row/index',
|
||||
'van-col': './vant/col/index',
|
||||
'van-col': './vant/col/index',
|
||||
'van-tabbar': './vant/tabbar/index',
|
||||
'van-tabbar-item': './vant/tabbar-item/index',
|
||||
'van-card': './vant/card/index',
|
||||
'van-popup': './vant/popup/index',
|
||||
'van-stepper': './vant/stepper/index',
|
||||
'van-submit-bar': './vant/submit-bar/index',
|
||||
'van-panel': './vant/panel/index',
|
||||
"van-grid": "./vant/grid/index",
|
||||
"van-grid-item": "./vant/grid-item/index",
|
||||
"van-dialog": "./vant/dialog/index",
|
||||
"van-image": "./vant/image/index",
|
||||
"van-loading": "./vant/loading/index",
|
||||
"van-empty": "./vant/empty/index",
|
||||
"van-notice-bar": "./vant/notice-bar/index",
|
||||
"van-tabs": "./vant/tabs/index",
|
||||
"van-tab": "./vant/tab/index",
|
||||
"van-submit-bar": "./vant/submit-bar/index",
|
||||
"van-tag": "./vant/tag/index",
|
||||
|
||||
"van-area": "./vant/area/index"
|
||||
}
|
||||
}
|
||||
</config>
|
||||
133
mini-app/src/appManager.js
Normal file
133
mini-app/src/appManager.js
Normal file
@ -0,0 +1,133 @@
|
||||
import store from '@/store'
|
||||
import eventHub from './common/eventHub'
|
||||
import userApis from './apis/userApis'
|
||||
import { webViewPage } from './store/constant/nav/pages'
|
||||
import Dialog from './vant/dialog/dialog'
|
||||
|
||||
class AppManager {
|
||||
login(callBack) {
|
||||
let self = this
|
||||
wx.showLoading({ title: '正在连接...', mask: true })
|
||||
wx.login({
|
||||
async success(res) {
|
||||
let req1 = await userApis.getSession(res.code)
|
||||
console.log(req1)
|
||||
if (!req1.data.openid) {
|
||||
self.showToast('登录失败!' + res.errMsg)
|
||||
wx.hideLoading()
|
||||
}
|
||||
self.saveOpenid(req1.data.openid)
|
||||
|
||||
let req2 = await userApis.loginByMini({ openid: self.getOpenid() })
|
||||
|
||||
if (!req1.data.openid) {
|
||||
self.showToast('登录失败!' + res.errMsg)
|
||||
wx.hideLoading()
|
||||
}
|
||||
|
||||
if (req2.token) {
|
||||
store.dispatch('setTokenAction', req2.token)
|
||||
self.setCacheInfo()
|
||||
self.setRemoteUserInfo(req2.userInfo)
|
||||
}
|
||||
|
||||
wx.hideLoading()
|
||||
|
||||
if (callBack) {
|
||||
callBack()
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
self.showToast('登录失败,正在重试.')
|
||||
wx.hideLoading()
|
||||
self.login()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
saveOpenid(openid) {
|
||||
// console.log('saveOpenid:' + openid)
|
||||
store.dispatch('setOpenidAction', openid)
|
||||
}
|
||||
|
||||
getOpenid() {
|
||||
return wx.getStorageSync('openid')
|
||||
}
|
||||
|
||||
setRemoteUserInfo(userInfo) {
|
||||
store.dispatch('setMobileAction', userInfo.mobile)
|
||||
store.dispatch('setUserInfoAction', userInfo)
|
||||
}
|
||||
|
||||
setCacheInfo() {
|
||||
const mobile = wx.getStorageSync('mobile')
|
||||
const openid = wx.getStorageSync('openid')
|
||||
const userInfo = wx.getStorageSync('userInfo')
|
||||
const shoppingCar = wx.getStorageSync('shoppingCar')
|
||||
|
||||
console.log('setCacheInfo:', mobile)
|
||||
console.log('setCacheInfo:', openid)
|
||||
console.log('setCacheInfo:', userInfo)
|
||||
console.log('shoppingCar:', shoppingCar)
|
||||
|
||||
if (mobile) {
|
||||
store.dispatch('setMobileAction', mobile)
|
||||
}
|
||||
|
||||
if (openid) {
|
||||
store.dispatch('setOpenidAction', openid)
|
||||
}
|
||||
|
||||
if (userInfo) {
|
||||
store.dispatch('setUserInfoAction', userInfo)
|
||||
}
|
||||
if (shoppingCar) {
|
||||
store.dispatch('setShoppingCarAction', shoppingCar)
|
||||
}
|
||||
}
|
||||
|
||||
navigateTo(path) {
|
||||
console.log('path:', path)
|
||||
|
||||
if (path === 'customer') {
|
||||
this.showDialog('温馨提示', '客服热线:17395097925')
|
||||
}
|
||||
|
||||
if (!store.state.user.token) {
|
||||
eventHub.$emit('onShowDialogRegist')
|
||||
return
|
||||
}
|
||||
|
||||
if (!path) {
|
||||
this.showToast('建设中,敬请期待.')
|
||||
return
|
||||
}
|
||||
|
||||
wx.navigateTo({
|
||||
url: path
|
||||
})
|
||||
}
|
||||
|
||||
showToast(msg) {
|
||||
wx.showToast({ title: msg, icon: 'none' })
|
||||
}
|
||||
|
||||
navWeb(url) {
|
||||
store.state.currWebUrl = url
|
||||
|
||||
this.navigateTo(webViewPage)
|
||||
}
|
||||
|
||||
|
||||
showDialog(title,msg) {
|
||||
Dialog.alert({
|
||||
title: title,
|
||||
message: msg,
|
||||
}).then(() => {
|
||||
// on close
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default new AppManager()
|
||||
14
mini-app/src/baseDefine.js
Normal file
14
mini-app/src/baseDefine.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
*
|
||||
* 各种常量
|
||||
*
|
||||
*/
|
||||
|
||||
// export const baseUrl = 'http://36.1.50.18:18989/'
|
||||
// export const baseUrl = 'http://127.0.0.1:18989/'
|
||||
export const baseUrl = 'https://mall.xiao4r.com/api/'
|
||||
|
||||
export const imgbaseUrl = 'https://www.xiao4r.com/xiao4rstatic/img/winery/'
|
||||
export const sysImgBaseUrl = 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/'
|
||||
|
||||
export const MINI_DEPTID = 100
|
||||
5
mini-app/src/common/eventHub.js
Normal file
5
mini-app/src/common/eventHub.js
Normal file
@ -0,0 +1,5 @@
|
||||
import wepy from '@wepy/core';
|
||||
|
||||
let eventHub = new wepy();
|
||||
|
||||
export default eventHub;
|
||||
77
mini-app/src/components/counter.wpy
Normal file
77
mini-app/src/components/counter.wpy
Normal file
@ -0,0 +1,77 @@
|
||||
<style lang="less">
|
||||
.counter {
|
||||
text-align: left;
|
||||
font-size: 12px;
|
||||
}
|
||||
.count {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
&.red {
|
||||
color: red;
|
||||
}
|
||||
&.green {
|
||||
color: green;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="counter {{style}}">
|
||||
<button @tap="plus" size="mini"> + </button>
|
||||
<button @tap="minus" size="mini"> - </button>
|
||||
<button @tap="increment" size="mini"> INCREMENT </button>
|
||||
<button @tap="decrement" size="mini"> DECREMENT </button>
|
||||
<button @tap="incrementAsync" size="mini"> ASYNC INCREMENT </button>
|
||||
<span class="count"> {{counter}} </span>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '../store';
|
||||
import { mapState, mapActions } from '@wepy/x';
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
props: {
|
||||
num: {
|
||||
type: [Number, String],
|
||||
coerce: function (v) {
|
||||
return +v
|
||||
},
|
||||
default: 50
|
||||
}
|
||||
},
|
||||
computed: mapState([ 'counter' ]),
|
||||
|
||||
events: {
|
||||
'index-broadcast': (...args) => {
|
||||
let $event = args[args.length - 1]
|
||||
console.log(`${this.$name} receive ${$event.name} from ${$event.source.$name}`)
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
num (curVal, oldVal) {
|
||||
console.log(`旧值:${oldVal},新值:${curVal}`)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions([
|
||||
'increment',
|
||||
'decrement',
|
||||
'incrementAsync'
|
||||
]),
|
||||
plus () {
|
||||
this.num = this.num + 1
|
||||
console.log('plus tapped in component');
|
||||
|
||||
this.$emit('index-emit', this.num);
|
||||
},
|
||||
minus () {
|
||||
this.num = this.num - 1
|
||||
console.log(this.$name + ' minus tap')
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
41
mini-app/src/components/group.wpy
Normal file
41
mini-app/src/components/group.wpy
Normal file
@ -0,0 +1,41 @@
|
||||
<style type="less">
|
||||
.group {}
|
||||
</style>
|
||||
<template>
|
||||
<div class="group">
|
||||
<span class="id">{{grouplist.id}}. </span>
|
||||
<span class="name" @tap="tap">{{grouplist.name}}</span>
|
||||
<div>
|
||||
<div v-for="item in grouplist.list">
|
||||
<groupitem :gitem="item"></groupitem>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import wepy from '@wepy/core';
|
||||
//import GroupItem from './groupitem'
|
||||
|
||||
wepy.component({
|
||||
props: {
|
||||
grouplist: {},
|
||||
index: {}
|
||||
},
|
||||
|
||||
methods: {
|
||||
tap () {
|
||||
this.grouplist.name = `Parent Random(${Math.random()})`
|
||||
let groups = this.$parent.$children.filter(com => com.$is === 'components/group');
|
||||
let index = groups.indexOf(this);
|
||||
console.log(`Clicked Group ${index}, ID is ${this.grouplist.id}`)
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
usingComponents: {
|
||||
'groupitem': './groupitem'
|
||||
}
|
||||
}
|
||||
</config>
|
||||
28
mini-app/src/components/groupitem.wpy
Normal file
28
mini-app/src/components/groupitem.wpy
Normal file
@ -0,0 +1,28 @@
|
||||
<style type="less">
|
||||
.groupitem {
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="groupitem">
|
||||
--<span class="id">{{gitem.childid}}.</span>
|
||||
<span class="name" @tap="tap"> {{gitem.childname}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import wepy from '@wepy/core';
|
||||
|
||||
wepy.component({
|
||||
props: {
|
||||
gitem: {}
|
||||
},
|
||||
data: {
|
||||
},
|
||||
methods: {
|
||||
tap () {
|
||||
this.gitem.childname = `Child Random(${Math.random()})`
|
||||
let index = this.$parent.$children.indexOf(this);
|
||||
console.log(`Item ${index}, ID is ${this.gitem.childid}`)
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
48
mini-app/src/components/list.wpy
Normal file
48
mini-app/src/components/list.wpy
Normal file
@ -0,0 +1,48 @@
|
||||
<style lang="less">
|
||||
.mylist:odd {
|
||||
color: red;
|
||||
}
|
||||
.mylist:even {
|
||||
color: green;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="list">
|
||||
This component is not used. because list is an aliasField in package.json
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
|
||||
wepy.component({
|
||||
data: {
|
||||
list: [
|
||||
{
|
||||
id: '0',
|
||||
title: 'loading'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
events: {
|
||||
'index-broadcast': (...args) => {
|
||||
let $event = args[args.length - 1]
|
||||
console.log(`${this.$name} receive ${$event.name} from ${$event.source.name}`)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
tap () {
|
||||
// this.num = this.num + 1
|
||||
console.log(this.$name + ' tap')
|
||||
},
|
||||
add () {
|
||||
let len = this.list.length
|
||||
this.list.push({id: len + 1, title: 'title_' + len})
|
||||
}
|
||||
}
|
||||
|
||||
onLoad () {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
106
mini-app/src/components/mall/order/order-detail-body.wpy
Normal file
106
mini-app/src/components/mall/order/order-detail-body.wpy
Normal file
@ -0,0 +1,106 @@
|
||||
<style lang="less">
|
||||
.van-card {
|
||||
background-color: white !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<wxs module="filters" lang="babel">
|
||||
const parseImage = (imageKey) => {
|
||||
return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
|
||||
}
|
||||
module.exports.parseImage = parseImage;
|
||||
</wxs>
|
||||
<template>
|
||||
|
||||
|
||||
<div style="width: 100%;">
|
||||
|
||||
<van-loading wx:if="{{ !isInit }}" style="margin-top: 20px;"></van-loading>
|
||||
<view wx:else>
|
||||
<div v-if="records.length < 1" style="display: flex;flex-direction: column;align-items: center;width: 100%;">
|
||||
<van-empty description="暂无订单" />
|
||||
</div>
|
||||
|
||||
<div v-for="(item,index) in records" style="width: 100%;">
|
||||
<van-card
|
||||
:num="item.goodsCount"
|
||||
:price="item.goodsCount * item.goods.goodsPrice"
|
||||
:desc="item.goods.goodsAlias"
|
||||
:title="item.goods.goodsName"
|
||||
:thumb="filters.parseImage(item.goods.goodsFaceImg)"
|
||||
>
|
||||
<view slot="footer">
|
||||
<van-button size="mini" plain @tap="onRefund(item)">申请退款</van-button>
|
||||
<van-button size="mini" plain @tap="onDetail(item)" style="margin-left: 10px;">查看详情</van-button>
|
||||
</view>
|
||||
</van-card>
|
||||
|
||||
|
||||
</div>
|
||||
</view>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import defaultMix from '../../../mixins/defaultMix'
|
||||
import appManager from '../../../appManager'
|
||||
|
||||
import orderApis from '../../../apis/orderApis'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {},
|
||||
data: {
|
||||
records: [],
|
||||
isInit: false
|
||||
|
||||
},
|
||||
mixins: [defaultMix],
|
||||
computed: {
|
||||
...mapState({
|
||||
'imageDefine': state => state.imageDefine,
|
||||
'user': state => state.user,
|
||||
'navDefine': state => state.navDefine,
|
||||
'userAddress': state => state.userAddress
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
onRefund(item) {
|
||||
|
||||
},
|
||||
onDetail(item) {
|
||||
|
||||
},
|
||||
async init() {
|
||||
this.isInit = false
|
||||
const req = await orderApis.getOrderList()
|
||||
|
||||
if (req.code === 200) {
|
||||
this.records = req.rows
|
||||
}
|
||||
|
||||
this.isInit = true
|
||||
}
|
||||
},
|
||||
|
||||
ready() {
|
||||
this.init()
|
||||
},
|
||||
onShow() {
|
||||
this.init()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: ''
|
||||
}
|
||||
</config>
|
||||
171
mini-app/src/components/mall/order/order-detail-list-body.wpy
Normal file
171
mini-app/src/components/mall/order/order-detail-list-body.wpy
Normal file
@ -0,0 +1,171 @@
|
||||
<style lang="less">
|
||||
page {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.fream {
|
||||
border-radius: 25px;
|
||||
width: 660rpx;
|
||||
margin-top: 20px;
|
||||
background-color: white;
|
||||
//box-shadow: 4px 4px 10px #eeeeee;
|
||||
padding: 10px 10px 10px 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.van-card {
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<wxs module="filters" lang="babel">
|
||||
const parseImage = (imageKey) => {
|
||||
return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
|
||||
}
|
||||
const parseOrderStatus = (status) => {
|
||||
|
||||
let result = '未知状态'
|
||||
switch(status) {
|
||||
case 0:
|
||||
result = '未支付'
|
||||
break
|
||||
case 1:
|
||||
result = '已取消'
|
||||
break
|
||||
case 2:
|
||||
result = '已支付'
|
||||
break
|
||||
case 3:
|
||||
result = '待收货'
|
||||
break
|
||||
case 4:
|
||||
result = '交易完成'
|
||||
break
|
||||
default:
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports.parseImage = parseImage;
|
||||
module.exports.parseOrderStatus = parseOrderStatus;
|
||||
</wxs>
|
||||
<template>
|
||||
|
||||
|
||||
<div style="width: 100%;">
|
||||
|
||||
<van-loading wx:if="{{ !isInit }}" style="margin-top: 20px; display: flex;align-items: center;flex-direction: column;"></van-loading>
|
||||
<view class="" style="margin: 10px;" wx:else>
|
||||
|
||||
|
||||
<div v-if="records.length < 1" style="display: flex;flex-direction: column;align-items: center;width: 100%;">
|
||||
<van-empty description="暂无订单" />
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fream" v-for="(item,index) in records" >
|
||||
|
||||
<van-card
|
||||
:num="item.goodsCount"
|
||||
:price="item.goodsCount * item.goods.goodsPrice"
|
||||
:desc="item.goods.goodsAlias"
|
||||
:title="item.goods.goodsName"
|
||||
:thumb="filters.parseImage(item.goods.goodsFaceImg)"
|
||||
>
|
||||
<view slot="footer">
|
||||
<!-- <van-button v-if="row.status === 2 || row.status === 4" size="mini" plain @tap="onRefund(item)">申请退款</van-button>-->
|
||||
<!-- <van-button size="mini" plain @tap="onDetail(item)" style="margin-left: 10px;">查看详情</van-button>-->
|
||||
</view>
|
||||
</van-card>
|
||||
|
||||
</div>
|
||||
</view>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import defaultMix from '../../../mixins/defaultMix'
|
||||
import appManager from '../../../appManager'
|
||||
|
||||
import orderApis from '../../../apis/orderApis'
|
||||
import { goodsDetailPage } from '../../../store/constant/nav/pages'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {},
|
||||
props: {
|
||||
status: ''
|
||||
|
||||
},
|
||||
data: {
|
||||
records: [],
|
||||
isInit: false
|
||||
|
||||
},
|
||||
mixins: [defaultMix],
|
||||
computed: {
|
||||
...mapState({
|
||||
'imageDefine': state => state.imageDefine,
|
||||
'user': state => state.user,
|
||||
'navDefine': state => state.navDefine,
|
||||
'userAddress': state => state.userAddress
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
onRefund(item) {
|
||||
// 申请退款
|
||||
// orderApis.refundOrder(item.id)
|
||||
},
|
||||
onDetail(item) {
|
||||
// appManager.navigateTo(goodsDetailPage + '?id=' + item.goods.id)
|
||||
|
||||
},
|
||||
async init() {
|
||||
this.isInit = false
|
||||
|
||||
let data
|
||||
if (this.status) {
|
||||
data = {
|
||||
status: this.status
|
||||
}
|
||||
}
|
||||
const req = await orderApis.getOrderDetailList(data)
|
||||
|
||||
if (req.code === 200) {
|
||||
this.records = req.rows
|
||||
}
|
||||
|
||||
this.isInit = true
|
||||
}
|
||||
},
|
||||
|
||||
ready() {
|
||||
console.log('ready')
|
||||
this.init()
|
||||
},
|
||||
onShow() {
|
||||
console.log('onShow')
|
||||
this.init()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: ''
|
||||
}
|
||||
</config>
|
||||
260
mini-app/src/components/mall/order/order-list-body.wpy
Normal file
260
mini-app/src/components/mall/order/order-list-body.wpy
Normal file
@ -0,0 +1,260 @@
|
||||
<style lang="less">
|
||||
page {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.fream {
|
||||
border-radius: 25px;
|
||||
width: 660rpx;
|
||||
margin-top: 20px;
|
||||
background-color: white;
|
||||
//box-shadow: 4px 4px 10px #eeeeee;
|
||||
padding: 10px 10px 10px 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.van-card {
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<wxs module="filters" lang="babel">
|
||||
const parseImage = (imageKey) => {
|
||||
return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
|
||||
}
|
||||
const parseOrderStatus = (status) => {
|
||||
|
||||
let result = '未知状态'
|
||||
switch(status) {
|
||||
case 0:
|
||||
result = '未支付'
|
||||
break
|
||||
case 1:
|
||||
result = '已取消'
|
||||
break
|
||||
case 2:
|
||||
result = '已支付'
|
||||
break
|
||||
case 3:
|
||||
result = '待收货'
|
||||
break
|
||||
case 4:
|
||||
result = '交易完成'
|
||||
break
|
||||
default:
|
||||
break
|
||||
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
const parseOrderDetailStatus = (status) => {
|
||||
|
||||
let result = '未知状态'
|
||||
switch(status) {
|
||||
case 0:
|
||||
result = '未退款'
|
||||
break
|
||||
case 1:
|
||||
result = '退款申请'
|
||||
break
|
||||
case 2:
|
||||
result = '退款中'
|
||||
break
|
||||
case 3:
|
||||
result = '退款成功'
|
||||
break
|
||||
default:
|
||||
break
|
||||
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
module.exports.parseImage = parseImage;
|
||||
module.exports.parseOrderStatus = parseOrderStatus;
|
||||
module.exports.parseOrderDetailStatus = parseOrderDetailStatus;
|
||||
</wxs>
|
||||
<template>
|
||||
|
||||
|
||||
<div style="width: 100%;">
|
||||
|
||||
<van-loading wx:if="{{ !isInit }}"
|
||||
style="margin-top: 20px; display: flex;align-items: center;flex-direction: column;"></van-loading>
|
||||
<view class="" style="margin: 10px;" wx:else>
|
||||
|
||||
|
||||
<div v-if="records.length < 1" style="display: flex;flex-direction: column;align-items: center;width: 100%;">
|
||||
<van-empty description="暂无订单" />
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fream" v-for="(row,index) in records">
|
||||
<span
|
||||
style="display: flex;justify-content: flex-end;margin-right: 10px;font-size: 14px; color: #AC1630;">{{filters.parseOrderStatus(row.status)}}</span>
|
||||
<div v-for="(item,index) in row.orderDetailList" style="width: 100%;">
|
||||
|
||||
<van-card
|
||||
:num="item.goodsCount"
|
||||
:price="item.goodsCount * item.goods.goodsPrice"
|
||||
:desc="item.goods.goodsAlias"
|
||||
:title="item.goods.goodsName"
|
||||
:thumb="filters.parseImage(item.goods.goodsFaceImg)"
|
||||
>
|
||||
<view slot="footer" style="display: flex; flex-direction: column;text-align: left;">
|
||||
|
||||
|
||||
<div style="display:flex;align-items: center;width: 100%; justify-content: flex-end;">
|
||||
|
||||
<van-tag v-if="item.status !== 0" color="#ffe1e1" text-color="#ad0000">
|
||||
{{filters.parseOrderDetailStatus(item.status)}}
|
||||
</van-tag>
|
||||
<van-button v-else-if="(row.status === 2 || row.status === 4) && item.status === 0" size="mini" plain
|
||||
@tap="onRefund(item)">申请退款
|
||||
</van-button>
|
||||
<van-button size="mini" plain @tap="onDetail(item)" style="margin-left: 10px;">商品详情</van-button>
|
||||
</div>
|
||||
</view>
|
||||
</van-card>
|
||||
</div>
|
||||
<div style="padding: 15px;">
|
||||
<div style="display: flex;margin-top: 10px;align-items: center;width: 100%;">
|
||||
<span style="color: #333; font-size: 13px;">收货人:{{row.postName}}</span> <span
|
||||
style="margin-left: 5px; color: #999999; font-size: 12px;">{{row.postMobile}}</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
style="display: flex;margin-top: 5px;align-items: center;width: 100%;flex-wrap: wrap;">
|
||||
<span style="color: #333; font-size: 13px;">
|
||||
收货地址:{{row.postRegion}}{{row.postAddress}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="row.status === 0">
|
||||
<van-divider />
|
||||
<div style="float: right;margin-right: 16px;display: flex;">
|
||||
<van-button size="mini" plain @tap="onPay(row)">继续支付</van-button>
|
||||
<van-button size="mini" plain @tap="onCancel(row)" style="margin-left: 10px;">取消订单</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import defaultMix from '../../../mixins/defaultMix'
|
||||
import appManager from '../../../appManager'
|
||||
|
||||
import orderApis from '../../../apis/orderApis'
|
||||
import { goodsDetailPage } from '../../../store/constant/nav/pages'
|
||||
import eventHub from '../../../common/eventHub'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {},
|
||||
props: {
|
||||
status: ''
|
||||
|
||||
},
|
||||
data: {
|
||||
records: [],
|
||||
isInit: false
|
||||
|
||||
},
|
||||
mixins: [defaultMix],
|
||||
computed: {
|
||||
...mapState({
|
||||
'imageDefine': state => state.imageDefine,
|
||||
'user': state => state.user,
|
||||
'navDefine': state => state.navDefine,
|
||||
'userAddress': state => state.userAddress
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
onRefund(item) {
|
||||
// 申请退款
|
||||
eventHub.$emit('onShowRefund', item)
|
||||
},
|
||||
onDetail(item) {
|
||||
appManager.navigateTo(goodsDetailPage + '?id=' + item.goods.id)
|
||||
},
|
||||
onCancel(item) {
|
||||
let data = {
|
||||
id: item.id,
|
||||
status: 1
|
||||
}
|
||||
orderApis.editOrder(data).then(r => {
|
||||
appManager.showToast(r.msg)
|
||||
this.$emit('reload')
|
||||
})
|
||||
},
|
||||
onPay(item) {
|
||||
let self = this
|
||||
console.log(item)
|
||||
let payData = JSON.parse(item.payMsg)
|
||||
wx.requestPayment({
|
||||
appId: payData.appId,
|
||||
timeStamp: payData.timeStamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.packageValue,
|
||||
signType: payData.signType,
|
||||
paySign: payData.paySign,
|
||||
success: function(res) {
|
||||
wx.showLoading({ title: '正在获取订单信息.', mask: true })
|
||||
setTimeout(() => {
|
||||
wx.hideLoading()
|
||||
self.init()
|
||||
}, 3000)
|
||||
},
|
||||
fail: function(res) {
|
||||
appManager.showToast('支付失败.')
|
||||
}
|
||||
})
|
||||
},
|
||||
async init() {
|
||||
this.isInit = false
|
||||
|
||||
let data
|
||||
if (this.status) {
|
||||
data = {
|
||||
status: this.status
|
||||
}
|
||||
}
|
||||
const req = await orderApis.getOrderList(data)
|
||||
|
||||
if (req.code === 200) {
|
||||
this.records = req.rows
|
||||
}
|
||||
|
||||
this.isInit = true
|
||||
}
|
||||
},
|
||||
|
||||
ready() {
|
||||
eventHub.$on('refreshOrderList', (...args) => {
|
||||
this.init()
|
||||
})
|
||||
this.init()
|
||||
},
|
||||
onShow() {
|
||||
this.init()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: ''
|
||||
}
|
||||
</config>
|
||||
122
mini-app/src/components/mall/tab/mall-bbs.wpy
Normal file
122
mini-app/src/components/mall/tab/mall-bbs.wpy
Normal file
@ -0,0 +1,122 @@
|
||||
<style lang="less">
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
height: 536rpx;
|
||||
z-index: -10;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<template>
|
||||
<view style="background-color: white;flex-direction: column;display: flex; align-items: center;padding-bottom: 600px;">
|
||||
|
||||
<van-image :src="imageDefine.BBS_BG" width="400rpx" height="400rpx" style="margin-top: 100px;" />
|
||||
<span style="margin-top: 10px;font-size: 26px;color: #940D46;font-weight: bold;">敬请期待</span>
|
||||
<span style="margin-top: 10px;font-size: 14px;color: #999;">即将上线更多福利,记得关注哦~</span>
|
||||
|
||||
<van-button round type="info" @tap="onButton" style="margin-top: 10px;">先逛逛葡萄酒</van-button>
|
||||
|
||||
<!-- <van-panel v-for="(item,index) in list" :key="index" :title="item.user" desc="三星客户" status=" " use-footer-slot>-->
|
||||
<!-- <van-row>-->
|
||||
<!-- <van-col span="8">-->
|
||||
<!-- <van-image src="https://img.yzcdn.cn/vant/cat.jpeg" />-->
|
||||
<!-- </van-col>-->
|
||||
<!-- <van-col span="8">span: 8</van-col>-->
|
||||
<!-- </van-row>-->
|
||||
|
||||
<!-- <view style="display: flex;font-size: 14px;">{{item.context}}</view>-->
|
||||
|
||||
<!-- <van-grid column-num="3" border="{{ false }}">-->
|
||||
<!-- <van-grid-item use-slot v-for=" 3 " wx:for-item="index">-->
|
||||
<!-- <image-->
|
||||
<!-- style="width: 100%; height: 90px;"-->
|
||||
<!-- src="https://img.yzcdn.cn/vant/apple-{{ index + 1 }}.jpg"-->
|
||||
<!-- />-->
|
||||
<!-- </van-grid-item>-->
|
||||
<!-- </van-grid>-->
|
||||
|
||||
<!-- <van-divider />-->
|
||||
<!-- <view style="display: flex;font-size: 14px;">-->
|
||||
<!-- <span style="color: cornflowerblue;">用户xxx<span-->
|
||||
<!-- style="color: #333333;">的回复: 内容很牛逼,挺内容很牛逼,挺内容很牛逼,挺内容很牛逼,挺内容很牛逼,挺</span></span>-->
|
||||
|
||||
<!-- </view>-->
|
||||
<!-- <view slot="footer">-->
|
||||
<!-- <view style="display: flex;justify-content: flex-end;">-->
|
||||
<!-- <van-button v-if="true" size="small">删除</van-button>-->
|
||||
<!-- <van-button v-if="true" size="small" type="danger" style="margin-left: 10px;">编辑</van-button>-->
|
||||
<!-- <van-button size="small" type="danger" style="margin-left: 10px;" @tap="onReply(item)">回复</van-button>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </van-panel>-->
|
||||
|
||||
|
||||
<!-- <van-dialog-->
|
||||
<!-- use-slot-->
|
||||
<!-- title="标题"-->
|
||||
<!-- show="{{ isShowInput }}"-->
|
||||
<!-- show-cancel-button-->
|
||||
<!-- bind:close="onCloseInput"-->
|
||||
<!-- bind:confirm="onConfirmInput"-->
|
||||
<!-- >-->
|
||||
<!-- <image src="https://img.yzcdn.cn/1.jpg" />-->
|
||||
<!-- </van-dialog>-->
|
||||
|
||||
<!-- <div style="margin-top: 100px;" />-->
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {},
|
||||
|
||||
data: {
|
||||
user: store.state.user,
|
||||
list: [],
|
||||
isShowInput: false
|
||||
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState({
|
||||
'imageDefine': state => state.imageDefine
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
onReply(item) {
|
||||
console.log(item)
|
||||
this.isShowInput = true
|
||||
},
|
||||
onCloseInput() {
|
||||
this.isShowInput = false
|
||||
},
|
||||
onConfirmInput() {
|
||||
this.isShowInput = false
|
||||
},
|
||||
onButton() {
|
||||
this.$emit('changeTab', 1)
|
||||
}
|
||||
},
|
||||
|
||||
ready() {
|
||||
console.log('user:', this.user)
|
||||
for (let i = 0; i < 10; i++) {
|
||||
this.list.push({ title: '标题', user: '用户1', context: '长篇大论长篇大论长篇大论长篇大论长篇大论长篇大论长篇大论长篇大论长篇大论长篇大论' })
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: ''
|
||||
}
|
||||
</config>
|
||||
123
mini-app/src/components/mall/tab/mall-car.wpy
Normal file
123
mini-app/src/components/mall/tab/mall-car.wpy
Normal file
@ -0,0 +1,123 @@
|
||||
<template>
|
||||
|
||||
|
||||
<view style="padding: 0 10px 110px 0;background: #fafafa;">
|
||||
<van-checkbox-group :value="selectedList" bind:change="onChangeSelect">
|
||||
<view v-for="(item, index) in list" :key="index"
|
||||
style="margin-top: 10px;border: #fafafa 1px solid; border-radius: 10px;">
|
||||
<van-card
|
||||
:price="item.price/100"
|
||||
desc="描述信息"
|
||||
title="商品标题"
|
||||
nun="n"
|
||||
>
|
||||
<view slot="thumb">
|
||||
<div style="display: inline-flex;align-items: center;margin-top: 12px;">
|
||||
<van-checkbox :name="item.id" />
|
||||
<image class="van-card__thumb"
|
||||
src="https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=751441608,3469454349&fm=15&gp=0.jpg" />
|
||||
</div>
|
||||
</view>
|
||||
</van-card>
|
||||
</view>
|
||||
</van-checkbox-group>
|
||||
|
||||
<van-submit-bar
|
||||
:price="price"
|
||||
button-text="提交订单"
|
||||
bind:submit="onSubmit"
|
||||
button-class="submit-btn"
|
||||
>
|
||||
<van-checkbox style="margin-top:5px;" :value="isAllSelect" bind:change="onAllSelect">全选</van-checkbox>
|
||||
</van-submit-bar>
|
||||
|
||||
<div style="margin-top: 100px;" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
import { mapActions } from '@wepy/x'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {},
|
||||
|
||||
data: {
|
||||
active: 0,
|
||||
checked: false,
|
||||
list: [],
|
||||
selectedList: [],
|
||||
isAllSelect: false,
|
||||
price: 10000
|
||||
},
|
||||
|
||||
computed: {
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
onChangeSelect(e) {
|
||||
this.selectedList = e.$wx.detail
|
||||
this.isAllSelect = this.selectedList.length === this.list.length
|
||||
},
|
||||
onAllSelect(e) {
|
||||
this.isAllSelect = e.$wx.detail
|
||||
if (this.isAllSelect) {
|
||||
this.selectedList = this.list.map(x => x.id)
|
||||
} else {
|
||||
this.selectedList = []
|
||||
}
|
||||
},
|
||||
onSubmit() {
|
||||
// 订单提交
|
||||
}
|
||||
},
|
||||
|
||||
ready() {
|
||||
for (let i = 0; i < 15; i++) {
|
||||
this.list.push(
|
||||
{
|
||||
id: i + '',
|
||||
name: '商品',
|
||||
price: 599
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: '',
|
||||
usingComponents: {
|
||||
},
|
||||
styleIsolation: 'shared',
|
||||
addGlobalClass: true,
|
||||
|
||||
}
|
||||
</config>
|
||||
<style lang="less">
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
height: 536rpx;
|
||||
z-index: -10;
|
||||
}
|
||||
|
||||
.van-card__thumb {
|
||||
position: relative;
|
||||
-webkit-flex: none;
|
||||
flex: none;
|
||||
width: 66px;
|
||||
height: 66px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
|
||||
.submit-btn {
|
||||
|
||||
border-radius: 20px !important;
|
||||
border: #AC1630 1px solid !important;
|
||||
}
|
||||
</style>
|
||||
282
mini-app/src/components/mall/tab/mall-home.wpy
Normal file
282
mini-app/src/components/mall/tab/mall-home.wpy
Normal file
@ -0,0 +1,282 @@
|
||||
<style lang="less">
|
||||
|
||||
|
||||
.header-image {
|
||||
width: 100%;
|
||||
height: 210px;
|
||||
z-index: -1;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
||||
}
|
||||
|
||||
.user-banner {
|
||||
margin-top: 190px;
|
||||
border-top: 1px solid #F5F6F7;
|
||||
border-top-right-radius: 20px;
|
||||
border-top-left-radius: 20px;
|
||||
text-align: left;
|
||||
background-color: #F5F6F7;
|
||||
height: 20px;
|
||||
width: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.menu-desc {
|
||||
border: #fff 1px solid;
|
||||
border-radius: 20px;
|
||||
width: 270rpx;
|
||||
height: 42px;
|
||||
box-shadow: 4px 4px 10px #cccccc;
|
||||
background-color: #ffffff;
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.grid-body {
|
||||
border: #fff 1px solid;
|
||||
border-radius: 20px;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
background-color: white;
|
||||
box-shadow: 4px 4px 10px #eeeeee;
|
||||
}
|
||||
|
||||
.menu-desc-text {
|
||||
margin-top: 5px;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.grid-item {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.column-record-item {
|
||||
border: transparent 1px solid;
|
||||
border-radius: 20px;
|
||||
box-shadow: 4px 4px 10px #cccccc;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.column-record-item-text {
|
||||
font-size: 20px;
|
||||
|
||||
margin: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<wxs module="filters" lang="babel">
|
||||
const parseImage = (imageKey) => {
|
||||
return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
|
||||
}
|
||||
module.exports.parseImage = parseImage;
|
||||
</wxs>
|
||||
|
||||
<template>
|
||||
<div class="container">
|
||||
<image class="header-image" :src="navDefine.HOME_HEADER.image" />
|
||||
<div class="user-banner" />
|
||||
|
||||
|
||||
<view style="margin: 0px 16px;display: flex;flex-direction: column;">
|
||||
<van-row>
|
||||
<van-col offset="1" span="4">
|
||||
<van-image round width="96rpx" height="96rpx" :src="user.userInfo.avatarUrl" />
|
||||
</van-col>
|
||||
<van-col offset="1" span="10">
|
||||
<div class="fxc" style="display: flex;flex-direction: column;">
|
||||
<span style="font-size: 19px;font-weight: bold;">{{user.userInfo.nickName}}</span>
|
||||
<span style="font-size: 11px;color: #999999;">{{user.mobile}}</span>
|
||||
</div>
|
||||
</van-col>
|
||||
<van-col offset="1" span="7" v-if="hotSwitch">
|
||||
<van-button v-if="user.token" round style="height: 25px;" size="small" plain color="#AC1630"
|
||||
@tap="onShoppingCar">
|
||||
<van-icon name="shopping-cart-o" color="#AC1630" />
|
||||
<span style="margin-left: 5px;color: #333333;">购物车</span>
|
||||
</van-button>
|
||||
<van-button v-else round style="height: 25px;" size="small" plain color="#AC1630" @tap="onShoppingCar">
|
||||
<span style="margin-left: 5px;color: #333333;">点击登录</span>
|
||||
</van-button>
|
||||
</van-col>
|
||||
</van-row>
|
||||
|
||||
<van-notice-bar
|
||||
:text="notice"
|
||||
mode="link"
|
||||
background="#ddd"
|
||||
color="#333"
|
||||
speed="25"
|
||||
style="margin-top: 16px;"
|
||||
>
|
||||
<van-image slot="left-icon" :src="imageDefine.HOME_NOTICE_ICON" width="18px" height="19px"
|
||||
style="margin-top: 5px;margin-left: 5px" />
|
||||
</van-notice-bar>
|
||||
|
||||
|
||||
<van-row style="margin-top: 20px;" v-if="hotSwitch">
|
||||
<van-col span="11">
|
||||
|
||||
|
||||
<div class="menu-desc" @tap="onNavItem(navDefine.HOME_MENU1)">
|
||||
<div class="fxc">
|
||||
<span style="font-size: 16px;">酒庄介绍</span>
|
||||
<span class="menu-desc-text">完美酿造工艺</span>
|
||||
</div>
|
||||
<van-image style="margin-left: 10px;" width="40px" height="40px" :src="navDefine.HOME_MENU1.image" />
|
||||
</div>
|
||||
</van-col>
|
||||
|
||||
|
||||
<van-col offset="1" span="11">
|
||||
<div class="menu-desc" @tap="onBuy()">
|
||||
<div class="fxc">
|
||||
<span style="font-size: 16px;">购买庄酒</span>
|
||||
<span class="menu-desc-text">限量年份套装</span>
|
||||
</div>
|
||||
<van-image style="margin-left: 10px;" width="40px" height="40px" :src="navDefine.HOME_MENU2.image" />
|
||||
</div>
|
||||
|
||||
</van-col>
|
||||
|
||||
</van-row>
|
||||
|
||||
|
||||
<!-- <div class="grid-body" v-if="hotSwitch">-->
|
||||
<!-- <van-grid column-num="3" border="{{ false }}" style="margin-top: 15px;">-->
|
||||
<!-- <van-grid-item use-slot v-for=" (item, index) in navDefine.HOME_MENU_LIST" @tap="onNavItem(item)">-->
|
||||
|
||||
<!-- <van-image width="68rpx" height="68rpx" :src="item.icon" />-->
|
||||
<!-- <span style="font-size: 12px;font-weight: bold;">{{item.name}} </span>-->
|
||||
<!-- </van-grid-item>-->
|
||||
<!-- </van-grid>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
<!-- <div style="margin: 22px 2px 12px 2px; display: flex; align-items: center;">-->
|
||||
<!-- <van-image :src="imageDefine.HOME_WINE_LAB" height="16px" width="5px" />-->
|
||||
<!-- <span style="margin:0px 5px;font-weight: bold;">热门活动</span>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- <van-image width="100%" height="96px" :src="navDefine.HOME_BANNER1.image"-->
|
||||
<!-- @tap="onNavItem(navDefine.HOME_BANNER1)" />-->
|
||||
|
||||
|
||||
<!-- <div style="margin: 22px 2px 12px 2px; display: flex; align-items: center;">-->
|
||||
<!-- <van-image :src="imageDefine.HOME_WINE_LAB" height="16px" width="5px" />-->
|
||||
<!-- <span style="margin:0px 5px;font-weight: bold;">每日精选</span>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- <van-image width="100%" height="128px" :src="navDefine.HOME_BANNER2.image"-->
|
||||
<!-- @tap="onNavItem(navDefine.HOME_BANNER2)" />-->
|
||||
|
||||
|
||||
<div v-for="(item, index) in records" style="margin: 22px 2px 0px 2px; ">
|
||||
|
||||
|
||||
<div v-if="item.type !== 0" style="display: flex; align-items: center;margin-bottom: 5px;">
|
||||
<van-image :src="imageDefine.HOME_WINE_LAB" height="16px" width="5px" />
|
||||
<span style="margin:0px 5px;font-weight: bold;"> {{item.type === 1 ? '每日精选' : '热门活动'}}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<van-image width="100%" :height="item.imageHeight + 'px'" :src="filters.parseImage(item.image)"
|
||||
@tap="onWebItem(item)" />
|
||||
</div>
|
||||
|
||||
<!-- <div class="column-record-item" v-for="(item, index) in columnRecord" @tap="onNavItem(navDefine.HOME_BANNER2)">-->
|
||||
<!-- <van-image width="100%" height="128px" :src="navDefine.HOME_BANNER2.image" />-->
|
||||
<!-- <div class="column-record-item-text">-->
|
||||
<!-- <span>{{item.title}} </span>-->
|
||||
<!-- <span style="font-size: 12px;font-weight: normal;">{{item.createTime}} </span>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- </div>-->
|
||||
|
||||
<div style="margin-top: 100px;" />
|
||||
</view>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import defaultMix from '../../../mixins/defaultMix'
|
||||
import orderApis from '../../../apis/orderApis'
|
||||
import appManager from '../../../appManager'
|
||||
import { navDefine } from '../../../store/constant/navDefine'
|
||||
import xiao4rApis from '../../../apis/xiao4rApis'
|
||||
import { webViewPage } from '../../../store/constant/nav/pages'
|
||||
import mallApis from '../../../apis/mallApis'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {},
|
||||
|
||||
data: {
|
||||
columnRecord: [
|
||||
{
|
||||
title: '标题标题标题标题标题',
|
||||
createTime: '2000-11-11',
|
||||
image: 'https://www.xiao4r.com/xiao4rstatic/img/doctor.png'
|
||||
}
|
||||
],
|
||||
records: [],
|
||||
notice: ''
|
||||
|
||||
},
|
||||
|
||||
mixins: [defaultMix],
|
||||
computed: {
|
||||
...mapState({
|
||||
'imageDefine': state => state.imageDefine,
|
||||
'user': state => state.user,
|
||||
'navDefine': state => state.navDefine,
|
||||
'hotSwitch': state => state.hotSwitch
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
onBuy() {
|
||||
this.$emit('changeTab', 1)
|
||||
},
|
||||
|
||||
onShoppingCar() {
|
||||
appManager.navigateTo(navDefine.SHOPPING_CAR_LIST)
|
||||
},
|
||||
onWebItem(item) {
|
||||
appManager.navWeb(item.url)
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
ready() {
|
||||
mallApis.getActivityList().then(r => {
|
||||
this.records = r.rows
|
||||
})
|
||||
|
||||
mallApis.getNotice().then(r => {
|
||||
this.notice = r.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: ''
|
||||
}
|
||||
</config>
|
||||
163
mini-app/src/components/mall/tab/mall-my.wpy
Normal file
163
mini-app/src/components/mall/tab/mall-my.wpy
Normal file
@ -0,0 +1,163 @@
|
||||
<style lang="less">
|
||||
|
||||
|
||||
.header-image {
|
||||
width: 100%;
|
||||
height: 273px;
|
||||
z-index: -1;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
margin-top: 130px;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.user-info-msg {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 10px;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.header-grid-body-top {
|
||||
|
||||
padding: 20px;
|
||||
border: transparent 1px solid;
|
||||
border-top-left-radius: 20px;
|
||||
border-top-right-radius: 20px;
|
||||
width: 620rpx;
|
||||
margin-top: 20px;
|
||||
box-shadow: 4px 4px 10px #eeeeee;
|
||||
background-color: orange;
|
||||
}
|
||||
|
||||
.header-grid-body-bottom {
|
||||
border: transparent 1px solid;
|
||||
border-bottom-left-radius: 20px;
|
||||
border-bottom-right-radius: 20px;
|
||||
width: 660rpx;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 4px 4px 10px #eeeeee;
|
||||
padding: 10px 10px 0px 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.grid-body {
|
||||
border: #fff 1px solid;
|
||||
border-radius: 20px;
|
||||
width: 660rpx;
|
||||
margin-top: 20px;
|
||||
background-color: white;
|
||||
box-shadow: 4px 4px 10px #eeeeee;
|
||||
padding: 10px 10px 0px 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
</style>
|
||||
<template>
|
||||
|
||||
<image class="header-image" :src="imageDefine.MY_HEADER" />
|
||||
|
||||
|
||||
<div class="container" style="margin: 10px 10px 80px 10px;">
|
||||
|
||||
<div class="user-info">
|
||||
<van-image round width="120rpx" height="120rpx" :src="user.userInfo.avatarUrl" />
|
||||
<div class="user-info-msg">
|
||||
<span style="font-size: 18px;font-weight: bold;">{{user.userInfo.nickName}}</span>
|
||||
<span style="font-size: 12px;">{{user.mobile}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="header-grid-body-top">-->
|
||||
<!-- <div style="display: flex;">-->
|
||||
<!-- <span>{{user.userInfo.nickName}} </span>-->
|
||||
<!-- <van-tag round type="primary">标签</van-tag>-->
|
||||
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="header-grid-body-bottom">-->
|
||||
<!-- <van-grid column-num="3" border="{{ false }}" style="margin-top: 15px;">-->
|
||||
<!-- <van-grid-item use-slot v-for=" (item, index) in navDefine.MY_MENU1" @tap="onNavItem(item)">-->
|
||||
<!-- <van-image round width="90rpx" height="90rpx" :src="item.icon" />-->
|
||||
<!-- <span style="margin-top: 10px;">{{item.name}} </span>-->
|
||||
<!-- </van-grid-item>-->
|
||||
<!-- </van-grid>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="grid-body">
|
||||
<span style="margin:25px 10px 15px 10px;font-weight: bold;">我的订单</span>
|
||||
<van-divider />
|
||||
<van-grid column-num="3" border="{{ false }}" style="margin-top: 15px;">
|
||||
<van-grid-item use-slot v-for=" (item, index) in navDefine.MY_MENU1" @tap="onNavItem(item)">
|
||||
<van-image width="48rpx" height="48rpx" :src="item.icon" />
|
||||
<span style="margin-top: 10px;">{{item.name}} </span>
|
||||
</van-grid-item>
|
||||
</van-grid>
|
||||
</div>
|
||||
|
||||
<div class="grid-body">
|
||||
<span style="margin:25px 10px 15px 10px;font-weight: bold;">常用功能</span>
|
||||
<van-divider />
|
||||
<van-grid column-num="3" border="{{ false }}" style="margin-top: 15px;">
|
||||
<van-grid-item use-slot v-for=" (item, index) in navDefine.MY_MENU2" @tap="onNavItem(item)">
|
||||
<van-image width="48rpx" height="48rpx" :src="item.icon" />
|
||||
<span style="margin-top: 10px;">{{item.name}} </span>
|
||||
</van-grid-item>
|
||||
</van-grid>
|
||||
</div>
|
||||
|
||||
<div class="grid-body">
|
||||
<span style="margin:25px 10px 15px 10px;font-weight: bold;">其他</span>
|
||||
<van-divider />
|
||||
<van-grid column-num="3" border="{{ false }}" style="margin-top: 15px;">
|
||||
<van-grid-item use-slot v-for=" (item, index) in navDefine.MY_MENU3" @tap="onNavItem(item)">
|
||||
<van-image width="48rpx" height="48rpx" :src="item.icon" />
|
||||
<span style="margin-top: 10px;">{{item.name}} </span>
|
||||
</van-grid-item>
|
||||
</van-grid>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 100px;" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import defaultMix from '../../../mixins/defaultMix'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {},
|
||||
data: {
|
||||
active: 0
|
||||
},
|
||||
mixins: [defaultMix],
|
||||
computed: {
|
||||
...mapState({
|
||||
'imageDefine': state => state.imageDefine,
|
||||
'user': state => state.user,
|
||||
'navDefine': state => state.navDefine
|
||||
})
|
||||
},
|
||||
|
||||
methods: {},
|
||||
|
||||
ready() {
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: ''
|
||||
}
|
||||
</config>
|
||||
170
mini-app/src/components/mall/tab/mall-shopping.wpy
Normal file
170
mini-app/src/components/mall/tab/mall-shopping.wpy
Normal file
@ -0,0 +1,170 @@
|
||||
<wxs module="filters" lang="babel">
|
||||
const parseImage = (imageKey) => {
|
||||
return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
|
||||
}
|
||||
module.exports.parseImage = parseImage;
|
||||
</wxs>
|
||||
|
||||
|
||||
<template>
|
||||
|
||||
<van-nav-bar
|
||||
title="福利购"
|
||||
/>
|
||||
<view class="" style="margin: 10px 16px 80px 16px;">
|
||||
|
||||
|
||||
<van-image class="banner" :src="imageDefine.SHOPPING_BANNER" width="686rpx"
|
||||
height="96px" />
|
||||
|
||||
<div style="margin-top: 20px;">
|
||||
|
||||
<van-row gutter="20">
|
||||
<van-col span="8" style="font-weight: bold;font-size: 20px;">精选推荐</van-col>
|
||||
<van-col offset="10" span="6">
|
||||
<div @tap="onShppingCar">
|
||||
<van-icon name="shopping-cart-o" color="#940D46" />
|
||||
<span style="margin-left: 5px;">购物车</span>
|
||||
</div>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="display: flex;flex-wrap: wrap;margin-bottom: 10px;">
|
||||
<div class="filter-button" v-for="(item,index) in filterButtons">
|
||||
<van-button round size="small" :color="currentFilter.dictLabel === item.dictLabel ? '#940D46' : '#940D46' "
|
||||
:plain="currentFilter.dictLabel === item.dictLabel ? false : true" @tap="onFilterBtn(item)">
|
||||
{{item.dictLabel}}
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<view v-for="(item, index) in records" :key="index"
|
||||
style="margin-top: 10px;border: #fafafa 1px solid; border-radius: 10px;background-color: white;">
|
||||
<van-card
|
||||
:title="item.goodsName"
|
||||
|
||||
:price="item.goodsPrice"
|
||||
:thumb="filters.parseImage(item.goodsFaceImg)"
|
||||
@tap="onItem(item)"
|
||||
>
|
||||
<view slot="num" style="display: flex; justify-content: space-between;align-items: center;">
|
||||
|
||||
<span style="color: #999;">{{item.goodsAlias}}</span>
|
||||
<van-image :src="imageDefine.LIST_BAG" width="30px" height="30px" />
|
||||
</view>
|
||||
|
||||
</van-card>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<div style="margin-top: 100px;" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import appManager from '../../../appManager'
|
||||
import mallApis from '../../../apis/mallApis'
|
||||
import defaultMix from '../../../mixins/defaultMix'
|
||||
import { goodsDetailPage } from '../../../store/constant/nav/pages'
|
||||
import xiao4rApis from '../../../apis/xiao4rApis'
|
||||
import { navDefine } from '../../../store/constant/navDefine'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {},
|
||||
// mixins: [ defaultMix ],
|
||||
data: {
|
||||
active: 0,
|
||||
records: [],
|
||||
currentFilter: {
|
||||
dictLabel: '全部'
|
||||
},
|
||||
filterButtons: []
|
||||
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState({
|
||||
'imageDefine': state => state.imageDefine,
|
||||
'user': state => state.user,
|
||||
'navDefine': state => state.navDefine
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
onItem(item) {
|
||||
appManager.navigateTo(goodsDetailPage + `?id=${item.id}`)
|
||||
},
|
||||
|
||||
onShppingCar() {
|
||||
appManager.navigateTo(navDefine.SHOPPING_CAR_LIST)
|
||||
},
|
||||
|
||||
onFilterBtn(item) {
|
||||
this.currentFilter = item
|
||||
this.init(false)
|
||||
},
|
||||
async init(isFirst = true) {
|
||||
this.isInit = false
|
||||
|
||||
if (isFirst) {
|
||||
const dict = await xiao4rApis.getDicts('goods_type')
|
||||
|
||||
this.filterButtons = dict.data
|
||||
}
|
||||
|
||||
let body = {}
|
||||
|
||||
if (this.currentFilter.dictLabel !== '全部') {
|
||||
body.goodsType = this.currentFilter.dictValue
|
||||
}
|
||||
|
||||
const req = await mallApis.getGoodsList(body)
|
||||
|
||||
this.records = req.rows
|
||||
|
||||
this.isInit = true
|
||||
}
|
||||
},
|
||||
|
||||
ready() {
|
||||
this.init()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
}
|
||||
</config>
|
||||
<style lang="less">
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
height: 536rpx;
|
||||
z-index: -10;
|
||||
}
|
||||
|
||||
.banner {
|
||||
border: #eeeeee 1px solid;
|
||||
border-radius: 25px;
|
||||
margin-top: 15px;
|
||||
|
||||
}
|
||||
|
||||
.filter-button {
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
45
mini-app/src/components/nav-bar.wpy
Normal file
45
mini-app/src/components/nav-bar.wpy
Normal file
@ -0,0 +1,45 @@
|
||||
<style lang="less">
|
||||
|
||||
.a {
|
||||
position: fixed;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<van-nav-bar
|
||||
bind:click-left="onBack"
|
||||
fixed
|
||||
border="{{false}}"
|
||||
z-index="100"
|
||||
custom-style="background:#AC1630;color:#FFF;"
|
||||
>
|
||||
<van-icon name="arrow-left" slot="left" color="#fff" />
|
||||
<span style="color: #fff;" slot="title">{{title}}</span>
|
||||
</van-nav-bar>
|
||||
</template>
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
|
||||
wepy.component({
|
||||
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: '贺兰山酒庄普查'
|
||||
}
|
||||
|
||||
},
|
||||
data: {},
|
||||
|
||||
events: {},
|
||||
|
||||
methods: {
|
||||
|
||||
onBack() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
}
|
||||
})
|
||||
</script>
|
||||
186
mini-app/src/components/order/dialog-refund.wpy
Normal file
186
mini-app/src/components/order/dialog-refund.wpy
Normal file
@ -0,0 +1,186 @@
|
||||
<wxs module="filters" lang="babel">
|
||||
const parseImage = (imageKey) => {
|
||||
return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
|
||||
}
|
||||
|
||||
|
||||
module.exports.parseImage = parseImage;
|
||||
|
||||
</wxs>
|
||||
|
||||
<style lang="less">
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
height: 536rpx;
|
||||
z-index: -10;
|
||||
}
|
||||
|
||||
.cell-item {
|
||||
margin-left: 22px;
|
||||
margin-top: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cell-input {
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
input {
|
||||
margin-left: 10px;
|
||||
border: #dddddd solid 1px;
|
||||
border-radius: 8px;
|
||||
padding: 5px 10px;
|
||||
width: 320rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<van-dialog
|
||||
use-slot
|
||||
title="退款申请"
|
||||
:show="isShow"
|
||||
show-cancel-button
|
||||
bind:close="onClose"
|
||||
bind:cancel="onClose"
|
||||
bind:confirm="onConfirm"
|
||||
:asyncClose="true"
|
||||
|
||||
>
|
||||
|
||||
<van-card
|
||||
:num="item.goodsCount"
|
||||
:price="item.goodsCount * item.goods.goodsPrice"
|
||||
:desc="item.goods.goodsAlias"
|
||||
:title="item.goods.goodsName"
|
||||
:thumb="filters.parseImage(item.goods.goodsFaceImg)"
|
||||
>
|
||||
|
||||
<view slot="footer" style="display: flex;align-items: center;padding:10px;">
|
||||
<span style="font-size: 14px;">如需联系可致电客服热线17395097925</span>
|
||||
<van-radio-group value="{{ refundReason }}" bind:change="onChangeRefundReason">
|
||||
<div style="display: flex;margin: 5px;flex-direction: column;">
|
||||
<div class="cell-item" v-for="(type,index) in reasonType">
|
||||
<div v-if="index === 4" class="cell-input">
|
||||
<van-radio name="其他" checked-color="#AC1630">其他</van-radio>
|
||||
<input
|
||||
v-model="text"
|
||||
clearable
|
||||
placeholder="请输入退款理由"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<van-radio name="{{type}}" checked-color="#AC1630">{{type}}</van-radio>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-radio-group>
|
||||
</view>
|
||||
|
||||
|
||||
</van-card>
|
||||
|
||||
|
||||
|
||||
<van-radio-group value="{{ refundReason }}" bind:change="onChangeRefundReason">
|
||||
<div style="display: flex;margin: 5px;flex-direction: column;">
|
||||
<div class="cell-item" v-for="(item,index) in reasonTypes">
|
||||
<div v-if="index === 4" class="cell-input">
|
||||
<van-radio name="{{item}}" checked-color="#AC1630" > </van-radio>
|
||||
<input
|
||||
v-model="text"
|
||||
clearable
|
||||
placeholder="请输入退款理由"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<van-radio name="{{item}}" checked-color="#AC1630">{{item}}</van-radio>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-radio-group>
|
||||
|
||||
</van-dialog>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import eventHub from '../../common/eventHub'
|
||||
import appManager from '../../appManager'
|
||||
import orderApis from '../../apis/orderApis'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {},
|
||||
|
||||
data: {
|
||||
isShow: false,
|
||||
item: {},
|
||||
refundReason: '',
|
||||
reasonTypes: ['买错,不想要了', '发错货', '商品损坏/包装脏污', '商品与介绍不符', '其他'],
|
||||
text: ''
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
'imageDefine': state => state.imageDefine
|
||||
})
|
||||
},
|
||||
events: {},
|
||||
|
||||
methods: {
|
||||
...mapActions([]),
|
||||
|
||||
onChangeRefundReason(e) {
|
||||
this.refundReason = e.$wx.detail
|
||||
},
|
||||
|
||||
onConfirm(event) {
|
||||
let refundReason = this.refundReason === '其他' ? this.text : this.refundReason
|
||||
if (!refundReason) {
|
||||
appManager.showToast('请输入您的退款理由.')
|
||||
return
|
||||
}
|
||||
let data = {
|
||||
id: this.item.id,
|
||||
refundReason: refundReason
|
||||
}
|
||||
orderApis.requestRefund(data).then(r => {
|
||||
this.$emit('reload')
|
||||
this.isShow = false
|
||||
})
|
||||
},
|
||||
|
||||
onClose() {
|
||||
this.isShow = false
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
ready() {
|
||||
eventHub.$on('onShowRefund', (...args) => {
|
||||
console.log('onShowRefund:', args[0])
|
||||
this.item = args[0]
|
||||
this.isShow = true
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: ''
|
||||
}
|
||||
</config>
|
||||
40
mini-app/src/components/panel.wpy
Normal file
40
mini-app/src/components/panel.wpy
Normal file
@ -0,0 +1,40 @@
|
||||
<style lang="less">
|
||||
panel {
|
||||
width: 100%;
|
||||
}
|
||||
.panel {
|
||||
width: 100%;
|
||||
margin-top: 20rpx;
|
||||
text-align: left;
|
||||
font-size: 12px;
|
||||
padding-top: 20rpx;
|
||||
padding-left: 50rpx;
|
||||
padding-bottom: 20rpx;
|
||||
border: 1px solid #ccc;
|
||||
|
||||
.title {
|
||||
padding-bottom: 20rpx;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.info {
|
||||
padding: 15rpx;
|
||||
}
|
||||
.testcounter {
|
||||
margin-top: 15rpx;
|
||||
position: absolute;
|
||||
}
|
||||
.counterview {
|
||||
margin-left: 120rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="panel">
|
||||
<slot name="title">
|
||||
Title
|
||||
</slot>
|
||||
<slot>
|
||||
</slot>
|
||||
</div>
|
||||
</template>
|
||||
207
mini-app/src/components/user/dialog-registration.wpy
Normal file
207
mini-app/src/components/user/dialog-registration.wpy
Normal file
@ -0,0 +1,207 @@
|
||||
<style lang="less">
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
height: 536rpx;
|
||||
z-index: -10;
|
||||
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<van-dialog
|
||||
use-slot
|
||||
title="新用户注册"
|
||||
:show="isShow"
|
||||
show-cancel-button
|
||||
bind:close="onClose"
|
||||
bind:cancel="onClose"
|
||||
confirm-button-open-type="getUserInfo"
|
||||
bind:getuserinfo="getUserInfo"
|
||||
:asyncClose="true"
|
||||
|
||||
>
|
||||
<van-field
|
||||
label="手机号:"
|
||||
title-width="60px"
|
||||
value="{{ user.mobile }}"
|
||||
center
|
||||
clearable
|
||||
readonly
|
||||
placeholder="请实名授权获取手机号"
|
||||
border="{{ false }}"
|
||||
use-button-slot
|
||||
>
|
||||
<van-button slot="button" size="small" plain type="info" color="#AC1630" open-type="getPhoneNumber"
|
||||
bind:getphonenumber="onGetMobile">授权
|
||||
</van-button>
|
||||
</van-field>
|
||||
|
||||
<!-- <van-divider customStyle="font-size: 18px; margin: 5px 5px;" />-->
|
||||
|
||||
<!-- <van-field-->
|
||||
<!-- label="昵称:"-->
|
||||
<!-- title-width="60px"-->
|
||||
<!-- value="{{ user.userInfo.nickName }}"-->
|
||||
<!-- center-->
|
||||
<!-- clearable-->
|
||||
<!-- readonly-->
|
||||
<!-- placeholder="请点击授权获取您的微信信息"-->
|
||||
<!-- border="{{ false }}"-->
|
||||
<!-- use-button-slot-->
|
||||
<!-- >-->
|
||||
<!-- <van-button slot="button" size="small" plain type="info" open-type="getUserInfo"-->
|
||||
<!-- bind:getuserinfo="getUserInfo">获取昵称-->
|
||||
<!-- </van-button>-->
|
||||
<!-- </van-field>-->
|
||||
|
||||
<view style="margin:10px;display: flex;">
|
||||
<van-checkbox :value="isChecked" shape="square" bind:change="onChangeCheak" checked-color="#AC1630"
|
||||
/>
|
||||
|
||||
<span style="font-size: 13px;color: #AC1630;margin-left: 5px;">我同意并遵守紫色名片
|
||||
<span style="color: cornflowerblue;" @tap="onTapPrivacy">《隐私政策》 </span>及
|
||||
<span style="color: cornflowerblue;" @tap="onTapAgreement">《用户条款》 </span>
|
||||
的全部内容</span>
|
||||
</view>
|
||||
|
||||
</van-dialog>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import eventHub from '../../common/eventHub'
|
||||
import appManager from '../../appManager'
|
||||
import userApis from '../../apis/userApis'
|
||||
import { newsDetailPage } from '../../store/constant/nav/pages'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
props: {},
|
||||
hooks: {},
|
||||
|
||||
data: {
|
||||
that: this,
|
||||
isShow: false,
|
||||
model: {},
|
||||
isChecked: false
|
||||
},
|
||||
|
||||
// computed: mapState(['user']),
|
||||
|
||||
computed: {
|
||||
...mapState({
|
||||
'user': state => state.user,
|
||||
'hotSwitch': state => state.hotSwitch
|
||||
})
|
||||
},
|
||||
|
||||
events: {},
|
||||
|
||||
methods: {
|
||||
...mapActions([
|
||||
'setUserAction',
|
||||
'setUserInfoAction',
|
||||
'setMobileAction',
|
||||
'setTokenAction'
|
||||
]),
|
||||
|
||||
getUserInfo(event) {
|
||||
console.log('getUserInfo:', event.$wx.detail)
|
||||
this.setUserInfoAction(event.$wx.detail.userInfo)
|
||||
console.log('userInfo:', store.state.user.userInfo)
|
||||
|
||||
if (!this.isChecked) {
|
||||
appManager.showToast('请同意并遵守紫色名片《隐私政策》以及《用户条款》.')
|
||||
return false
|
||||
}
|
||||
if (!this.user.mobile) {
|
||||
appManager.showToast('请授权获取手机号码.')
|
||||
return false
|
||||
}
|
||||
if (!this.user.userInfo) {
|
||||
appManager.showToast('请授权获取用户昵称.')
|
||||
return false
|
||||
}
|
||||
|
||||
let self = this
|
||||
userApis.registrationByMini(this.user).then(r => {
|
||||
if (r.code === 200) {
|
||||
appManager.showToast('注册成功!')
|
||||
self.isShow = false
|
||||
self.setTokenAction(r.token)
|
||||
} else {
|
||||
appManager.showToast(r.msg)
|
||||
}
|
||||
}).catch(e => {
|
||||
appManager.showToast('注册失败!')
|
||||
})
|
||||
},
|
||||
async onGetMobile(e) {
|
||||
console.log(e.$wx.detail)
|
||||
wx.showLoading({ title: '获取中...', mask: true })
|
||||
try {
|
||||
let rsp = await userApis.sendMobile({
|
||||
openid: appManager.getOpenid(),
|
||||
detail: e.$wx.detail
|
||||
})
|
||||
|
||||
if (rsp.code === 200) {
|
||||
this.setMobileAction(rsp.data.mobile)
|
||||
} else {
|
||||
appManager.showToast('服务器连接异常.')
|
||||
}
|
||||
} catch (e) {
|
||||
appManager.showToast('服务器连接异常.')
|
||||
} finally {
|
||||
wx.hideLoading()
|
||||
}
|
||||
},
|
||||
onChangeCheak(e) {
|
||||
this.isChecked = e.$wx.detail
|
||||
},
|
||||
onClose() {
|
||||
this.isShow = false
|
||||
},
|
||||
onTapAgreement() {
|
||||
wx.navigateTo({
|
||||
url: newsDetailPage + '?id=' + 'fb4109a4020b2a2a9d1172f66d043897'
|
||||
})
|
||||
},
|
||||
onTapPrivacy() {
|
||||
wx.navigateTo({
|
||||
url: newsDetailPage + '?id=' + 'a1e5ec18ae13036d14c94bf0e5d11756'
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
ready() {
|
||||
// 获取系统信息
|
||||
let self = this
|
||||
wx.getSystemInfo({
|
||||
success(res) {
|
||||
self.model = res.model
|
||||
}
|
||||
})
|
||||
|
||||
this.page = this
|
||||
eventHub.$on('onShowDialogRegist', (...args) => {
|
||||
this.isShow = true
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: ''
|
||||
}
|
||||
</config>
|
||||
58
mini-app/src/components/wepy-list.wpy
Normal file
58
mini-app/src/components/wepy-list.wpy
Normal file
@ -0,0 +1,58 @@
|
||||
<style lang="less">
|
||||
.mylist:odd {
|
||||
color: red;
|
||||
}
|
||||
.mylist:even {
|
||||
color: green;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="wepy-list">
|
||||
<div>
|
||||
<button @tap="add" size="mini">添加列表another</button>
|
||||
</div>
|
||||
<div v-for="(item, index) in list">
|
||||
<div @tap="tap" class="mylist">
|
||||
<span>{{item.id}}</span>: {{item.title}} <span @tap="remove(index)"> X </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
|
||||
wepy.component({
|
||||
data: {
|
||||
list: [
|
||||
{
|
||||
id: '0',
|
||||
title: 'loading'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
events: {
|
||||
'index-broadcast': (...args) => {
|
||||
let $event = args[args.length - 1]
|
||||
console.log(`${this.$name} receive ${$event.name} from ${$event.source.name}`)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
tap () {
|
||||
// this.num = this.num + 1
|
||||
console.log(this.$name + ' tap')
|
||||
},
|
||||
add () {
|
||||
let len = this.list.length
|
||||
this.list.push({id: len + 1, title: 'title_' + len})
|
||||
},
|
||||
remove (index) {
|
||||
this.$delete(this.list, index);
|
||||
}
|
||||
},
|
||||
|
||||
onLoad () {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
71
mini-app/src/js/request.js
Normal file
71
mini-app/src/js/request.js
Normal file
@ -0,0 +1,71 @@
|
||||
import appManager from '../appManager'
|
||||
import { uuid } from './utils/uuid'
|
||||
import store from '@/store'
|
||||
|
||||
class Xiao4rRequest {
|
||||
// 网络请求任务对象 Map
|
||||
requestTaskMap = new Map()
|
||||
|
||||
/**
|
||||
* requestPromise用于将wx.request改写成Promise方式
|
||||
* @param:{string} myUrl 接口地址
|
||||
* @return: Promise实例对象
|
||||
*/
|
||||
requestPromise(req) {
|
||||
let id = uuid()
|
||||
let self = this
|
||||
|
||||
if (store.state.user.token) {
|
||||
if (req.header) {
|
||||
req.header['Authorization'] = store.state.user.token
|
||||
} else {
|
||||
req.header = {
|
||||
Authorization: store.state.user.token
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
const task = wx.request({
|
||||
url: req.url,
|
||||
method: req.method,
|
||||
header: req.header,
|
||||
data: req.data,
|
||||
success: rsp => resolve(rsp.data),
|
||||
fail: error => {
|
||||
appManager.showToast('网络连接异常.')
|
||||
reject(error)
|
||||
},
|
||||
complete: () => {
|
||||
this.requestTaskMap.delete(id)
|
||||
}
|
||||
})
|
||||
self.requestTaskMap.set(id, task)
|
||||
})
|
||||
// 返回一个Promise实例对象
|
||||
promise.taskId = id
|
||||
return promise
|
||||
}
|
||||
|
||||
post(req) {
|
||||
req.method = 'POST'
|
||||
return this.requestPromise(req)
|
||||
}
|
||||
|
||||
get(req) {
|
||||
req.method = 'GET'
|
||||
return this.requestPromise(req)
|
||||
}
|
||||
|
||||
put(req) {
|
||||
req.method = 'PUT'
|
||||
return this.requestPromise(req)
|
||||
}
|
||||
|
||||
del(req) {
|
||||
req.method = 'DEL'
|
||||
return this.requestPromise(req)
|
||||
}
|
||||
}
|
||||
|
||||
export default new Xiao4rRequest()
|
||||
14
mini-app/src/js/utils/uuid.js
Normal file
14
mini-app/src/js/utils/uuid.js
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
export function uuid() {
|
||||
var s = []
|
||||
var hexDigits = '0123456789abcdef'
|
||||
for (var i = 0; i < 36; i++) {
|
||||
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
|
||||
}
|
||||
s[14] = '4' // bits 12-15 of the time_hi_and_version field to 0010
|
||||
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1) // bits 6-7 of the clock_seq_hi_and_reserved to 01
|
||||
s[8] = s[13] = s[18] = s[23] = '-'
|
||||
|
||||
var uuid = s.join('')
|
||||
return uuid
|
||||
}
|
||||
23
mini-app/src/js/utils/validateUtils.js
Normal file
23
mini-app/src/js/utils/validateUtils.js
Normal file
@ -0,0 +1,23 @@
|
||||
class ValidateUtils {
|
||||
isEmail(value) {
|
||||
|
||||
const reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/
|
||||
|
||||
return reg.test(value)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验数字或者小数
|
||||
* @param text
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isIntOrDecimal(text) {
|
||||
|
||||
let pattern = /^[0-9]+([.]{1}[0-9]+){0,1}$/;
|
||||
return pattern.test(text)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default new ValidateUtils()
|
||||
29
mini-app/src/mixins/defaultMix.js
Normal file
29
mini-app/src/mixins/defaultMix.js
Normal file
@ -0,0 +1,29 @@
|
||||
import appManager from '../appManager'
|
||||
|
||||
export default {
|
||||
data: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
onNavItem (item) {
|
||||
appManager.navigateTo(item.path)
|
||||
},
|
||||
navBack() {
|
||||
wx.navigateBack()
|
||||
},
|
||||
parseImage(imageKey) {
|
||||
return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
|
||||
}
|
||||
},
|
||||
created () {
|
||||
|
||||
let pages = getCurrentPages()
|
||||
// console.log(pages)
|
||||
let currPage = null
|
||||
if (pages.length) {
|
||||
currPage = pages[pages.length - 1]
|
||||
}
|
||||
console.log("currPage:", currPage)
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user