Authored by 黄敬囿

提交订单

Showing 40 changed files with 875 additions and 0 deletions
Component({
properties: {
item:Object,
},
data: {
},
attached: function () {},
methods: {}
})
\ No newline at end of file
... ...
{
"component":true
}
\ No newline at end of file
... ...
<view class='title-tip'>
<view class='title-tip-txt'>{{item.name}}</view>
<image bindtap='showInvoceExplain' class='title-tip-img' src='../../../images/hlep_ic@2x.png'></image>
</view>
\ No newline at end of file
... ...
.title-tip{
background-color: #f0f0f0;
height: 80rpx;
align-items: center;
display: flex;
flex-direction: row;
border-top: 1rpx solid #e0e0e0;
border-bottom: 1rpx solid #e0e0e0;
}
.title-tip-txt{
font-size: 28rpx;
line-height: 1.14;
text-align: left;
color: #b0b0b0;
margin-left: 20rpx;
}
.title-tip-img{
width: 28rpx;
height: 28rpx;
margin-left: 20rpx;
}
\ No newline at end of file
... ...
Component({
properties: {},
data: {},
methods: {}
})
\ No newline at end of file
... ...
{
"component": true
}
\ No newline at end of file
... ...
<view class="split-view-root">oooo</view>
\ No newline at end of file
... ...
.split-view-root {
width: 100%;
height: 15rpx;
/* background-color: #f0f0f0;
border-bottom-style:solid;
border-bottom-width: 1rpx;
border-bottom-color: #e0e0e0;
border-top-style:solid;
border-top-width: 1rpx;
border-top-color: #e0e0e0; */
}
\ No newline at end of file
... ...
Component({
properties: {
item: Object,
},
data: {},
methods: {}
})
\ No newline at end of file
... ...
{
"component":true
}
\ No newline at end of file
... ...
<view class="item-view-root">
<text class="item-view-amount-title">{{item.promotion}}</text>
<text class="item-view-amount-text1">{{item.promotion_amount}}</text>
</view>
\ No newline at end of file
... ...
.item-view-root {
width: calc(100% - 60rpx);
display: flex;
flex-direction: row;
justify-content: space-between;
margin-left: 30rpx;
}
.item-view-amount-title {
background-color: white;
font-family: PingFang SC;
font-size: 28rpx;
color: #444444;
}
.item-view-amount-text1 {
background-color: white;
text-align: right;
font-family: PingFang SC;
font-size: 28rpx;
color: #444444;
}
... ...
Component({
properties: {
product:Object,
},
data: {
},
attached: function () {},
methods: {}
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class="product-view-root">
<image class="product-view-image" src="{{product.goods_images}}" mode="" />
<view class="product-view-middle">
<text class="product-view-name">{{product.product_name}}</text>
<text class="product-view-color">颜色:{{product.color_name}},尺码:{{product.size_name}}</text>
</view>
<view class="product-view-right">
<text class="product-view-price">{{product.sales_price}}</text>
<text class="product-view-buynum">{{product.buy_number}}</text>
</view>
</view>
\ No newline at end of file
... ...
.product-view-root {
display: flex;
flex-direction: row;
margin-left: 30rpx;
}
.product-view-image {
width: 150rpx;
height: 200rpx;
}
.product-view-middle {
width: 400rpx;
display: flex;
flex-direction: column;
margin-left: 18rpx;
}
.product-view-name {
color: #444444;
font-family: PingFang SC;
font-size: 26rpx;
background-color: white;
text-overflow: ellipsis;
}
.product-view-color {
/* width: 300rpx; */
color: #B0B0B0;
font-family: PingFang SC;
font-size: 24rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.product-view-right {
width: 120rpx;
display: flex;
flex-direction: column;
}
.product-view-price {
/* height: 20px; */
/* margin-top: 28rpx; */
text-align: right;
font-family: PingFang SC;
font-size: 26rpx;
color: #D0021B;
background-color: white;
}
.product-view-buynum {
color: #B0B0B0;
margin-top: 10rpx;
text-align: right;
font-family: PingFang SC;
font-size: 22rpx;
background-color: white;
}
\ No newline at end of file
... ...
Component({
properties: {},
data: {},
methods: {}
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class="promotion-item-root">
<view>
<text class="promotion-item-title-text">配送方式</text>
<text class="promotion-item-subtitle-text">0张可用</text>
<image class="promotion-item-hlep-image" src="../../../images/hlep_ic@2x.png" mode="2" />
</view>
<view>
<text class="promotion-item-title-text">未使用</text>
<image class="promotion-item-hlep-image" src="../../../images/arrow@2x.png" mode="2" />
</view>
</view>
\ No newline at end of file
... ...
.promotion-item-root {
width: calc(100% - 60rpx);
display: flex;
flex-direction: row;
justify-content: space-between;
margin-left: 30rpx;
}
.promotion-item-title-text {
/* width: 50%; */
color: #444444;
font-family: PingFang SC;
font-size: 30rpx;
text-align: left;
/* margin-left: 30rpx; */
}
.promotion-item-subtitle-text {
color: #b0b0b0;
font-family: PingFang SC;
font-size: 22rpx;
background-color: white;
text-align: left;
}
.promotion-item-hlep-image {
width: 20rpx;
height: 20rpx;
}
\ No newline at end of file
... ...
Component({
properties: {
items:Object,
},
data: {
isDisplaydeliveryWay: false,
},
attached: function () {},
methods: {
onDeleverWayClick: function () {
let isDisplaydeliveryWay = this.data.isDisplaydeliveryWay;
if(isDisplaydeliveryWay) {
isDisplaydeliveryWay = false;
}else {
isDisplaydeliveryWay = true;
}
this.setData({
isDisplaydeliveryWay,
});
},
checkboxChange: function (e) {
let selectId = e.currentTarget.id
let lastId = e.target.id;
var items = this.data.items;
items && items.map((item,index)=>{
let id = item.delivery_way_id;
if(selectId == id){
item.checked = true;
}else {
item.checked = false;
}
})
let params = {
delivery_way: selectId,
}
let detail = {
params,
};
var option = {} // 触发事件的选项
this.triggerEvent(
'checkboxChange',
detail,
option
)
this.setData({
items,
});
}
}
})
\ No newline at end of file
... ...
{
"component":true
}
\ No newline at end of file
... ...
<view class="select-view-root" bindtap="onDeleverWayClick">
<text class="select-item-title">配送方式</text>
<view>
<text class="select-item-subtitle">普通快递:运费¥10</text>
<image class="select-item-image" src="../../../images/filter-downIc@2x.png" mode="2" />
</view>
</view>
<label class="select-item-checkbox-view" tt:for="{{items}}" tt:key="{{item.delivery_way_id}}">
{{item.delivery_way_name}}
<checkbox class="select-item-checkbox" color="#000000" id="{{item.delivery_way_id}}"
checked="{{item.checked}}" bindtap="checkboxChange"/>
</label>
\ No newline at end of file
... ...
.select-view-root {
height: 80rpx;
width: calc(100% - 60rpx);
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-left: 30rpx;
}
.select-item-title-view {
/* width: 50%; */
display: flex;
flex-direction: row;
align-items: center;
}
.select-item-image {
width: 25rpx;
height: 14rpx;
margin-left: 20rpx;
}
.select-item-title {
color: #444444;
font-family: PingFang SC;
font-size: 30rpx;
background-color: white;
text-align: left;
display: flex;
align-items: center;
/* margin-right:10rpx; */
}
.select-item-subtitle {
/* flex-grow: 1; */
color: #444444;
font-family: PingFang SC;
font-size: 28rpx;
background-color: white;
text-align: right;
}
.select-item-checkbox-view {
height: 80rpx;
width: calc(100% - 60rpx);
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
color: #444444;
font-family: PingFang SC;
font-size: 30rpx;
text-align: left;
margin-left: 30rpx;
}
.select-item-checkbox {
transform: scale(0.6,0.6);
}
\ No newline at end of file
... ...
Component({
/**
* 组件的属性列表
*/
properties: {
item: Object,
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
changeSwitch: function (e) {
let info = e.currentTarget.dataset.info
if(info) {
let id = info.id;
let isChecked = info.isChecked;
let status = isChecked;
if(isChecked) {
status = false;
}else {
status = true;
}
let detail = {
id,
isChecked,
};
var option = {} // 触发事件的选项
this.triggerEvent(
'changeSwitch',
detail,
option
)
let item = this.data.item;
item.isChecked = status;
this.setData({
item,
});
}
},
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class="swich-item-root">
<view class="swich-item-title-view">
<text class="swich-item-title-text">{{item.title}}</text>
<text class="swich-item-subtitle-text">{{item.subtitle}}</text>
<image class="swich-item-hlep-image" tt:if="{{item.isShowHelp}}" src="../../../images/hlep_ic@2x.png" mode="2" />
</view>
<switch class="swich-item-view" color="#20CC23" checked="{{item.isChecked}}" data-info="{{item}}"bindchange="changeSwitch"/>
</view>
<view class="swich-item-root" tt:if="{{item.isChecked}}">
<text class="swich-item-info-text">发票信息 电子发票-个人</text>
<image class="swich-item-next-image" src="../../../images/arrow@2x.png" mode="2" />
</view>
... ...
.swich-item-root {
display: flex;
flex-direction: row;
justify-content: space-between;
width: calc(100% - 60rpx);
margin-left: 30rpx;
align-items: center;
height: 80rpx;
}
.swich-item-title-view {
/* width: 50%; */
display: flex;
flex-direction: row;
align-items: center;
}
.swich-item-title-text {
/* width: 50%; */
color: #444444;
font-family: PingFang SC;
font-size: 30rpx;
text-align: left;
/* margin-left: 30rpx; */
}
.swich-item-subtitle-text {
color: #b0b0b0;
font-family: PingFang SC;
font-size: 22rpx;
background-color: white;
text-align: left;
}
.swich-item-hlep-image {
width: 20rpx;
height: 20rpx;
}
.swich-item-item-info-view-root {
width: 30rpx;
height: 30rpx;
}
.swich-item-next-image {
width: 30rpx;
height: 30rpx;
}
.swich-item-view {
/* width: 30rpx; */
/* height: 30rpx; */
zoom:60%;
}
.swich-item-info-text {
color: #444444;
font-family: PingFang SC;
font-size: 34rpx;
background-color: white;
text-align: left;
}
\ No newline at end of file
... ...
{
}
\ No newline at end of file
... ...
import api from '../../common/api.js';
import {formatImageUrl} from '../../utils/util';
import {parseComputeData} from '../../utils/statementsUtil';
import { aliPay } from '../../utils/payUtil';
const FROM_PRODUCT_DETAIL = "productdetail";
const FROM_SHOPPING_CART = "shopcart"
Page({
data: {
// payment: {},
isDisplaydeliveryWay: false,
isShowAddNewAddress: false,
invoicesItem: {
id: "invoices",
title: "发票",
subtitle: "",
isChecked: false,
isShowHelp: false,
},
submitparam: {
address_id: 'nIwE1fqIniAyb+HmGedV4g==',//送货地址id
coupon_code: '',//优惠券code,多个用","分割
delivery_time: 0,//寄送时间类型
delivery_way: 1,//发货方式(1:普通, 2顺丰)
payment_id:15,//支付id 默认支付宝
payment_type:1,//支付方式,1 在线支付 2 货到付款
receiverMobile:'',
sale_channel:1,
use_red_envelopes: 0,//使用的红包,单位元
use_red_package: 0,//使用的红包,单位元
use_yoho_coin: 0,//使用的yoho币金额,单位元
// method: 'app.Buynow.submit',
// product_sku:'474098',
// sku_type: 'I',
// buy_number: 1,
uid: '600033236',
// invoice_content: 12,
// invoices_title: '个人',
// invoices_type: 2,
// buyerTaxNumber: '',
}
},
onLoad: function (option) {
if(option && option.fromPage){
let fromPage = option.fromPage;
this.data.fromPage = fromPage;
if(fromPage === FROM_PRODUCT_DETAIL){
this.data.submitparam.method = "app.Buynow.submit";
this.data.submitparam.sku_type = "I";
this.data.submitparam.buy_number = 1;
// this.data.submitparam.product_sku="474098";
}else if(fromPage === FROM_SHOPPING_CART ){
this.data.submitparam.method = "app.Shopping.submit";
this.data.submitparam.cart_type = "ordinary";
this.data.submitparam.is_continue_buy = "N";
this.data.submitparam.is_print_price = "N";
}
}
let pages = getCurrentPages();
let length =pages.length;
let payment = {};
if(length > 1){
let lastPageData = pages[length - 2].data;
this.setData({
lastPageData,
});
}
this.fechPaymentInfo();
},
onShow: function () {},
fechPaymentInfo: function () {
let that = this;
let param = {
buy_number:1,
is_support_apple_pay:'N',
method:'app.Buynow.enhancedPayment',
open_red_package:true,
product_sku:'474098',
sku_type:'I',
uid:'600033236',
yoho_coin_mode:0
}
api.get({data: param})
.then(json=>{
if(json && json.code == 200){
let data = json.data;
if(data){
let resultData = parseComputeData(data,75,100);
let addressInfo = data.delivery_address;
if(addressInfo){
let addressId = resultData.delivery_address.address_id
that.data.submitparam.address_id = addressId;
that.data.isShowAddNewAddress = false;
}else {
that.data.isShowAddNewAddress = true;
}
if(that.data.fromPage === FROM_PRODUCT_DETAIL){
let productInfo = data.goods_list[0];
if(productInfo){
let productSku = productInfo.product_sku;
that.data.submitparam.product_sku = productSku;
}
}
that.setData({
data:resultData,
})
}
}
})
},
fechCompute: function (refreshParam) {
let that = this;
let goods_list = that.data.data.goods_list;
let goodsInfo = that.data.data.goods_list[0];
let params = {
buy_number:goodsInfo.buy_number,
cart_type:"ordinary",
// coupon_code:
// delivery_way:2,
method:"app.Buynow.compute",
open_red_package:false,
payment_type:1,
product_sku:goodsInfo.product_sku,
sku_type:"I",
uid:'600033236',
yoho_coin_mode:0
}
let assignData = Object.assign(refreshParam, params);
api.get({data: assignData})
.then(json=>{
if(json && json.code == 200){
let data = json.data;
let resultData = parseComputeData(data,75,100);
// data.delivery_way = this.parseDelivery(data.delivery_way);
let oldData = that.data.data;
let result = Object.assign(oldData, data);
that.setData({
data:result,
})
}
})
},
refreshCompute: function (e) {
let selectParam = e.detail.params;
this.fechCompute(selectParam);
},
onChangeSwitch: function (e) {
let isChecked = e.detail.isChecked;
this.data.invoicesItem.isChecked = isChecked;
},
addNewAddress: function () {
//新增收货地址,跳转到新增页面
},
submit: function () {
let params = this.data.submitparam;
api.get({data: params})
.then(json=>{
if(json && json.code == 200){
let data = json.data;
debugger
aliPay(data);
}
})
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "确认订单",
"usingComponents": {
"deliveryInfo": "../../components/orders/orderDetail/deliveryInfo/deliveryInfo",
"product-view": "../../components/statements/productInfo/product-view",
"select-view": "../../components/statements/selectItem/select-view",
"swichItem": "../../components/statements/swichInfo/swichItem",
"promotionItem": "../../components/statements/promotionInfo/promotionItem",
"item-view": "../../components/statements/amountItem/item-view"
}
}
\ No newline at end of file
... ...
<!-- 商品信息 -->
<view class="statements-add-address-view" tt:if="{{data.isShowAddNewAddress}}" bindtap="addNewAddress">
<view>
<image class="statements-add-address-addicon" src="../../../images/add@2x.png" mode="" />
<text>新增收货地址</text>
</view>
<image class="statements-add-address-addicon" src="../../../images/arrow@2x.png" mode="" />
</view>
<deliveryInfo id="addressInfo" data="{{data.delivery_address}}"></deliveryInfo>
<view class="split-view"/>
<product-view id="productInfo" product="{{data.goods_list[0]}}"></product-view>
<view class="split-view"/>
<select-view id="deliveryInfo" items="{{data.delivery_way}}" bind:checkboxChange="refreshCompute"/>
<swichItem id="invoiceItem" item="{{invoicesItem}}" bind:changeSwitch="onChangeSwitch"/>
<!-- <promotionItem id="couponsItem"/> -->
<view class="split-view"/>
<view>
<block tt:for="{{data.promotion_formula_list}}" tt:for-item="amountInfo" tt:key="{{index}}">
<item-view id="amountItem" item="{{amountInfo}}"/>
</block>
<item-view id="realamount" item="{{data.real_amount}}"/>
</view>
<!-- <view> -->
<view class="split-view"/>
<text class="select-item-pay-button" bindtap="submit">支付宝支付</text>
<!-- </view> -->
... ...
page{
width: 100%;
height: 100%;
/* padding-left: 30rpx;
padding-right: 30rpx; */
align-content: center;
display: flex;
flex-direction: column;
}
.statements-add-address-addicon {
width: 30rpx;
height: 30rpx;
}
.statements-add-address-view {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-left: 30rpx;
margin-right: 30rpx;
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.amount-view-root {
display: flex;
flex-direction: column;
}
/* .select-item-pay-view {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
} */
.select-item-pay-button {
width: 90%;
/* height: 90rpx; */
background-color: rgb(32, 204, 35);
margin-top: 40rpx;
color: white;
text-align: center;
line-height: 90rpx;
margin-left: 35rpx;
/* align-items: center; */
/* align-content: center; */
}
.split-view {
width: 100%;
height: 15rpx;
background-color: #f0f0f0;
border-bottom-style:solid;
border-bottom-width: 1rpx;
border-bottom-color: #e0e0e0;
border-top-style:solid;
border-top-width: 1rpx;
border-top-color: #e0e0e0;
}
\ No newline at end of file
... ...
import api from '../common/api.js';
import config from '../config';
function pay(data) {
let orderCode = data.order_code;
let param = {
order_code: orderCode,
payment_code: config.payment_code
}
api.get({data: param,url:"/payment/alipay_data"})
.then(json=>{
let data = json.data
if(data){
let payParams = data.payParams;
}
})
}
//支付确认接口
function payConfirm(orderCode){
if(!orderCode||orderCode==0){
return
}
let param = {
method:'app.SpaceOrders.payConfirm',
order_code:orderCode,
payment_id:45,
// uid:"",
}
api.get({data: param})
.then(json=>{
})
}
function ttPayment(payParams){
tt.requestPayment({
data: {
app_id: '1900006024',
method: 'tp.trade.confirm',
sign: 'i0amuwt0wganx7v1hsu0748uc8fb91zz1x96a8x5',
sign_type: 'MD5',
timestamp: '1534342228111',
trade_no: '20180821162045321823181631558207',
merchant_id: '800060248973',
uid: '6287430262',
total_amount: 12,
pay_channel: 'ALIPAY_NO_SIGN',
pay_type: 'ALIPAY_APP',
params: JSON.stringify({
// 如果是新版支付宝,url 示例:
url: 'app_id=2018041302549907&biz_content=%7B%22body%22%3A%22novel%22%2C%22subject%22%3A%22%E6%B5%8B%E8%AF%95%E7%9A%84%E5%95%86%E5%93%81%22%2C%22out_trade_no%22%3A%22201808211756233909095950%22%2C%22timeout_express%22%3A%2230m%22%2C%22total_amount%22%3A%220.01%22%2C%22seller_id%22%3A%22jrtoutiaoyxgs%40bytedance.com%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%7D&charset=utf-8&format=JSON&method=alipay.trade.app.pay&notify_url=https%3A%2F%2Ftp-pay-test.snssdk.com%2Fcallback%2Fali_pay&sign=ZfVkvu%2FSzBqFuqQMgr6MvsXomlr6BCuz7GYDnpsxd3SLVfCssV0q2cnxZyfjh%2FY%2Bk7PO1IeEl4rppQg%2FXgRuIqMXyKdhmigj4oPdQVJEkbSQEcCW4m8mwpXLNjlLH%2FHae3u3hjrMDVPuVXeIxjoq1NLPXy09GY5u1MX8E2lkn8xtmOxA2cXXRIrAa8gTplUoXWkSSkZMgvSTzQ9RjRmlKtK4nERdDWh5RBXLNDU%2FD2FfqIeZuLNZh%2BW8j4dYGtPDm9nWYRz0tLizJDm6E76aTM3qvLi0havCCrHgxZ5d8tVN7GNztA6olbGOiXubEGUq4yBqCojiALEEVpKqfQdZGQ%3D%3D&sign_type=RSA2&timestamp=2018-08-21+17%3A56%3A24&version=1.0'
}),
},
success (res) {
console.log(res.errMsg);
},
fail (res) {
console.log(res.errMsg);
}
})
}
module.exports = {
aliPay: pay,
}
... ...
'use strict'
import {formatImageUrl} from './util';
//获取应用实例
let app = getApp();
function parseComputeData(data, imageHeight, imageWidth) {
let newData = {};
for (var item in data){
let key = item;
let value = data[item];
if(key === "shopping_cart_data"){
for(var shaoppingItem in value){
newData[shaoppingItem] = value[shaoppingItem];
}
}else {
if(key === "delivery_address"){
value = parseDeliveryAddress(value);
}
if(key === "goods_list"){
value = parseGoods(value,imageHeight,imageWidth);
}
if(key === "delivery_way"){
value = parseDelivery(value);
}
newData[key] = value;
}
}
return newData;
}
//解析处理配送方式数据
function parseDelivery(deliverys) {
let newData = [];
deliverys && deliverys.map((item, index) => {
let isChecked = item["default"];
if(isChecked === 'Y'){
item.checked = true;
}else{
item.checked = false;
}
newData.push(item);
});
return newData;
}
//解析处理商品数据
function parseGoods(list,imageHeight,imageWidth) {
list && list.map((item, index) => {
let imageUrl = formatImageUrl(item.goods_images,imageWidth,imageHeight,2)
item.goods_images = imageUrl;
});
return list;
}
//解析处理配送地址数据
function parseDeliveryAddress(address){
for (var key in address){
if(key === 'consignee'){
let value = address[key];
address.user_name = value;
}
}
return address;
}
module.exports = {
parseComputeData,
}
... ...