Browse Source

canvas

devlop
mo-bai 4 years ago
parent
commit
b8038d59ee
11 changed files with 370 additions and 71 deletions
  1. BIN
      .DS_Store
  2. 62
      common/css/reset.scss
  3. 2
      pages.json
  4. 13
      pages/login/index.vue
  5. 293
      pages/mall/index.vue
  6. 71
      pages/trade/quotationList.vue
  7. BIN
      static/.DS_Store
  8. BIN
      static/imgs/.DS_Store
  9. BIN
      static/imgs/mall/border-bg.png
  10. BIN
      static/imgs/mall/close-icon.png
  11. BIN
      static/imgs/mall/qrCode-bg.png

BIN
.DS_Store

62
common/css/reset.scss

@ -24,6 +24,68 @@ form {
display: block;
}
view,
image,
text {
box-sizing: border-box;
flex-shrink: 0;
}
.flex-row {
display: flex;
flex-direction: row;
}
.flex-col {
display: flex;
flex-direction: column;
}
.justify-start {
display: flex;
justify-content: flex-start;
}
.justify-center {
display: flex;
justify-content: center;
}
.justify-end {
display: flex;
justify-content: flex-end;
}
.justify-evenly {
display: flex;
justify-content: space-evenly;
}
.justify-around {
display: flex;
justify-content: space-around;
}
.justify-between {
display: flex;
justify-content: space-between;
}
.items-start {
display: flex;
align-items: flex-start;
}
.items-center {
display: flex;
align-items: center;
}
.items-end {
display: flex;
align-items: flex-end;
}
cover-view {
line-height: 1.5;
white-space: normal;

2
pages.json

@ -65,7 +65,7 @@
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"app-plus": {
"softinputMode": "adjustResize"
"softinputMode": "adjustPan"
}
}
},

13
pages/login/index.vue

