Browse Source

零售完善

tags/v1.1.30
张家华 3 years ago
parent
commit
fb2b9f7b50
  1. 14
      src/pages.json
  2. BIN
      src/static/images/icon/retail/paySuccess.png
  3. BIN
      src/static/images/icon/retail/storeIcon.png
  4. 43
      src/subpackage/retail/components/hover_cart_list/hover_cart_list.vue
  5. 221
      src/subpackage/retail/components/store_card_select/store_card_select.vue
  6. 419
      src/subpackage/retail/pages/confirm_goods/confirm_goods.vue
  7. 569
      src/subpackage/retail/pages/confirm_order/confirm_order.vue
  8. 28
      src/subpackage/retail/pages/index/index.vue
  9. 77
      src/subpackage/retail/pages/pay_success/pay_success.vue

14
src/pages.json

@ -435,7 +435,19 @@
{
"path": "pages/confirm_goods/confirm_goods",
"style" : {
"navigationBarTitleText": "确定商品"
"navigationBarTitleText": "确认订单"
}
},
{
"path": "pages/confirm_order/confirm_order",
"style" : {
"navigationBarTitleText": "确认订单"
}
},
{
"path": "pages/pay_success/pay_success",
"style" : {
"navigationBarTitleText": "支付订单"
}
},
{

BIN
src/static/images/icon/retail/paySuccess.png

After

Width: 132  |  Height: 132  |  Size: 1.4 KiB

BIN
src/static/images/icon/retail/storeIcon.png

After

Width: 32  |  Height: 30  |  Size: 1.1 KiB

43
src/subpackage/retail/components/hover_cart_list/hover_cart_list.vue

@ -15,8 +15,7 @@
<view class="item-right">
<view class="item-right-top">
<view class="item-right-name">{{ item.erp_goods_name }}</view>
<view class="item-right-spec">{{ item.erp_goods_specs }}</view>
<view class="item-right-special">特价</view>
<view class="item-right-spec">{{ `${item.erp_goods_specs}/${item.erp_goods_specs}/${item.erp_goods_specs}` }}</view>
</view>
<view class="item-right-price-count">
@ -169,10 +168,11 @@
flex-direction: row;
padding-top: 30rpx;
padding-bottom: 30rpx;
// border: 1px solid red;
.item-left {
width: 172rpx;
height: 172rpx;
width: 180rpx;
height: 180rpx;
margin-right: 20rpx;
position: relative;
border-radius: 10rpx;
@ -181,31 +181,6 @@
max-width: 100%;
max-height: 100%;
}
.item-left-empty {
width: 100%;
height: 100%;
position: absolute;
top: 0rpx;
left: 0rpx;
background-color: rgba(0,0,0,0.5);
border-radius: 10rpx;
>view {
font-size: 28rpx;
color: #333333;
background: #FFFFFF;
width: 88rpx;
height: 88rpx;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
justify-content: center;
align-items: center;
}
}
}
.item-right {
display: flex;
@ -227,16 +202,6 @@
font-size: 24rpx;
color: rgb(154,154,157);
}
.item-right-special {
width: 58rpx;
height: 28rpx;
margin-bottom: 10rpx;
font-size: 20rpx;
color: #E60012;
background: rgba(230,0,18,0.13);
border-radius: 6px;
text-align: center;
}
}
.item-right-price-count {

221
src/subpackage/retail/components/retail_pay_way/retail_pay_way.vue → src/subpackage/retail/components/store_card_select/store_card_select.vue

@ -4,24 +4,15 @@
<view class="win-operate">
<image mode="aspectFit" src="/static/images/icon/retail/close.png" @click="onClose"></image>
<text class="win-title">{{ curChoose.name == "储值卡支付" ? "请选择储值卡" : "请选择支付方式" }}</text>
<view class="win-way" v-if="curChoose.name!='储值卡支付'?true:false">
<view class="win-way-item" v-for="(item, index) in payWayList" :key="index" @click="onPayWayClick(item, index)">
<image :class="[item.iconClassA, item.iconClassB]" mode="aspectFit" :src="item.icon"></image>
<text>{{ item.name }}</text>
<input v-if="item.inputShow" v-model="item.inputValue" :placeholder="item.placeholderLabel" placeholder-style="win-way-item-input-placeholder">
<image :class="[item.markClassA, item.markClassB]" mode="aspectFit" :src="item.mark"></image>
<view></view>
</view>
</view>
<view class="win-card" v-if="curChoose.name=='储值卡支付'?true:false">
<text class="win-title">请选择储值卡</text>
<view class="win-card">
<view class="win-card-search">
<image v-if="searchCardValue?false:true" mode="aspectFit" src="/static/images/icon/retail/search.png"></image>
<input v-model="searchCardValue" @confirm="searchCardList" placeholder="请输入微信昵称/手机号码/储值卡号搜索" placeholder-style="win-card-search-input-placeholder">
</view>
<view class="win-card-list">
<view class="win-card-list-item" v-for="(item, index) in cardList" :key="index" @click="onCardClick(item)">
<view class="win-card-list-item" v-for="(item, index) in cardList" :key="index" @click="onCardClick(item)" :style="{borderColor:item.mark===choosePath?'#009874':'#979797'}">
<view>储值卡卡号<text :style="{color:item.color.card_no}">{{ item.card_no }}</text></view>
<view>微信昵称<text :style="{color:item.color.nickname}">{{ item.nickname }}</text></view>
<view>手机号码<text :style="{color:item.color.mobile}">{{ item.mobile }}</text></view>
@ -51,16 +42,14 @@
data() {
return {
cardList: [], //
payWayList: [], //
choosePath: "/static/images/icon/retail/choose.png",
noChoosePath: "/static/images/icon/retail/noChoose.png",
curChoose: {},
curCardChoose: null,
searchCardValue: "",
}
},
created() {
this.createPayWayList(); //
},
methods: {
//
@ -126,16 +115,6 @@
//
resetData() {
for (let i = 0; i < this.payWayList.length; ++i) {
this.payWayList[i].inputValue = "";
if (this.payWayList[i].name != "储值卡支付") {
this.payWayList[i].mark = this.noChoosePath;
}
}
this.payWayList[0].mark = this.choosePath;
this.curChoose = this.payWayList[0];
this.curCardChoose = null;
this.cardList = [];
this.searchCardValue = "";
@ -143,117 +122,20 @@
//
onClose() {
this.resetData(); //
// this.resetData(); //
this.$emit("update:onClose", false);
},
//
onConfirm() {
let info = {
type: 0,
inputValue: "default",
cardNo: "default"
};
switch (this.curChoose.name) {
case "微信支付": {
info.type = 0;
} break;
case "支付宝支付": {
info.type = 1;
} break;
case "现金支付": {
info.type = 3;
} break;
case "其他": {
if (!this.curChoose.inputValue) {
util.showNone("请输入其他支付方式!");
return;
}
info.type = 4;
info.inputValue = this.curChoose.inputValue;
} break;
case "储值卡支付": {
if (!this.curCardChoose) {
util.showNone("请搜索选择储值卡!");
return;
}
info.type = 2;
info.cardNo = this.curCardChoose.card_no;
} break;
if (!this.curCardChoose) {
util.showNone("请搜索选择储值卡!");
return;
}
this.$emit("update:onConfirm", this.curCardChoose);
this.onClose();
this.$emit("update:onConfirm", info);
},
//
onPayWayClick(item, index) {
this.curChoose = item;
if (item.name != "储值卡支付") {
for (let i = 0; i < this.payWayList.length; ++i) {
if (this.payWayList[i].name != "储值卡支付") {
this.payWayList[i].mark = this.noChoosePath;
}
}
this.payWayList[index].mark = this.choosePath;
}
else {
}
},
//
createPayWayList() {
this.payWayList = [
{
type: 0, name: "微信支付", inputShow: false, inputValue: "",
icon: "/static/images/icon/retail/wechat.png",
iconClassA: "win-way-item-icon", iconClassB: "",
placeholderLabel: "请输入其他支付方式",
mark: this.choosePath,
markClassA: "win-way-item-mark", markClassB: "",
},
{
type: 1, name: "支付宝支付", inputShow: false, inputValue: "",
icon: "/static/images/icon/retail/alipay.png",
iconClassA: "win-way-item-icon", iconClassB: "",
placeholderLabel: "请输入其他支付方式",
mark: this.noChoosePath,
markClassA: "win-way-item-mark", markClassB: "",
},
{
type: 3, name: "现金支付", inputShow: false, inputValue: "",
icon: "/static/images/icon/retail/cash.png",
iconClassA: "win-way-item-icon", iconClassB: "win-way-item-icon-dif",
placeholderLabel: "请输入其他支付方式",
mark: this.noChoosePath,
markClassA: "win-way-item-mark", markClassB: "",
},
{
type: 2, name: "储值卡支付", inputShow: false, inputValue: "",
icon: "/static/images/icon/retail/card.png",
iconClassA: "win-way-item-icon", iconClassB: "win-way-item-icon-dif",
placeholderLabel: "请输入其他支付方式",
mark: "/static/images/icon/retail/turn.png",
markClassA: "win-way-item-mark", markClassB: "win-way-item-mark-dif",
},
{
type: 4, name: "其他", inputShow: true, inputValue: "",
icon: "/static/images/icon/retail/other.png",
iconClassA: "win-way-item-icon", iconClassB: "",
placeholderLabel: "请输入其他支付方式",
mark: this.noChoosePath,
markClassA: "win-way-item-mark", markClassB: "",
},
];
this.curChoose = this.payWayList[0];
},
}
}
}
</script>
@ -302,84 +184,6 @@
margin-bottom: 54rpx;
}
.win-way {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
.win-way-item {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
padding-left: 40rpx;
padding-right: 36rpx;
padding-top: 28rpx;
padding-bottom: 28rpx;
position: relative;
.win-way-item-icon {
width: 54rpx;
height: 54rpx;
flex-shrink: 0;
}
.win-way-item-mark {
width: 36rpx;
height: 36rpx;
flex-shrink: 0;
}
.win-way-item-icon-dif {
width: 52rpx;
height: 52rpx;
flex-shrink: 0;
}
.win-way-item-mark-dif {
width: 34rpx;
height: 34rpx;
flex-shrink: 0;
}
> text {
color: rgba(24, 24, 24, 1);
font-size: 28rpx;
flex-grow: 1;
flex-shrink: 0;
margin-left: 16rpx;
margin-right: 16rpx;
}
> view {
width: 90%;
height: 1rpx;
background-color: rgba(216, 216, 216, 1);
position: absolute;
bottom: 0%;
right: 0%;
}
> input {
margin-left: 24rpx;
margin-right: 132rpx;
width: 340rpx;
border-radius: 10rpx;
border: 2rpx solid rgba(216, 216, 216, 1);
background-color: white;
padding-left: 16rpx;
padding-right: 16rpx;
padding-top: 10rpx;
padding-bottom: 10rpx;
font-size: 28rpx;
}
.win-way-item-input-placeholder {
color: rgba(154, 154, 157, 1);
font-size: 28rpx;
}
}
}
.win-way-confirm {
width: 100%;
padding-left: 20rpx;
@ -465,7 +269,8 @@
display: flex;
flex-direction: column;
width: 100%;
border: 1rpx solid rgba(151, 151, 151, 1);
border: 1rpx solid #979797;
border-color: #979797;
border-radius: 10rpx;
padding: 20rpx;
margin-bottom: 24rpx;

419
src/subpackage/retail/pages/confirm_goods/confirm_goods.vue

@ -2,25 +2,30 @@
<view class="cg-container">
<view class="final-cart-list">
<view class="final-cart-list-dialog-title">
<view>商品名称</view>
<view>售价</view>
<view>数量</view>
<view class="icon-line">
<image mode="aspectFit" src="/static/images/icon/retail/storeIcon.png"></image>
<view>{{ curStore.name ? curStore.name : '' }}</view>
</view>
</view>
<scroll-view class="final-cart-list-dialog-content" :scroll-top="0" :scroll-y="cartListScroll" :style="{ height:cartListFinalHeight, paddingBottom:cartListFinalPaddingBottom }">
<view class="final-cart-list-dialog-content-for" :style="{ borderBottom:item.borderBottom }" v-for="item in cartListFinal" :key="item.id">
<view class="final-cart-list-dialog-content-col1">
<view>{{ item.erp_goods_name }}</view>
<view>{{ item.erp_goods_specs }}</view>
</view>
<view class="final-cart-list-dialog-content-col2">
<input v-if="isEdited" type="digit" :value="item.erp_goods_price" @confirm="cartInputConfirm($event, item.id)" @blur="cartInputConfirm($event, item.id)" />
<view v-if="!isEdited">{{item.erp_goods_price}}</view>
<view></view>
<scroll-view class="final-cart-list-dialog-content" :scroll-top="0" :scroll-y="true" :style="{ height:cartListFinalHeight, paddingBottom:cartListFinalPaddingBottom }">
<view class="main-right-list final-cart-list-dialog-content-for" v-for="item in cartListFinal" :key="item.id">
<view class="item-left">
<image mode="aspectFit" src="/static/images/icon/author_modal.png"></image>
</view>
<view class="final-cart-list-dialog-content-col3">
<image v-if="isEdited" mode="aspectFit" src="/static/images/icon/retail/sub.png" @click="cartCountClick('sub', item.id)"></image>
<view>{{ item.count }}</view>
<image v-if="isEdited" mode="aspectFit" src="/static/images/icon/retail/add.png" @click="cartCountClick('add', item.id)"></image>
<view class="item-right">
<view class="item-right-top">
<view class="item-right-name">{{ item.erp_goods_name }}</view>
<view class="item-right-spec">
<view>{{ `${item.erp_goods_specs}/${item.erp_goods_specs}/${item.erp_goods_specs}` }}</view>
<view>x{{ item.count }}</view>
</view>
</view>
<view class="item-right-price-count">
<view class="item-right-price-row">
<view><text></text>{{ item.erp_goods_price }}</view>
</view>
</view>
</view>
</view>
</scroll-view>
@ -29,22 +34,15 @@
<view class="cg-footer">
<view>
<view class="cg-footer-price">
<view>合计</view>
<view>实付款</view>
<view><text></text>{{ totalPrice }}</view>
</view>
<view class="cg-footer-btn">
<view class="cg-footer-btn-reedit" v-if="!isEdited" @click="cartReedit"><button hover-class="hover-active">重新编辑</button></view>
<view class="cg-footer-btn-confirm" @click="cartConfirm"><button hover-class="hover-active">{{cartConfirmText}}</button></view>
<view class="cg-footer-btn-confirm" @click="cartConfirm"><button hover-class="hover-active">提交订单</button></view>
</view>
</view>
</view>
<retailPayWay
:show="retailPayWayWin.show" :price="totalPrice" :storeId="curStore.id"
@update:onClose="showOrHidePayWay" @update:onConfirm="goodsRetail"
>
</retailPayWay>
</view>
</template>
@ -52,28 +50,19 @@
import util from '../../../../utils/util.js';
import tools from '../../js/tools';
import retailServer from '../../js/retail_server';
import retailApi from '../../js/retail_api';
import retailPayWay from '../../components/retail_pay_way/retail_pay_way.vue';
export default {
components: {
'retailPayWay': retailPayWay
},
data() {
return {
isEdited: false, //
curStore: {}, //
cartListFinal: [], //
totalPrice: 0, //
cartConfirmText: "收款出库", // ||
cartListScroll: false, //
cartListFinalHeight: "0rpx", //
cartListFinalPaddingBottom: "0rpx", //
retailPayWayWin: {
show: false,
},
}
},
onLoad(option) {
@ -83,11 +72,9 @@
this.cartListFinal = [];
for (let i = 0; i < data.cartListFinal.length; ++i) {
this.cartListFinal.push(tools.getNewObj(data.cartListFinal[i]));
this.cartListFinal[i]["borderBottom"] = "1rpx solid rgb(216,216,216)";
}
//
this.cartListFinal[this.cartListFinal.length - 1]["borderBottom"] = "0rpx solid rgb(216,216,216)";
this.fixMainHeight(); //
this.calcTotalPrice(); //
@ -95,153 +82,19 @@
setTimeout(util.hideLoad, 1000);
},
methods: {
//
showOrHidePayWay(status) {
this.retailPayWayWin.show = status;
},
//
cartReedit() {
this.isEdited = true;
this.cartConfirmText = "确认";
},
//
goodsRetail(info) {
let _this = this;
let data = [];
for (let i = 0; i < this.cartListFinal.length; ++i) {
if (this.cartListFinal[i].count) {
data.push({
id: this.cartListFinal[i].id,
name: this.cartListFinal[i].erp_goods_name,
price: this.cartListFinal[i].erp_goods_price,
nums: this.cartListFinal[i].count,
unit: this.cartListFinal[i].erp_goods_unit,
});
}
}
if (!data.length) {
util.showNone("暂无商品数量!");
return;
}
let newData = {
store_id: _this.curStore.id,
goods_data: data,
pay_type: info.type,
//
cartConfirm() {
let data = {
cartListFinal: this.cartListFinal,
curStore: this.curStore
};
if (info.inputValue) {
newData["other_pay_type"] = info.inputValue;
}
if (info.cardNo) {
newData["card_no"] = info.cardNo;
}
util.showLoad();
retailServer.post({
url: retailApi.assistantRetail,
data: newData,
isDefaultGet: false,
failMsg: '出库失败!'
}).then(res => {
if (res.data.code == 0) {
uni.setStorage({
key: "retailStatus",
data: "true",
success: function() {
util.hideLoad();
uni.navigateBack({
delta: 1
});;
},
fail: function(err) {
util.hideLoad();
uni.navigateBack({
delta: 1
});
},
});
}
else {
util.showNone(res.data.message || '操作失败!');
}
uni.navigateTo({
url: `/subpackage/retail/pages/confirm_order/confirm_order?data=${encodeURIComponent(JSON.stringify(data))}`
});
},
// ||
cartConfirm() {
if (this.cartConfirmText == "确认") {
this.isEdited = false;
this.cartConfirmText = "收款出库";
return;
}
let mark = false;
for (let i = 0; i < this.cartListFinal.length; ++i) {
if (this.cartListFinal[i].count) {
mark = true;
break;
}
}
if (!mark) {
util.showNone("暂无商品数量!");
return;
}
this.showOrHidePayWay(true); //
// this.showOrHidePayWay(true); //
// this.goodsRetail(); //
},
//
cartInputConfirm(event, id) {
//
let value = parseFloat(event.detail.value ? event.detail.value : 0).toFixed(2);
for (let i = 0; i < this.cartListFinal.length; ++i) {
if (this.cartListFinal[i].id == id) {
this.cartListFinal[i].erp_goods_price = value;
}
}
this.calcTotalPrice(); //
},
//
cartCountClick(type, id) {
//
let item = null;
for (let i = 0; i < this.cartListFinal.length; ++i) {
if (this.cartListFinal[i].id == id) {
item = this.cartListFinal[i];
break;
}
}
if (item) {
switch (type) {
case "add": {
//
if (item.count + 1 > item.stock_num) {
util.showNone("库存就这么多了!");
return;
}
item.count += 1;
} break;
case "sub": {
if (item.count <= 0) {
return;
}
item.count -= 1;
} break;
}
this.calcTotalPrice(); //
}
},
//
calcTotalPrice() {
let price = 0.0;
@ -264,12 +117,13 @@
// //
let query = uni.createSelectorQuery().select(".cg-footer");
query.boundingClientRect(data => {
sumHeight = sumHeight - data.height - uni.upx2px(90); // footer
sumHeight = sumHeight - data.height - uni.upx2px(100); // footer
let contentHeight = sumHeight;
query = uni.createSelectorQuery().select(".final-cart-list-dialog-content-for");
query.boundingClientRect(data => {
let itemSize = (data.height + uni.upx2px(30)); // 30margin
// let itemSize = (data.height + uni.upx2px(30)); // 30margin
let itemSize = data.height;
let limitCount = Math.floor(contentHeight / itemSize);
let height = _this.cartListFinal.length >= limitCount ? contentHeight : _this.cartListFinal.length * itemSize;
@ -314,30 +168,26 @@
background-color: rgb(237,237,245);
.final-cart-list-dialog-title {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
height: 90rpx;
text-align: center;
padding-left: 34rpx;
padding-right: 36rpx;
height: 100rpx;
background-color: rgb(255,255,255);
padding-left: 24rpx;
padding-right: 24rpx;
color: rgba(51, 51, 51, 1);
>view {
font-size: 32rpx;
color: rgb(51,51,51);
.icon-line {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
height: 100%;
border-bottom: 1rpx solid rgba(216, 216, 216, 0.3);
font-weight: bold;
&:first-child {
width: 258rpx;
}
&:nth-child(2) {
width: 166rpx;
}
&:nth-child(3) {
width: 126rpx;
>image {
width: 32rpx;
height: 30rpx;
margin-right: 12rpx;
}
}
}
@ -349,101 +199,79 @@
align-items: flex-start;
// flex-grow: 1;
// height: 428rpx;
padding-left: 34rpx;
padding-right: 36rpx;
padding-left: 24rpx;
padding-right: 24rpx;
background-color: rgb(255,255,255);
// padding-bottom: 0rpx;
// padding-bottom: calc( 0rpx + constant(safe-area-inset-bottom)); /* iOS < 11.2 */
// padding-bottom: calc( 0rpx + env(safe-area-inset-bottom)); /* iOS >= 11.2 */
.final-cart-list-dialog-content-for {
.main-right-list {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: flex-start;
// flex-grow: 1;
height: 114rpx;
border-bottom: 1rpx solid rgb(216,216,216);
background-color: rgb(255,255,255);
margin-top: 30rpx;
padding-top: 23rpx;
padding-bottom: 23rpx;
// border: 1px solid red;
.final-cart-list-dialog-content-col1 {
// display: flex;
.item-left {
width: 140rpx;
height: 140rpx;
margin-right: 20rpx;
position: relative;
border-radius: 10rpx;
>image {
max-width: 100%;
max-height: 100%;
}
}
.item-right {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
width: 258rpx;
justify-content: space-between;
flex-grow: 1;
>view {
overflow: hidden;
word-break: nowrap;
text-overflow: ellipsis; /* 超出部分省略号 */
display: -webkit-box; /** 对象作为伸缩盒子模型显示 **/
-webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
-webkit-line-clamp: 1; /** 显示的行数 **/
.item-right-top {
display: flex;
flex-direction: column;
&:first-child {
.item-right-name {
font-size: 28rpx;
color: rgb(51,51,51);
margin-bottom: 8rpx;
}
&:nth-child(2) {
.item-right-spec {
margin-top: 8rpx;
margin-bottom: 14rpx;
font-size: 24rpx;
color: rgb(154,154,157);
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
}
}
.final-cart-list-dialog-content-col2 {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
color: rgb(51,51,51);
font-size: 28rpx;
text-align: center;
width: 166rpx;
>input {
width: 132rpx;
height: 48rpx;
border: 2rpx solid rgb(216,216,216);
border-radius: 4rpx;
}
>view {
&:first-child {
}
&:nth-child(2) {
margin-left: 6rpx;
}
}
}
.final-cart-list-dialog-content-col3 {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
width: 126rpx;
>image {
width: 36rpx;
height: 36rpx;
.item-right-price-count {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
&:first-child {
}
&:nth-child(3) {
.item-right-price-row {
color: rgb(255,135,61);
>view {
&:first-child {
font-size: 32rpx;
line-height: 32rpx;
>text {
font-size: 24rpx;
line-height: 24rpx;
}
}
}
}
}
>view {
margin-left: 12rpx;
margin-right: 12rpx;
color: rgb(51,51,51);
font-size: 28rpx;
}
}
}
}
@ -451,9 +279,7 @@
.cg-footer {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
flex-direction: row;
// flex-grow: 1;
// opacity: 0.3;
@ -464,37 +290,38 @@
// padding-bottom: calc( 0rpx + constant(safe-area-inset-bottom)); /* iOS < 11.2 */
// padding-bottom: calc( 0rpx + env(safe-area-inset-bottom)); /* iOS >= 11.2 */
width: 100%;
height: 188rpx;
// height: 188rpx;
height: 108rpx;
// border: 1rpx solid blue;
background-color: rgb(255,255,255);
>view {
display: flex;
flex-direction: column;
// justify-content: flex-end;
align-items: flex-start;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
height: 100%;
.cg-footer-price {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
height: 88rpx;
width: 100%;
padding-right: 40rpx;
padding-left: 28rpx;
>view {
&:first-child {
font-size: 24rpx;
font-size: 28rpx;
color: rgba(51, 51, 51, 1);
}
&:nth-child(2) {
color: rgb(255,135,61);
font-size: 32rpx;
font-size: 36rpx;
>text {
font-size: 24rpx;
font-size: 28rpx;
}
}
}
@ -506,7 +333,7 @@
justify-content: flex-end;
align-items: center;
height: 88rpx;
width: 100%;
// width: 100%;
padding-right: 24rpx;
font-size: 32rpx;
@ -517,23 +344,9 @@
align-items: center;
}
.cg-footer-btn-reedit {
>button {
width: 242rpx;
height: 88rpx;
line-height: 88rpx;
border-radius: 44rpx;
padding: 0 0;
color: rgb(0,152,116);
background-color: rgb(255,255,255);
border: 2rpx solid rgb(0,152,116);
margin-right: 20rpx;
}
}
.cg-footer-btn-confirm {
>button {
width: 242rpx;
width: 240rpx;
height: 88rpx;
line-height: 88rpx;
border-radius: 44rpx;

569
src/subpackage/retail/pages/confirm_order/confirm_order.vue

@ -0,0 +1,569 @@
<template>
<view class="cg-container">
<view class="final-cart-list">
<view class="final-cart-list-dialog-title">
<view class="icon-line">
<image mode="aspectFit" src="/static/images/icon/retail/storeIcon.png"></image>
<view>{{ curStore.name ? curStore.name : '' }}</view>
</view>
<view class="amount-line">
<text>零售支付金额</text>
<view><text></text>{{ totalPrice }}</view>
</view>
</view>
<scroll-view class="pay-way-content" :scroll-top="0" :scroll-y="true" :style="{ height:cartListFinalHeight, paddingBottom:cartListFinalPaddingBottom }">
<view class="win-way">
<view class="win-way-item" v-for="(item, index) in payWayList" :key="index" @click="onPayWayClick(item, index)">
<view class="row1">
<image :class="[item.iconClassA, item.iconClassB]" mode="aspectFit" :src="item.icon"></image>
<text>{{ item.name }}</text>
<input v-if="item.inputShow&&!storeCardSelectShow" v-model="item.inputValue" :placeholder="item.placeholderLabel" placeholder-style="win-way-item-input-placeholder">
<image :class="[item.markClassA, item.markClassB]" mode="aspectFit" :src="item.mark"></image>
</view>
<view class="row2">
<view v-if="item.name==='储值卡支付'&&curChoose.name==='储值卡支付'&&curStoreInfo.card_no" class="store-card-info">
<view>储值卡卡号<text>{{ curStoreInfo.card_no }}</text></view>
<view>微信昵称<text>{{ curStoreInfo.nickname }}</text></view>
<view>手机号码<text>{{ curStoreInfo.mobile }}</text></view>
<view>卡名称<text>{{ curStoreInfo.card_name }}</text></view>
<view>卡余额<text>{{ curStoreInfo.balance }}</text></view>
</view>
</view>
<view class="row3">
<view class="bottom-line"></view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="cg-footer">
<view class="cg-footer-btn-confirm" @click="confirmPay"><button hover-class="hover-active">立即支付</button></view>
</view>
<storeCardSelect
:show="storeCardSelectShow" :price="totalPrice" :storeId="curStore.id"
@update:onClose="showOrHideStoreCardSelect" @update:onConfirm="storeCardConfirm"
>
</storeCardSelect>
</view>
</template>
<script>
import util from '../../../../utils/util.js';
import tools from '../../js/tools';
import retailServer from '../../js/retail_server';
import retailApi from '../../js/retail_api';
import storeCardSelect from '../../components/store_card_select/store_card_select';
export default {
components: {
'storeCardSelect': storeCardSelect
},
data() {
return {
curStore: {}, //
cartListFinal: [], //
totalPrice: 0, //
cartListScroll: false, //
cartListFinalHeight: "0rpx", //
cartListFinalPaddingBottom: "0rpx", //
payWayList: [], //
choosePath: "/static/images/icon/retail/choose.png",
noChoosePath: "/static/images/icon/retail/noChoose.png",
curChoose: {},
storeCardSelectShow: false,
curStoreInfo: {}
}
},
onLoad(option) {
let data = JSON.parse(decodeURIComponent(option.data));
this.curStore = data.curStore;
this.cartListFinal = [];
for (let i = 0; i < data.cartListFinal.length; ++i) {
this.cartListFinal.push(tools.getNewObj(data.cartListFinal[i]));
}
this.fixMainHeight(); //
this.calcTotalPrice(); //
this.createPayWayList(); //
util.showLoad();
setTimeout(util.hideLoad, 1000);
},
onShow() {
this.getPaySuccess(); //
},
methods: {
getPaySuccess() {
uni.getStorage({
key: 'paySuccess',
success: function (res) {
uni.removeStorage({
key: 'paySuccess',
success: function (res) {
uni.navigateBack({
delta: 2
});
}
});
},
fail: function(err) {},
});
},
//
goodsRetail(info) {
let _this = this;
let data = [];
for (let i = 0; i < this.cartListFinal.length; ++i) {
if (this.cartListFinal[i].count) {
data.push({
id: this.cartListFinal[i].id,
name: this.cartListFinal[i].erp_goods_name,
price: this.cartListFinal[i].erp_goods_price,
nums: this.cartListFinal[i].count,
unit: this.cartListFinal[i].erp_goods_unit,
});
}
}
let newData = {
store_id: _this.curStore.id,
goods_data: data,
pay_type: info.type,
};
if (info.inputValue) {
newData["other_pay_type"] = info.inputValue;
}
if (info.cardNo) {
newData["card_no"] = info.cardNo;
}
util.showLoad();
retailServer.post({
url: retailApi.assistantRetail,
data: newData,
isDefaultGet: false,
failMsg: '出库失败!'
}).then(res => {
if (res.data.code == 0) {
uni.setStorage({
key: "retailStatus",
data: "true",
success: function() {
util.hideLoad();
uni.navigateTo({
url: `/subpackage/retail/pages/pay_success/pay_success`
});
},
fail: function(err) {
util.hideLoad();
uni.navigateTo({
url: `/subpackage/retail/pages/pay_success/pay_success`
});
},
});
}
else {
util.showNone(res.data.message || '操作失败!');
}
});
},
//
confirmPay() {
let info = {
type: 0,
inputValue: "default",
cardNo: "default"
};
switch (this.curChoose.name) {
case "微信支付": {
info.type = 0;
} break;
case "支付宝支付": {
info.type = 1;
} break;
case "现金支付": {
info.type = 3;
} break;
case "其他": {
if (!this.curChoose.inputValue) {
util.showNone("请输入其他支付方式!");
return;
}
info.type = 4;
info.inputValue = this.curChoose.inputValue;
} break;
case "储值卡支付": {
if (!this.curStoreInfo.card_no) {
util.showNone("请搜索选择储值卡!");
return;
}
info.type = 2;
info.cardNo = this.curStoreInfo.card_no;
} break;
}
this.goodsRetail(info);
},
storeCardConfirm(info) {
this.curStoreInfo = info;
},
//
onPayWayClick(item, index) {
this.curChoose = item;
for (let i = 0; i < this.payWayList.length; ++i) {
this.payWayList[i].mark = this.noChoosePath;
}
this.payWayList[index].mark = this.choosePath;
if (item.name === '储值卡支付') {
this.showOrHideStoreCardSelect(true);
}
},
//
createPayWayList() {
this.payWayList = [
{
type: 0, name: "微信支付", inputShow: false, inputValue: "",
icon: "/static/images/icon/retail/wechat.png",
iconClassA: "win-way-item-icon", iconClassB: "",
placeholderLabel: "请输入其他支付方式",
mark: this.choosePath,
markClassA: "win-way-item-mark", markClassB: "",
},
{
type: 1, name: "支付宝支付", inputShow: false, inputValue: "",
icon: "/static/images/icon/retail/alipay.png",
iconClassA: "win-way-item-icon", iconClassB: "",
placeholderLabel: "请输入其他支付方式",
mark: this.noChoosePath,
markClassA: "win-way-item-mark", markClassB: "",
},
{
type: 3, name: "现金支付", inputShow: false, inputValue: "",
icon: "/static/images/icon/retail/cash.png",
iconClassA: "win-way-item-icon", iconClassB: "win-way-item-icon-dif",
placeholderLabel: "请输入其他支付方式",
mark: this.noChoosePath,
markClassA: "win-way-item-mark", markClassB: "",
},
{
type: 2, name: "储值卡支付", inputShow: false, inputValue: "",
icon: "/static/images/icon/retail/card.png",
iconClassA: "win-way-item-icon", iconClassB: "win-way-item-icon-dif",
placeholderLabel: "请输入其他支付方式",
mark: this.noChoosePath,
markClassA: "win-way-item-mark", markClassB: "win-way-item-mark-dif",
},
{
type: 4, name: "其他", inputShow: true, inputValue: "",
icon: "/static/images/icon/retail/other.png",
iconClassA: "win-way-item-icon", iconClassB: "",
placeholderLabel: "请输入其他支付方式",
mark: this.noChoosePath,
markClassA: "win-way-item-mark", markClassB: "",
},
];
this.curChoose = this.payWayList[0];
},
//
showOrHideStoreCardSelect(status) {
this.storeCardSelectShow= status;
},
//
calcTotalPrice() {
let price = 0.0;
for (let i = 0; i < this.cartListFinal.length; ++i) {
price += (this.cartListFinal[i].count * this.cartListFinal[i].erp_goods_price);
}
this.totalPrice = price.toFixed(2);
},
//
fixMainHeight() {
let _this = this;
uni.getSystemInfo({
success: res => {
console.log(res);
let sumHeight = res.windowHeight; //
// //
let query = uni.createSelectorQuery().select(".cg-footer");
query.boundingClientRect(data => {
sumHeight = sumHeight - data.height - uni.upx2px(480 + 24); // footer +bottom
let contentHeight = sumHeight;
_this.cartListFinalHeight = `${tools.px2rpx(contentHeight)}rpx`;
_this.cartListScroll = true;
_this.cartListFinalPaddingBottom = `${res.safeArea.top >= 44 ? tools.px2rpx(res.safeArea.top) : 0}rpx`;
}).exec();
}
});
},
}
}
</script>
<style lang="scss">
page {
// background-color: rgb(237,237,245);
background-color: rgb(255,255,255);
}
.cg-container {
display: flex;
flex-direction: column;
width: 100vw;
height: 100vh;
padding-bottom: 0rpx;
padding-bottom: calc( 0rpx + constant(safe-area-inset-bottom)); /* 兼容 iOS < 11.2 */
padding-bottom: calc( 0rpx + env(safe-area-inset-bottom)); /* 兼容 iOS >= 11.2 */
// border: 1px solid red;
.final-cart-list {
display: flex;
flex-direction: column;
// width: 100%;
// height: 100%;
flex-grow: 1;
background-color: rgb(237,237,245);
.final-cart-list-dialog-title {
width: 100%;
height: 480rpx;
background-color: rgb(255,255,255);
padding-left: 24rpx;
padding-right: 24rpx;
color: rgba(51, 51, 51, 1);
margin-bottom: 24rpx;
.icon-line {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
height: 100rpx;
border-bottom: 1rpx solid rgba(216, 216, 216, 0.3);
font-weight: bold;
>image {
width: 32rpx;
height: 30rpx;
margin-right: 12rpx;
}
}
.amount-line {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #333333;
height: 380rpx;
>text {
margin-bottom: 26rpx;
font-size: 28rpx;
}
>view {
font-size: 80rpx;
font-weight: bold;
>text {
font-size: 60rpx;
}
}
}
}
.pay-way-content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
// flex-grow: 1;
// height: 428rpx;
// padding-left: 24rpx;
// padding-right: 24rpx;
background-color: rgb(255,255,255);
// padding-bottom: 0rpx;
// padding-bottom: calc( 0rpx + constant(safe-area-inset-bottom)); /* iOS < 11.2 */
// padding-bottom: calc( 0rpx + env(safe-area-inset-bottom)); /* iOS >= 11.2 */
.win-way {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
.win-way-item {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
padding-left: 40rpx;
padding-right: 36rpx;
padding-top: 28rpx;
// padding-bottom: 28rpx;
position: relative;
.row1 {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
.win-way-item-icon {
width: 54rpx;
height: 54rpx;
flex-shrink: 0;
}
.win-way-item-mark {
width: 36rpx;
height: 36rpx;
flex-shrink: 0;
}
.win-way-item-icon-dif {
width: 52rpx;
height: 52rpx;
flex-shrink: 0;
}
.win-way-item-mark-dif {
width: 34rpx;
height: 34rpx;
flex-shrink: 0;
}
> text {
color: rgba(24, 24, 24, 1);
font-size: 28rpx;
flex-grow: 1;
flex-shrink: 0;
margin-left: 16rpx;
margin-right: 16rpx;
}
> input {
margin-left: 24rpx;
margin-right: 132rpx;
width: 340rpx;
border-radius: 10rpx;
border: 2rpx solid rgba(216, 216, 216, 1);
background-color: white;
padding-left: 16rpx;
padding-right: 16rpx;
padding-top: 10rpx;
padding-bottom: 10rpx;
font-size: 28rpx;
}
.win-way-item-input-placeholder {
color: rgba(154, 154, 157, 1);
font-size: 28rpx;
}
}
.row2 {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
.store-card-info {
display: flex;
flex-direction: column;
// width: 100%;
width: 612rpx;
position: relative;
flex-shrink: 0;
padding-top: 26rpx;
> view {
color: rgba(156, 156, 159, 1);
font-size: 28rpx;
margin-bottom: 5rpx;
> text {
color: rgba(51, 51, 51, 1);
font-size: 28rpx;
}
}
}
}
.row3 {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
width: 100%;
.bottom-line {
// width: 80.5%;
width: 612rpx;
height: 1rpx;
background-color: rgba(216, 216, 216, 1);
margin-top: 26rpx;
}
}
}
}
}
}
.cg-footer {
display: flex;
flex-direction: row;
// flex-grow: 1;
// opacity: 0.3;
position: fixed;
// bottom: 0rpx;
bottom: calc( 0rpx + constant(safe-area-inset-bottom));
bottom: calc( 0rpx + env(safe-area-inset-bottom));
// padding-bottom: calc( 0rpx + constant(safe-area-inset-bottom)); /* iOS < 11.2 */
// padding-bottom: calc( 0rpx + env(safe-area-inset-bottom)); /* iOS >= 11.2 */
width: 100%;
// height: 188rpx;
height: 112rpx;
// border: 1rpx solid blue;
background-color: rgb(255,255,255);
.cg-footer-btn-confirm {
width: 100%;
height: 100%;
padding-left: 20rpx;
padding-right: 20rpx;
display: flex;
>button {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
border-radius: 10rpx;
padding: 0 0;
color: rgb(255,255,255);
background-color: #FF873D;
border: transparent;
font-size: 32rpx;
font-weight: bold;
}
}
}
}
</style>

28
src/subpackage/retail/pages/index/index.vue

@ -44,7 +44,7 @@
<view class="item-right">
<view class="item-right-top">
<view class="item-right-name">{{ item.erp_goods_name }}</view>
<view class="item-right-spec">{{ item.erp_goods_specs }}</view>
<view class="item-right-spec">{{ `${item.erp_goods_specs}/${item.erp_goods_specs}/${item.erp_goods_specs}` }}</view>
<view class="item-right-special">特价</view>
</view>
@ -140,6 +140,11 @@ export default {
this.getSearchLocal(); //
this.getRetailStatus(); //
},
watch: {
cartList() {
this.setCartConfirmStyle();
},
},
methods: {
//
getRetailStatus() {
@ -288,7 +293,15 @@ export default {
//
clearCart() {
this.cartList = [];
for (let i = 0; i < this.goodsInfo.length; ++i) {
for (let j = 0; j < this.goodsInfo[i].goods_list.length; ++j) {
this.goodsInfo[i].goods_list[j].count = 0;
}
}
this.isShowCartList = false;
this.calcCartTotalPriceAndCount(); //
this.calcTotalPriceAndCount(); //
},
//
@ -335,10 +348,13 @@ export default {
if (this.cartList[i].count <= 0) {
this.cartList.splice(i, 1);
}
//
if (!this.cartList.length) {
this.isShowCartList = false;
}
this.calcCartTotalPriceAndCount(); //
this.calcTotalPriceAndCount(); //
this.setCartConfirmStyle();
},
//
@ -396,8 +412,6 @@ export default {
for (let i = 0; i < tempData.length; ++i) {
this.cartList.push(tools.getNewObj(tempData[i]));
}
this.setCartConfirmStyle();
},
setCartConfirmStyle() {
@ -406,6 +420,10 @@ export default {
//
cartClick() {
if (!this.cartList.length) {
return;
}
if (this.isShowCartList) {
this.isShowCartList = false;
}

77
src/subpackage/retail/pages/pay_success/pay_success.vue

@ -0,0 +1,77 @@
<template>
<view class="success-container">
<image mode="aspectFit" src="/static/images/icon/retail/paySuccess.png"></image>
<view>支付成功</view>
<button hover-class="hover-active" @click="review()">查看订单详情</button>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {
uni.setStorage({
key: "paySuccess",
data: "true",
success: function() {},
fail: function(err) {},
});
},
methods: {
review() {
//
uni.removeStorage({
key: 'retailStatus',
success: function (res) {}
});
uni.removeStorage({
key: 'paySuccess',
success: function (res) {}
});
uni.reLaunch({
url: `/pages/order_list/order_list?order_type=19`,
complete: function(res) {
console.log(res);
}
});
}
}
}
</script>
<style lang="scss">
.success-container {
display: flex;
flex-direction: column;
// justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
padding-bottom: 0rpx;
padding-bottom: calc( 0rpx + constant(safe-area-inset-bottom)); /* 兼容 iOS < 11.2 */
padding-bottom: calc( 0rpx + env(safe-area-inset-bottom)); /* 兼容 iOS >= 11.2 */
font-size: 32rpx;
color: #333333;
>image {
width: 132rpx;
height: 132rpx;
margin-top: 60rpx;
}
>view {
font-weight: bold;
margin-top: 30rpx;
margin-bottom: 102rpx;
}
> button {
color: #009874;
border: 2rpx solid #009874;
border-radius: 44rpx;
}
}
</style>
Loading…
Cancel
Save