import store from '@/store/index.js';
import { HTTP_REQUEST_URL } from '@/config/app';
import { getMerchantInfo } from '@/api/user.js';

/**
 * 使用方式：
 * 进入半屏小程序所需的参数
 * parameter: {
		need_login: 1,
		shop_id: 1
	}
*/

const PayParams = function(parameter) {
	return getMerchantInfo(parameter.shop_id).then(res => {
		let shopData = res.data;
		
		return {
			name: shopData.name,
			code: res.data.bar_code,
			need_login: parameter.need_login,
			shop_id: parameter.shop_id,
			price: parameter.price,
			isVip: parameter.isVip,
			envVersion: parameter.envVersion,
			
			status: parameter.status,
			token: parameter.token,
			BASE_URL: HTTP_REQUEST_URL,
			REQUEST_URL: parameter.REQUEST_URL,
		};
	});
};

export default PayParams;