@ -1,5 +1,5 @@
<template>
<view style="background-color: white; height: 100vh">
<view class="content">
<uni-nav-bar :fixed="true" color="#ffffff" background-color="#ffffff" :status-bar="true" :border="false" left-icon="closeempty" @clickLeft="close" />
<view class="logo_area">
<image class="logo" src="/static/logo.png"></image>
@ -180,7 +180,13 @@ export default {
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.content {
background-color: white;
height: 100vh;
min-height:650px;
position: relative;
}
.logo_area {
margin-top: 187rpx;
width: 750rpx;
@ -250,7 +256,8 @@ export default {
}
}
.agreement_area {
position: fixed;
// position: fixed;
position: absolute;
bottom: 108rpx;
width: 750rpx;
display: flex;

293
pages/mall/index.vue

@ -1,7 +1,12 @@
<template>
<view>
<view style="position: relative">
<view v-if="hasCompany && hasLogin" class="wrapper">
<uni-nav-bar :fixed="true" color="#ffffff" background-color="#ffffff" :status-bar="true">
<uni-nav-bar
:fixed="true"
color="#ffffff"
background-color="#ffffff"
:status-bar="true"
>
<view slot="left" class="left-title">纸商城</view>
<view slot="right" class="right-title" @tap="shareTap">分享</view>
</uni-nav-bar>
@ -9,23 +14,42 @@
<view class=""><image class="image" :src="logo" mode=""></image></view>
<view class="center">
<view class="title">{{ storeInformation.name }}</view>
<view class="desc">全部商品 {{ storeInformation.productNumber }} &nbsp; | &nbsp;上新 {{ storeInformation.currentProductNumber }}</view>
<view class="desc"
>全部商品 {{ storeInformation.productNumber }} &nbsp; | &nbsp;上新
{{ storeInformation.currentProductNumber }}</view
>
</view>
<view class="right">
<view class="cut" @click="checkMall()">
切换商城
<image class="cut-icon" src="/static/imgs/mall/cut-icon.png" mode=""></image>
<image
class="cut-icon"
src="/static/imgs/mall/cut-icon.png"
mode=""
></image>
</view>
<view class="set" @click="setting">设置</view>
</view>
</view>
<view>
<scroll-list ref="list" :option="option" @load="upCallback" @refresh="downCallback">
<view v-for="(item, index) in listData" :key="index" style="margin-bottom: 20rpx">
<scroll-list
ref="list"
:option="option"
@load="upCallback"
@refresh="downCallback"
>
<view
v-for="(item, index) in listData"
:key="index"
style="margin-bottom: 20rpx"
>
<view class="content" @click="detailInfo(item)">
<image
class="image"
:src="item.litPicUrl || 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/paper-default-small.png'"
:src="
item.litPicUrl ||
'https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/paper-default-small.png'
"
mode=""
></image>
<view class="" style="width: 100%">
@ -34,24 +58,47 @@
<view class="">
<image
class="icon"
:src="item.status === 30111 ? '/static/imgs/mall/grounding-icon.png' : '/static/imgs/mall/sold-out-icon.png'"
:src="
item.status === 30111
? '/static/imgs/mall/grounding-icon.png'
: '/static/imgs/mall/sold-out-icon.png'
"
mode=""
></image>
</view>
</view>
<view class="sub-title">{{ item.manufacturerName }}/{{ item.categoryName }}/{{ item.brandName }}</view>
<view class="desc flex-row-center-start" style="flex-wrap: wrap">
<view class="sub-title"
>{{ item.manufacturerName }}/{{ item.categoryName }}/{{
item.brandName
}}</view
>
<view
class="desc flex-row-center-start"
style="flex-wrap: wrap"
>
克重(价格)
<text style="margin-right: 8rpx" v-for="(sku, index) in item.skuList" :key="index">{{ sku.weight }}g({{ sku.listPrice }})</text>
<text
style="margin-right: 8rpx"
v-for="(sku, index) in item.skuList"
:key="index"
>{{ sku.weight }}g({{ sku.listPrice }})</text
>
</view>
</view>
</view>
<view class="other">
<view class="time">{{ item.updateTime | timeFilter }}</view>
<view class="btn">
<view class="" @click="editPaper(item)" v-if="item.status === 30112">编辑</view>
<view
class=""
@click="editPaper(item)"
v-if="item.status === 30112"
>编辑</view
>
<view class="divide"></view>
<view class="" @click="productStatusChange(item)">{{ item.status === 30111 ? '下架' : '上架' }}</view>
<view class="" @click="productStatusChange(item)">{{
item.status === 30111 ? '下架' : '上架'
}}</view>
</view>
</view>
</view>
@ -61,17 +108,65 @@
</scroll-list>
</view>
<view>
<view class="offer-prices" @click="nativeTo()"><image class="my-image" src="../../static/imgs/trade/camera.png"></image></view>
<view class="offer-prices" @click="nativeTo()"
><image
class="my-image"
src="../../static/imgs/trade/camera.png"
></image
></view>
</view>
</view>
<view v-else>
<uni-nav-bar :fixed="true" :status-bar="true">
<view slot="left" style="font-size: 40rpx; color: #000000">纸商城</view>
</uni-nav-bar>
<view v-if="hasLogin && !hasCompany" class="flex-col-center-center" style="margin-top: 100rpx">
<text style="font-size: 30rpx; text-align: center; font-weight: 600">请先完善企业基本信息</text>
<view
v-if="hasLogin && !hasCompany"
class="flex-col-center-center"
style="margin-top: 100rpx"
>
<text style="font-size: 30rpx; text-align: center; font-weight: 600"
>请先完善企业基本信息</text
>
</view>
<view class="" v-if="!hasLogin"
><not-logged @loginChange="loginChange()"></not-logged
></view>
</view>
<view class="flex-col section_4" v-show="visible">
<image
src="/static/imgs/mall/close-icon.png"
class="image_9"
@click="closeShare"
/>
<!-- <view class="flex-col section_5">
<view class="flex-col section_6">
<view class="flex-col items-center group_13">
<image src="/static/imgs/mall/border-bg.png" class="image_10" />
<image :src="shareInfo.storeCodeImg" class="image_11" />
</view>
<view class="flex-col items-center group_14">
<text class="text_15">{{ shareInfo.storeName }}</text>
<text class="text_16">每天上新特价纸库存有限先到先得</text>
</view>
</view>
</view> -->
<canvas
style="
width: 280px;
height: 355px;
margin-top: 15px;
padding: 60rpx 0;
border-radius: 20rpx;
"
canvas-id="posters"
id="posters"
></canvas>
<view class="bottom-group flex-row view_3">
<text>下载海报</text>
<text class="text_18">下载二维码</text>
<text class="text_19">分享</text>
</view>
<view class="" v-if="!hasLogin"><not-logged @loginChange="loginChange()"></not-logged></view>
</view>
<!-- <view class="share-area" v-if="visible" @click="closeShare">
<view class="share-content">
@ -88,9 +183,9 @@
</view>
</view>
</view> -->
<view v-if="visible" @click="closeShare">
<!-- <web-view :webview-styles="webviewStyles" src="/hybrid/html/share.html"></web-view> -->
</view>
<!-- <view v-if="visible" @click="closeShare">
<web-view :webview-styles="webviewStyles" src="/hybrid/html/share.html"></web-view>
</view> -->
</view>
</template>
@ -98,7 +193,12 @@
import notLogged from '@/components/not-logged/not-logged.vue'
import uGap from '@/components/u-gap/u-gap.vue'
import { back, go2, loginGo2, screenShot } from '@/utils/hook.js'
import { SupplierList, productStatus, storeDetail, getSupplierQrCode } from '@/apis/add-paper.js'
import {
SupplierList,
productStatus,
storeDetail,
getSupplierQrCode,
} from '@/apis/add-paper.js'
import { getTimer } from '@/utils/index.js'
import noData from './no-data.vue'
export default {
@ -110,30 +210,31 @@ export default {
abs = getTimer(value)
}
return abs
}
},
},
data() {
return {
shareInfo: {
storeCodeImg: '',
storeName: ''
storeName: '',
},
visible: false, //
canvasReady: false,
storeInformation: {
supplierId: null,
name: null,
productNumber: 0,
currentProductNumber: 0
currentProductNumber: 0,
},
option: {
size: 10,
auto: true,
emptyText: '暂无数据~',
disabled: false
disabled: false,
},
pattern: {
backgroundColor: '#007AFF',
buttonColor: '#007AFF'
buttonColor: '#007AFF',
},
content: [],
horizontal: 'right',
@ -144,12 +245,13 @@ export default {
pageSize: 10,
storeId: null,
name: null,
supplierId: this.$store.state.supplierInfo.supplierId
supplierId: this.$store.state.supplierInfo.supplierId,
},
listData: [],
logo: '/static/imgs/mine/user-avatar.png',
backgroundStyle: 'background: url("/static/imgs/mall/top-bg.png") no-repeat;',
storeInfo: ''
backgroundStyle:
'background: url("/static/imgs/mall/top-bg.png") no-repeat;',
storeInfo: '',
}
},
computed: {
@ -158,12 +260,12 @@ export default {
},
hasLogin() {
return this.$store.state.qnToken != ''
}
},
},
onShow() {
if (this.hasCompany) {
this.storeInformation = {
supplierId: this.$store.state.supplierInfo.supplierId
supplierId: this.$store.state.supplierInfo.supplierId,
}
this.downCallback()
this.getSupplier(this.$store.state.supplierInfo.supplierId)
@ -185,7 +287,11 @@ export default {
if (res) {
this.storeInfo = res
this.$set(this.storeInformation, 'productNumber', res.productNumber)
this.$set(this.storeInformation, 'currentProductNumber', res.currentProductNumber)
this.$set(
this.storeInformation,
'currentProductNumber',
res.currentProductNumber
)
this.$set(this.storeInformation, 'name', res.name)
if (!res.logo) {
this.logo = '/static/imgs/mine/user-avatar.png'
@ -193,9 +299,11 @@ export default {
this.logo = res.logo
}
if (!res.backgroundImg) {
this.backgroundStyle = 'background: url("/static/imgs/mall/top-bg.png") no-repeat;'
this.backgroundStyle =
'background: url("/static/imgs/mall/top-bg.png") no-repeat;'
} else {
this.backgroundStyle = 'background: url(' + res.backgroundImg + ') no-repeat;'
this.backgroundStyle =
'background: url(' + res.backgroundImg + ') no-repeat;'
}
}
})
@ -249,7 +357,7 @@ export default {
//
nativeTo() {
var params = {
title: '添加纸品'
title: '添加纸品',
}
go2('add-paper', params)
},
@ -257,7 +365,7 @@ export default {
editPaper(item) {
var params = {
...item,
title: '编辑纸品'
title: '编辑纸品',
}
go2('add-paper', params)
},
@ -273,13 +381,13 @@ export default {
productStatusChange(item) {
var params = {
id: item.id,
status: item.status === 30111 ? 30112 : 30111
status: item.status === 30111 ? 30112 : 30111,
}
productStatus(params).then((res) => {
if (res) {
uni.showToast({
title: '状态修改成功',
icon: 'success'
icon: 'success',
})
setTimeout(() => {
this.orderPagination.pageNum = 1
@ -291,28 +399,41 @@ export default {
//
shareTap() {
if (this.hasCompany) {
getSupplierQrCode({ mallSupplierId: this.$store.state.supplierInfo.supplierId }).then((res) => {
if (this.visible) {
return
}
getSupplierQrCode({
mallSupplierId: this.$store.state.supplierInfo.supplierId,
}).then((res) => {
if (res) {
this.visible = true
this.shareInfo.storeCodeImg = `data:image/png;base64,${res}`
this.shareInfo.storeName = this.storeInformation.name
setTimeout(() => {
this.createCanvas()
}, 500)
}
})
} else {
uni.showToast({
title: '请先完善企业信息',
icon: 'none'
icon: 'none',
})
}
},
closeShare() {
this.visible = false
}
}
},
createCanvas() {
let ctx = uni.createCanvasContext('posters', this)
ctx.drawImage('/static/imgs/mall/qrCode-bg.png', 0, 0, 280, 355)
ctx.draw(false, () => {})
},
},
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.wrapper {
width: 750rpx;
overflow: hidden;
@ -521,7 +642,8 @@ export default {
.border {
width: 540rpx;
height: 540rpx;
background: url('https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/qrCode-border.png') no-repeat center/cover;
background: url('https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/qrCode-border.png')
no-repeat center/cover;
}
}
.down-button {
@ -537,4 +659,87 @@ export default {
}
}
}
.section_4 {
z-index: 100;
padding: 252rpx 36rpx 403rpx 95rpx;
background-color: rgba(0, 0, 0, 0.5);
top: 0;
right: 0;
bottom: 0;
left: 0;
position: absolute;
.image_9 {
align-self: flex-end;
width: 62rpx;
height: 62rpx;
}
.section_5 {
margin-top: 30rpx;
padding: 60rpx 0;
border-radius: 20rpx;
background-image: url('/static/imgs/mall/qrCode-bg.png');
background-size: 100% 100%;
background-repeat: no-repeat;
width: 560rpx;
.section_6 {
margin: 0 32rpx;
padding: 50rpx 56rpx 0;
background-color: rgb(255, 255, 255);
box-shadow: 0px 2rpx 10rpx 0px rgba(0, 0, 0, 0.1);
border-radius: 16rpx;
width: 496rpx;
.group_13 {
margin: 0 12rpx;
position: relative;
.image_10 {
width: 360rpx;
height: 360rpx;
}
.image_11 {
width: 330rpx;
height: 330rpx;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
.group_14 {
padding: 40rpx 0 56rpx;
.text_15 {
color: rgb(51, 51, 51);
font-size: 30rpx;
font-weight: 500;
line-height: 42rpx;
white-space: nowrap;
}
.text_16 {
margin-top: 10rpx;
color: rgb(136, 136, 136);
font-size: 24rpx;
font-weight: 500;
line-height: 33rpx;
white-space: nowrap;
}
}
}
}
.bottom-group {
padding: 0 32rpx;
.text_18 {
margin-left: 83rpx;
}
.text_19 {
margin-left: 83rpx;
}
}
.view_3 {
margin-top: 40rpx;
color: rgb(255, 255, 255);
font-size: 30rpx;
font-weight: 500;
line-height: 42rpx;
white-space: nowrap;
}
}
</style>

71
pages/trade/quotationList.vue

@ -1,30 +1,50 @@
<template>
<view class="quotation-list">
<scroll-list ref="quotationRef" :option="option" @load="quotationUp" @refresh="quotationDown">
<view v-for="(item, index) in list" :key="index" style="margin-bottom: 20rpx">
<scroll-list
ref="quotationRef"
:option="option"
@load="quotationUp"
@refresh="quotationDown"
>
<view
v-for="(item, index) in list"
:key="index"
style="margin-bottom: 20rpx"
>
<view class="list-border list-title-line">
<text class="list-title">{{ item.belongEnterpriseName }}</text>
<text class="list-title-Subtitle">{{ item.replyStatus | replyStatusName }}</text>
<text class="list-title-Subtitle">{{
item.replyStatus | replyStatusName
}}</text>
</view>
<view class="" @click="offerClick(item)">
<view class="list-border list-info-line">
<view
class="list-info"
:class="subIndex + 1 === item.itemList.length ? '' : 'list-border'"
:class="
subIndex + 1 === item.itemList.length ? '' : 'list-border'
"
v-for="(subItem, subIndex) in item.itemList"
:key="subIndex"
>
<view class="">
<image
class="list-image"
:src="subItem.productImg || 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/paper-default-small.png'"
:src="
subItem.productImg ||
'https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/paper-default-small.png'
"
mode=""
></image>
</view>
<view class="list-info-contant">
<view class="list-info-title">{{ subItem.paperName }}</view>
<view class="list-info-text">
{{ subItem.brandName }}/{{ subItem.categoryName }}/{{ subItem.gramWeight }}g/{{ subItem.width }}*{{ subItem.length }}/{{ subItem.quantity }}
{{ subItem.brandName }}/{{ subItem.categoryName }}/{{
subItem.gramWeight
}}g/{{ subItem.width }}*{{ subItem.length }}/{{
subItem.quantity
}}
</view>
</view>
</view>
@ -43,7 +63,9 @@
<text>报价截止</text>
<text>{{ item.enquiryValidTime }}</text>
</view>
<view><button type="primary" class="offer-btn">报价</button></view>
<view
><button type="primary" class="offer-btn">报价</button></view
>
</view>
</view>
</view>
@ -51,7 +73,11 @@
</scroll-list>
<view>
<view class="offer-prices" @click="nativeTo()">
<image class="my-image" src="../../static/imgs/trade/myPrice.png" mode=""></image>
<image
class="my-image"
src="../../static/imgs/trade/myPrice.png"
mode=""
></image>
<view class="my-price">我的报价</view>
</view>
</view>
@ -66,17 +92,17 @@ export default {
props: {
queryData: {
type: Object,
default: () => {}
}
default: () => {},
},
},
components: {
uGap
uGap,
},
props: {
refresh: {
type: Boolean,
default: false
}
default: false,
},
},
data() {
return {
@ -85,25 +111,25 @@ export default {
auto: true,
emptyText: '暂无报价信息~',
fontSize: '40rpx',
emptyImage: '/static/imgs/client-detail/no-data-icon.png'
emptyImage: '/static/imgs/client-detail/no-data-icon.png',
},
params: {
asc: '',
desc: '',
mallSupplierIds: [this.$store.state.supplierInfo.supplierId] // ID
mallSupplierIds: [this.$store.state.supplierInfo.supplierId], // ID
// mallSupplierIds: ['553703427180466176'] // ID
},
pagination: {
pageNum: 0, //
pageSize: 20
pageSize: 20,
},
list: []
list: [],
}
},
watch: {
refresh() {
this.quotationDown()
}
},
},
filters: {
replyStatusName(status) {
@ -126,7 +152,7 @@ export default {
break
}
return name
}
},
},
methods: {
//
@ -134,7 +160,6 @@ export default {
return new Promise((resolve, reject) => {
getEnterpriseList({ ...this.params, ...this.pagination })
.then((res) => {
console.log('获取报价列表', res)
if (res) {
if (res.current == 1) {
this.list = res.records
@ -180,15 +205,15 @@ export default {
offerClick(item) {
var params = {
...item,
title: '提交报价'
title: '提交报价',
}
go2('submit-quotation', params)
},
//
nativeTo() {
go2('my-offer')
}
}
},
},
}
</script>

BIN
static/.DS_Store

BIN
static/imgs/.DS_Store

BIN
static/imgs/mall/border-bg.png

Before After
Width: 720  |  Height: 720  |  Size: 27 KiB

BIN
static/imgs/mall/close-icon.png

Before After
Width: 62  |  Height: 62  |  Size: 1.7 KiB

BIN
static/imgs/mall/qrCode-bg.png

Before After
Width: 560  |  Height: 710  |  Size: 44 KiB
Loading…
Cancel
Save